Thursday, March 13, 2008

NTFS Filesystem in Linux

My lab setup consists of several virtual machines and two physical systems, one running Linux and one running Windows XP. To distribute the load I need to shift these virtual machines from one system to another and I needed a common filesystem that can be natively accessed by both Windows and Linux. FAT filesystem is good for smaller and insecure filesystems, but its disadvantages far outweigh the benefits. Surprisingly, NTFS seems to be better bet for sharing filesystems across Linux and Windows. Here is a brief information on how to share NTFS filesystems in Linux

Download, compile and install NTFS driver and FUSE

There are quite a few NTFS drivers are available for Linux. But some of them offer only read capability. The best NTFS driver I found was ntfs-3g. It supports both NTFS read and write and worked flawlessly.

You can download and install NTFS-3g driver from here. The installation instructions are available at the website as well.

One quick note: ntfs-3g requires FUSE (File System in User Space). You will have to insert fuse module by running "/sbin/modprobe fuse" after the successful installation of fuse. (and everytime after boot! so better put it in a rc script).

Make entries in /etc/fstab.

I have an external USB NTFS hard drive and the /etc/fstab entry for that is given below.
/dev/sda1 /media/Vmware ntfs-3g silent,users,sync,umask=0,locale=en_US.utf8,no_def_opts,allow_other 0 0

Mount your NTFS filesystem

Now, you can mount the NTFS filesystem using mount command. If it is already mounted as read-only due to USB auto-detection, you can unmount and remount it. My mount shell script looks like below.

sudo umount /dev/sda2
sudo /sbin/modprobe fuse
sudo mount /dev/sda1

That is it. Hope you find this useful.

Performance
Overall, the ntfs-3g performance was excellent. I was able to share the NTFS hard drive using Samba. However under extremely heavy load, the NTFS driver eats lot of CPU and during these times performance was poor. Having said that, ntfs-3g should be able to meet your day-to-day NTFS needs in Linux without any problems.

No comments: