Thursday, January 15, 2009

Writing to NTFS

n July 14th, Szakacsits Szabolcs, a developer for the Linux-NTFS project published a major update of the Linux NTFS driver. It is now possible to write to an NTFS partition in a safe manner.

I've tested it for months now and I have yet to report any issue. In fact, I have had more troubles with the old NTFS driver which allowed read-only operations on NTFS partitions. On February 21th, 2007, the first stable release of NTFS-3G was released as version 1.0.

So here we go...

* Installation


On Debian Etch


First, download NTFS-3g. 2 packages are needed here: ntfs-3g and libntfs-3g. You can use wget to download them:

wget http://snapshot.debian.net/archive/2007/03/01/debian/pool/main/n/ntfs-3g/libntfs-3g0_0.0.0+20061031-6_i386.deb
wget http://snapshot.debian.net/archive/2007/03/01/debian/pool/main/n/ntfs-3g/ntfs-3g_0.0.0+20061031-6_i386.deb



Then install the dependencies:

sudo apt-get install fuse-utils libfuse2



Finally you can install ntfs-3g (using the 2 Debian packages you just downloaded):

sudo dpkg -i libntfs-3g0_0.0.0+20061031-6_i386.deb
sudo dpkg -i ntfs-3g_0.0.0+20061031-6_i386.deb





On Debian Sid, Ubuntu Edgy or Ubuntu Feisty


No need to download anything, nor to install any dependencies. Simply typing:

sudo apt-get install ntfs-3g



will do the trick.


* Mounting partitions



Mounting partition is done quite simply. For example, this command (one line):

sudo mount -t ntfs-3g /dev/sda1 /mnt/windows -o umask=0,nls=utf8



will mount a partition (/dev/sda1 in that case, replace with your actual windows partition) on the /mnt/windows directory (which must exist and be empty), using the utf8 character set (for maximum compatibility with foreign languages) and giving read/write/execute permissions to everyone.

Once you have established that this command work fine on your system, you can add an entry for it in /etc/fstab:

/dev/sda1 /mnt/windows ntfs-3g umask=0,nls=utf8 0 0



If you wish, you can unmount that partition in the standard way:

sudo umount /dev/sda1