the /etc/fstab file is plain text and consist of lines with six fields
device mount point filesystem type mount_option dump frequency(清空频率) pass number for fsck
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
/dev/hdc5 /mnt/win_d vfat defaults,iocharset=gb2312, umask=0 0 0
/dev/hdc6 /mnt/win_e vfat defaults,iocharset=gb2312, umask=0 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
/dev/hdc7 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/sda1 /mnt/usb vfat users,dmask=000,fmask=0222,iocharset=cp936 0 0
the dump program, a standard linux backup utility. may consult /etc/fstab for information on how often to dump each filesystem.this field holds an integer,usually set to 1 for ext2 filesystem and to 0 for other.
pass number for fsck
this field is used by the fsck utility when the -A option is specified,usually at boot time,it is a flag that may contain only the value 0,1,2
0 instruct fsck not to check the filesystem
1 should be enterd for the root filesystem and instruct fsck to check that filesystem first
2 instruct fsck to check corresponding filesystem after those with a 1.
command-lines options
-a 挂载/etc/fstab中所有的分区,除了含有noauto选项
-h 显示挂载帮助
-o mount_options 在命令行说明挂载选项
-r 挂载文件系统为只读
-t fstype 指明挂载的文件系统类型,这个选项是一个交互式的使用,用在/etc/fstab文件中没有挂载的设备
-v 设置为详细模式
-w 挂载文件系统为读写模式
mount options
async 建立一个异步的输入输出模式,相反的是sync
auto 当系统重启或运行带-a命令行选项时,挂载文件系统,相反的是noauto
defautlts 通常用在ext2, ext3上,包含rw,suid,dev,exec,auto,nouser and sync. (utility)
dev 在文件系统上解释字符和块设备
exec 在已挂载分区中启用程序执行,相反的是noexec
noauto 禁止带-a选项的自动挂载
noexec 禁止可执行程序的执行,是一种潜在的安全衡量
nosuid 禁用suid,sgid在可执行程序上
nouser 禁用普通用户有挂载和卸载的权限
ro 等价于命令行选项的-r
rw 等价命令行选项的-w
suid 启用suid,sgid在可执行程序上
sync 建立一个同步的输入输出模式,
user 允许一个普通用户挂载文件系统,但不允许其它的普通用户卸载这个文件系统。
users 允许任一个用户挂载和卸载文件系统
filesystem types
ext2 msdos vfat iso9660 nfs swap proc
如果确定对该分区不需要写权限,那么可将命令修改为:
LABEL=/ / ext3 ro,suid,dev,exec,auto,nouser,asyc 1 1
如果更进一步决定不需要suid和exec支持,那么可将这两项删除
LABEL=/ / ext3 ro,nosuid,dev,noexec,auto,nouser,asyc 1 1
|