/etc/fstab详解
/etc/fstab
fsck、mount、umount的等命令都利用该程序。
/etc/fstab 是启动时的配置文件,实际 filesystem 的挂载是记录到 /etc/mtab 与 /proc/mounts
limit:
根目录 / 是必须挂载的﹐而且一定要先于其它 mount point 被挂载进来。
其它 mount point 必须为已创建的目录﹐可任意指定﹐但一定要遵守必须的系统目录架构原则
所有 mount point 在同一时间之内﹐只能挂载一次。
所有 partition 在同一时间之内﹐只能挂载一次。
如若进行卸除﹐您必须先将工作目录移到 mount point(及其子目录) 之外。
# /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).
#
/ was on /dev/sdb3 during installation
UUID=383dba93-95a2-4b34-9ebd-71d42e00a2b7 / ext4 errors=remount-ro 0 1
/dev/sda1 /opt ntfs users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
/dev/sda2 /data ntfs users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
/dev/sdb1 /win ntfs users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8,noatime 0 0
/dev/sdb2 /programe ntfs users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8,noatime 0 0
noatime 关闭atime特性,提高性能,这是一个很老的特性,放心关闭,还能减少loadcycle
defaults 使用默认设置。等于rw,suid,dev,exec,auto,nouser,async,具体含义看下面的解释。
自动与手动挂载:
auto 在启动或在终端中输入mount -a时自动挂载
noauto 设备(分区)只能手动挂载
读写权限:
ro 挂载为只读权限
rw 挂载为读写权限
可执行:
exec 是一个默认设置项,它使在那个分区中的可执行的二进制文件能够执行
noexec 二进制文件不允许执行。千万不要在你的root分区中用这个选项!!!
I/O同步:
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.
今天真冷,哈哈!