Mounting NTFS partitions as read-write on Ubuntu Linux

By default when you install ubuntu server and try to mount an ntfs file system you will only be able to mount it as a read only file system.

For example - I have attached a hard disk with a standard windows installation on device 1 (sdb) on my computer.

root@server:/dev$ ls
block            disk      input  loop3   mem                 pktcdvd  ram1   ram2  ram9    sda2  shm       tty    tty14  tty20  tty27  tty33  tty4   tty46  tty52  tty59  tty8     usbdev1.1_ep00  vcs1  vcsa1     zero
bus              ecryptfs  kmem   loop4   net                 port     ram10  ram3  random  sda5  snapshot  tty0   tty15  tty21  tty28  tty34  tty40  tty47  tty53  tty6   tty9     usbdev1.1_ep81  vcs2  vcsa2
cdrom            fd        kmsg   loop5   network_latency     ppp      ram11  ram4  rtc     sdb   sndstat   tty1   tty16  tty22  tty29  tty35  tty41  tty48  tty54  tty60  ttyS0    usbdev1.2_ep00  vcs3  vcsa3
char             full      log    loop6   network_throughput  psaux    ram12  ram5  rtc0    sdb1  sr0       tty10  tty17  tty23  tty3   tty36  tty42  tty49  tty55  tty61  ttyS1    usbdev1.2_ep81  vcs4  vcsa4
console          fuse      loop0  loop7   null                ptmx     ram13  ram6  scd0    sg0   stderr    tty11  tty18  tty24  tty30  tty37  tty43  tty5   tty56  tty62  ttyS2    usbmon0         vcs5  vcsa5
core             hpet      loop1  lp0     oldmem              pts      ram14  ram7  sda     sg1   stdin     tty12  tty19  tty25  tty31  tty38  tty44  tty50  tty57  tty63  ttyS3    usbmon1         vcs6  vcsa6
cpu_dma_latency  initctl   loop2  mapper  parport0            ram0     ram15  ram8  sda1    sg2   stdout    tty13  tty2   tty26  tty32  tty39  tty45  tty51  tty58  tty7   urandom  vcs             vcsa  xconsole
root@server:/dev$ mount
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
securityfs on /sys/kernel/security type securityfs (rw)

root@server:~# mkdir /mnt/ntfs
root@server:~# mount /dev/sdb1 /mnt/ntfs/
root@server:~# cd /mnt/ntfs
root@server:/mnt/ntfs# ls
AUTOEXEC.BAT  boot.ini  CONFIG.SYS  Documents and Settings  hiberfil.sys  IO.SYS  MSDOS.SYS  NTDETECT.COM  ntldr  pagefile.sys  Program Files  RECYCLER  sysprep_dat  System Volume Information  WINDOWS
root@server:/mnt/ntfs# touch hello.txt
touch: cannot touch `hello.txt': Read-only file system

To fix this problem all you have to do is install the ntfs-3g drivers on your machine - on ubuntu you can do that by using apt-get install - after that your file system mounts as read-write.

root@server:/mnt# sudo apt-get install ntfs-3g
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  fuse-utils libfuse2 libntfs-3g49
The following NEW packages will be installed:
...
root@server:/mnt# mount /dev/sdb1 /mnt/ntfs/
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
root@server:/mnt# cd /mnt/ntfs
root@server:/mnt/ntfs# ls
AUTOEXEC.BAT  boot.ini  CONFIG.SYS  Documents and Settings  hiberfil.sys  IO.SYS  MSDOS.SYS  NTDETECT.COM  ntldr  pagefile.sys  Program Files  RECYCLER  sysprep_dat  System Volume Information  WINDOWS
root@server:/mnt/ntfs# touch hello.txt
root@server:/mnt/ntfs# vim hello.txt
root@server:/mnt/ntfs# exit