# FatFs - f_mount

## f_mount

The f_mount fucntion registers/unregisters file system object (work area) to the FatFs module.

    FRESULT f_mount (
      BYTE  vol,     /* [IN] Logical drive number */
      FATFS*  fatfs  /* [IN] File system object */
    );

#### Parameters

vol
  Logical drive number to register/unregister file system object. (0 to `_VOLUMES - 1`)
fatfs
  Pointer to the file system object to be registered. Null pointer unregisters the registered file system object.

#### Return Values

FR_OK, FR_INVALID_DRIVE

#### Description

The `f_mount()` function registers/unregisters a file system object to the FatFs module. The file system object is the work area needed for each logical drive. It must be given to the logical drive with this function prior to use any other file functions. To unregister a work area, specify a NULL to the `fatfs`, and then the work area can be discarded.

This function always succeeds regardless of the physical drive status. No media access is occured in this function. It only de-initializes the given work area and registers its address to the internal table. It can also be used to force de-initialized the registered work area of a logical drive. The volume mount process, initialize the corresponding physical drive, find the FAT volume in it and initialize the work area, is performed when either or both of following condition is true:

- File system object is not initialized. (by `f_mount()`)
- Physical drive is not initialized. (by system reset or media removal)

If the disk I/O layer does not detect media change, application program needs to perform `f_mount()` every media change.

#### QuickInfo

Always available.

#### See Also

`FATFS`

Return