買了個1T的硬碟,因為要和WINDOWS交換,所以只能用NTFS格式。
安裝hal和dbus就不說了。
一、安裝軟體
# emerge ntfs-3g
二、配置,並編譯核心
# cd /usr/src/linux
# make menuconfig
勾選 File systems ---> <M> 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
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.
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,自動掛載。