目录
# <file system> <mount point> <type> <options> <dump> <pass>
mount point
该字段描述希望的文件系统加载的目录,对于swap设备,该字段为none
file system
例如/dev/cdrom或/dev/sdb,除了使用设备名,你可以使用设备的UUID或设备的卷标签,例如,LABAL=root 或 UUID=7f91104e-8187-4ccf-8215-6e2e641f32e3
type
定义了该设备上的文件系统,系统可用文件系统
$ cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev cpuset
nodev tmpfs
nodev devtmpfs
nodev debugfs
nodev securityfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev inotifyfs
nodev devpts
ext3
ext2
ext4
nodev ramfs
nodev hugetlbfs
nodev ecryptfs
nodev fuse
fuseblk
nodev fusectl
nodev mqueue
nodev rpc_pipefs
nodev nfs
nodev nfs4
reiserfs
xfs
jfs
msdos
vfat
ntfs
minix
hfs
hfsplus
qnx4
ufs
btrfs
iso9660
options
选项 含义 defaults 使用默认设置。 等于rw,suid,dev,exec,auto,nouser,async, rw 挂载为读写权限 ro 以只读模式加载该文件系统 exec 是一个默认设置项,它使在那个分区中的可执行的二进制文件能够执行。 noexec 二进制文件不允许执行。 sync 不对该设备的写操作进行缓冲处理,这可以防止在非正常关机时情况下破坏文件系统,但是却降低了计算机速度 async 所有的I/O将以异步方式进行 user 允许普通用户加载该文件系统 nouser 只允许root用户挂载。这是默认设置。 quota 强制在该文件系统上进行磁盘定额限制 noauto 不再使用mount -a命令(例如系统启动时)加载该文件系统 noatime/nodiratime 禁止更新访问时间
dump
dump - 该选项被"dump"命令使用来检查一个文件系统应该以多快频率进行转储,若不需要转储就设置该字段为0
pass
该字段被fsck命令用来决定在启动时需要被扫描的文件系统的顺序,根文件系统"/"对应该字段的值应该为1,其他文件系统应该为2。若该文件系统无需在启动时扫描则设置该字段为0
noatime/nodiratime
/dev/sda2 /data ext3 defaults 0 2 /dev/sda2 /data ext3 defaults,noatime,nodiratime 0 2
mount -o remount /data mount -o noatime -o nodiratime -o remount /data
/etc/fstab btrfs 实例
neo@netkiller:~$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=d103e33f-7f9f-4911-918e-32eae42e229c / btrfs defaults,subvol=@ 0 1 # /home was on /dev/sda1 during installation UUID=d103e33f-7f9f-4911-918e-32eae42e229c /home btrfs defaults,subvol=@home 0 2 # /opt was on /dev/sda6 during installation UUID=63d0b776-3bbd-490f-8284-f148b255185e /opt btrfs noatime,nodiratime,noexec 0 2 # swap was on /dev/sda5 during installation UUID=ff8945bf-fa45-49e5-b3d2-bb833bc6dc9c none swap sw 0 0