顾名思议,这里指定了挂载文件系统所在的位置,这里有三种格式
1.形式如同/dev/sda0
2.procfs,直接写上proc
3.使用uuid或者是卷标
第二项是挂载目录,没什么好说的,对于交换分区,要设置成none.如果挂载路径包含空格用\040替换空格。
第三项是文件系统的类型,包含的格式比较多,有下面这些:
adfs, affs, autofs,
coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660,
jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs,
smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs
有些特殊选项值如下:
swap:交换分区
ignore:表示此行在mount和unmount时被忽略掉
none:这个参数意思不太明白,英文是An entry none is useful for bind or move mounts
第四项,是加载对应文件系统时的参数信息,这些信息可以通过man mount看到,一些参数如下
default:使用默认参数,rw,suid,dev,exec,auto,nouser,async
diratime:更新目录节点的访问时间,默认值
nodiratime:不更新目录节点的访问时间
dirsync:当creat,link, unlink, symlink, mkdir, rmdir, mknod and rename被调用时,文件系统内所有目录都同步更新
exec:允许文件系统中的二进制文件执行
noexec:不允许文件系统中的二进制文件执行
auto:当mount -a运行时,挂载此文件系统
noauto:当mount -a运行时,不挂载此文件系统
user:用户可以挂载此文件系统
owner:允许设备所有者挂载
group:同组者都可以挂载
encryption:使用加密选项
keybits:加密算法的key大小(位)
users:所有用户都可以挂载,但是依赖于noexec,nosuid,nodev
suid:set-user-identifier或set-group-identifier位有效
nosuid:set-user-identifier或set-group-identifier位无效
nofail:挂载失败时不报错
ro:以只读方式挂载
rw:以读写方式挂载
async:以异步方式挂载,动作不会立即执行
sync:以同步方式挂载,动作立即执行
第五项,设置是否备份,如果不用设置为0,dump命令会忽略此文件系统,一般也设置为0
第六项,系统启动时文件系统的检查顺序,根文件系统应该设置为1,其它的设置为2,如果无须检查就设置为0
例:
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
proc /proc proc defaults 0 0
UUID=d4e08832-a900-47a1-a963-13f185062c5e / ext4 errors=remount-ro 0 1
UUID=7682fddc-b848-42a3-8779-2a9dc9fd5245 none swap sw 0 0
根据以上知识,我开始修改我的fstab,首先手动挂载我的所有分区,登录到root权限,运行fdisk -l,以查看到分区所在地:
Device Boot Start End Blocks Id System
/dev/sda1 1 2638 21189703+ 7 HPFS/NTFS
/dev/sda2 2639 19457 135098617+ f W95 Ext'd (LBA)
/dev/sda5 * 2639 7100 35840983+ 7 HPFS/NTFS
/dev/sda6 * 7101 11434 34812823+ 7 HPFS/NTFS
/dev/sda7 * 11435 13984 20482843+ 83 Linux
/dev/sda8 * 13985 14624 5140768+ 82 Linux swap / Solaris
/dev/sda9 * 14625 19457 38821041 7 HPFS/NTFS
跟据分区大小等信息,我可以知道,/dev/sda1是我的C盘,/dev/sda5是我的D盘,/dev/sda6是我的E盘,/dev/sda9是我的F盘
现在修改fstab,增加如下记录:
/dev/sda1 /media/DISK_C ntfs exec,auto,user,rw,sync 0 0
/dev/sda5 /media/DISK_D ntfs exec,auto,user,rw,sync 0 0
/dev/sda6 /media/DISK_E ntfs exec,auto,user,rw,sync 0 0
/dev/sda9 /media/DISK_F ntfs exec,auto,user,rw,sync 0 0
重启一下,发现可以正常使用,但是卸载后,再次加载(使用的是菜单上的位置->分区,而非命令行)出现错误:
Error mounting: mount exited with exit code 1: helper failed with:
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://ntfs-3g.org/support.html#unprivileged
大概意思是非特权用户不能加载使用了额外FUSE库的NTFS文件系统,打开上面提供的网页,有这么一段:
Why don’t the ‘user’ and ‘users’ options work in /etc/fstab?
The ‘mount’ command doesn’t invoke the ntfs-3g binary with the needed privilege
after it has checked and approved the user is entitled to mount a given device
on a specified mount point, hereby the user can’t open the device he got the
approval in /etc/fstab. This is a problem in the ‘mount’ utility.
意思是当mount命令拥有权限挂载文件系统,当它调用ntfs-3g挂载时却并没有将这种特权传递给ntfs-3g,导致挂载错误。
再看了一下解决方法,比较麻烦,试了一下没有解决问题。
期待有人能解决,现在再次挂载要进入root权限,然后使用命令:ntfs-3g /dev/sda1 /media/DISK_C挂载,不过一般情况下不需要卸载,估且就这样吧。