What is Fstab
The file Fstab contains information about the storage devices and their file systems on your computer. With Fstab, you can implement hard drives, partitions, removable devices, and remote devices that automatically mount various file system formats.
Fstab File Example
My configuration on the machine:
Perform sudo fdisk-l display current hard drive partitions:
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 2611 20972826 7 hpfs/ntfs
/dev/sda2 2612 14092 92221132+ f W95 Ext ' d (LBA)
/dev/sda3 14093 14554 3711015 Linux
/DEV/SDA4 14555 14593 313267+ Linux Swap/solaris
/dev/sda5 2612 6528 31463271 b W95 FAT32
/dev/sda6 6529 14092 60757829+ Linux
To perform cat/etc/fstab, display the fstab configuration file:
#/etc/fstab:static File System information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
PROC/PROC proc Defaults 0 0
#/dev/sda3
Uuid=f2f081ea-e7a5-4874-bcfb-51601ad92237/ext3 Relatime,errors=remount-ro 0 0
#/DEV/SDA4
uuid=c4526f70-ac8e-45c1-95d9-3203a60bad3b None swap SW 0 0
/dev/scd0/media/cdrom0 udf,iso9660 User,noauto,exec,utf8 0 0
/dev/sda1/media/disk0 NTFS Defaults,user,rw,iocharset=utf8,umask=000,nls=utf8 0 0
/dev/sda5/media/disk1 vfat Defaults,user,rw,codepage=936,iocharset=utf8 0 0Fstab Detailed
Let's have a detailed understanding of the usage of fstab. A typical entry has the following fields (fields separated by spaces or tabs):
<file system> <dir> <type> <options> <dump> <pass>
File system: Device name, which can be viewed through Ls/dev. Dir: The directory that is expected to be mounted, this must already exist. Type: Refers to the type of file system on which the device or partition is mounted (for example: Ext2, Ext3, ReiserFS, XFS, JFS, Smbfs, iso9660, VFAT, NTFS, swap, etc.). Options: Option. Set specific options for some file systems. This is not detailed here, specific description:
The FAT32 file system configuration is as follows: Defaults,user,rw,codepage=936,iocharset=utf8, assignment representative: By default, all users can use, readable and writable, followed by an item to avoid garbled display.
The NTFS file system configuration is as follows: Defaults,user,rw,iocharset=utf8,umask=000,nls=utf8, assignment Rep: By default, all users can use, readable and writable, and a later item to avoid garbled display. Dump: The dump utility is used to decide whether to make a backup. Most users do not have dump installed, so it should be written as 0. PASS:FSCK will check the number of the leader to determine the order of the file system, configured to 0, the boot will not be checked. judge whether the Fstab is correct
You can use the sudo mount-a, the-a parameter to indicate that you are mounting using the configuration in/etc/fstab. If you find that the configuration is incorrect, you can then use sudo umount/dev/xxx to uninstall the corresponding device. This avoids the reboot of the computer every time you modify it. The reason for mount failure can be viewed through the DMESG command.