Tuesday, March 13, 2012

Automount NTFS partition using Ubuntu 11.10

To automount an NTFS partiton, add the following to /etc/fstab:
15 UUID=58C7049A417B945D /media/media ntfs rw,auto,users,exec,nl=utf8,umask=003,gd=46,uid=1000 0 2

Substituting your partition's UUID and mount point (I chose /media/media). To find your partiton's UUID, run sudo blkid


Then, test with:
mount /media/media
This yields an error:
mozach@dm4:~$ mount /media/media
Mount is denied because setuid and setgid root ntfs-3g is insecure with the
external FUSE library. Either remove the setuid/setgid bit from the binary
or rebuild NTFS-3G with integrated FUSE support and make it setuid root.
Please see more information at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged


To fix this we must recompile ntfs-3g to include FUSE support.
Download ntfs-3g source:
zach@dm4:~/ntfs$ wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2012.1.15.tgz
Decompress:
zach@dm4:~/ntfs$ tar -xvzf ntfs-3g_ntfsprogs-2012.1.15.tgz
Configure (including internal FUSE support):
zach@dm4:~/ntfs/ntfs-3g_ntfsprogs-2012.1.15$ ./configure --with-fuse=internal
Compile:
zach@dm4:~/ntfs/ntfs-3g_ntfsprogs-2012.1.15$ make
Install:
zach@dm4:~/ntfs/ntfs-3g_ntfsprogs-2012.1.15$ sudo make install

Reboot and /media/media should be mounted automatically.