fstab文件包含了你的电脑上的存储设备及其文件系统的信息。它是决定一个硬盘(分区)被怎样使用或者说整合到整个系统中的文件。具体来说:用fstab可以自动挂载各种文件系统格式的硬盘、分区、可移动设备和远程设备等。对于Windows与Linux双操作系统用户,用fstab挂载FAT格式和NTFS格式的分区,可以在Linux中共享windows系统下的资源。
这个文件的全路径是/etc/fstab。它只是一个文本文件,你能够用你喜欢的编辑器打开它,但是必须是root用户才能编辑它。同时fsck、mount、umount的等命令都利用该程序。
/etc/fstab 是启动时的配置文件,不过,实际 filesystem 的挂载是记录到 /etc/mtab 与 /proc/mounts 这两个文件当中的。每次我们在更动 filesystem 的挂载时,也会同时更动这两个文件喔!
示例:
## NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. /dev/sda10 /boot ext4 noauto,noatime 1 2 /dev/sda6 / ext4 noatime 0 1 /dev/sda9 none swap sw 0 0 /dev/cdrom /mnt/cdrom auto noauto,ro 0 0
其实 /etc/fstab (filesystem table) 就是将我们利用 mount 命令进行挂载时, 将所有的选项与参数写入到这个文件中就是了。除此之外, /etc/fstab 还加入了 dump 这个备份用命令的支持! 与启动时是否进行文件系统检验 fsck 等命令有关。
noatime
关闭atime特性,提高性能,这是一个很老的特性,放心关闭,还能减少loadcycledefaults
使用默认设置。等于rw,suid,dev,exec,auto,nouser,async,具体含义看下面的解释。auto
在启动或在终端中输入mount -a时自动挂载noauto
设备(分区)只能手动挂载ro
挂载为只读权限rw
挂载为读写权限exec
是一个默认设置项,它使在那个分区中的可执行的二进制文件能够执行noexec
二进制文件不允许执行。千万不要在你的root分区中用这个选项!!!sync
所有的I/O将以同步方式进行async
所有的I/O将以非同步方式进行user
允许任何用户挂载设备。 Implies noexec,nosuid,nodev unless overridden.nouser
只允许root用户挂载。这是默认设置。suid
Permit the operation of suid, and sgid bits. They are mostly used to allow users on a computer system to execute binary executables with temporarily elevated privileges in order to perform a specific task.nosuid
Blocks the operation of suid, and sgid bits.重启系统,或在终端中输入mount -a
就可以看到修改后的效果了。