买了个1T的硬盘,因为要和WINDOWS交换,所以只能用NTFS格式。
安装hal和dbus就不说了。
一、安装软件
# emerge ntfs-3g
二、配置,并编译内核
# cd /usr/src/linux
# make menuconfig
勾选 File systems ---> Filesystem in Userspace support
# make clean && make && modules_install
三、加载内核模块
# modprobe fuse
当然可以再打开 /etc/modules.autoload.d/kernel-2.6,把fuse加进去。
四、手动mount NTFS分区的命令
然后就可以mount ntfs分区了:
#mount -t ntfs-3g -o locale=zh_CN.UTF-8,silent /dev/sdc1 /mnt/usb
五、配置/etc/fstab
在/etc/fstab中加上以下行
/dev/sdc1 /home/crob/1TDisk ntfs-3g auto,user,rw,locale=zh_CN.UTF -8,silent 0 0
六、非root用户不能自动mount,提示示“only root can do this”的解决方法
fstab中的user选项在ntfs3g上不管用,查了ntfs-3g官网后发现以下回答:
http://ntfs-3g.org/support.html#useroption2
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.
Solution: Use at least NTFS-3G 1.2506 with setuid-root set and make sure the user has access rights to the volume and mount point.
emerge ntfs3g加上了suid参数后,还是不能自动mount,会报无权限。
做了以下动作,使普通用户有mount和unmount权限
建立mount用户组编辑/etc/group,添加如下内容:
mount:*:1000:username1,username2
dotc crob # chmod 4710 /bin/mount
dotc crob # chown root:mount /bin/mount
dotc crob # chmod 4710 /bin/umount
dotc crob # chown root:mount /bin/umount
至此,一切搞定,插入USB,自动挂载。