Mount NTFS Partitions in Ubuntu Linux

Posted by VasiaUVI | Posted in , , | Posted on Thursday, January 21, 2010

Yes, I know, there are a lot of tutorials, sites, blogs that explains how to mount a NTFS or FAT32 partitions in Ubuntu and in the other Linux distributions, but mainly I want to write this tutorial (and many others) just to have on my blog and to use this information when I will need it.

I have to mention first that my system is a dual boot: WindowsXP and Ubuntu Karmic Koala. My Windows partitions are only NTFS and because I rarely use this Operating System I want to benefit the free space from this partitions. My intention is to mount them on boot and not to mount them manually from Nautilus or through Gnome-terminal and to be forced every time to enter root password.

I have also to mention that I don't guarantee that this tutorial will work for you and for your system and I am not responsible if something is going wrong. Before starting you should make a backup. If that is says I really have to make a backup too although I've changed the system files without doing this. Shame on me!

If you want to know where the NTFS partitions are we have to write in the terminal this code:
sudo fdisk -l

and you will have to enter the password.
The output is, for example my output:

vasia@vasia:~/Pictures/Blog$ sudo fdisk -l
[sudo] password for vasia:

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa8d32665

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5099    40957686    7  HPFS/NTFS
/dev/sda2            5100       19457   115330635    f  W95 Ext'd (LBA)
/dev/sda5            5100       11714    53126955    7  HPFS/NTFS
/dev/sda6           19307       19457     1212876   82  Linux swap / Solaris
/dev/sda7           16875       19306    19535008+  83  Linux
/dev/sda8           11714       16874    41455669+  83  Linux

Partition table entries are not in disk order

As you can see above my NTFS partition are on /dev/sda1 and /dev/sda5. The * from sda1 means that is a bootable partition.
Next we have to change the fstab file for having partitions mounted on boot. Like I've said before, is very good idea to make a backup, and we can also make a backup to our fstab file like this:

sudo cp /etc/fstab /etc/fstab_backup.old

Note: the extension of the file could be also .bk, or .old, or .txt, or .back etc(I really don't know if there are restrictions here).

If you read this how to I suppose that you don't have already a mount point for your NTFS partitions, then lets make one, or to in my case, because I have to partitions to mount. Also we will use the Terminal. Why? Because we need root privileges and have to put the password!

NOTE: if an experimented Linux user is reading this tutorial and sees that something is wrong, or something is not right in what I explain please tell me! You will help me and also those who read this. I have to say that, although I'm using Ubuntu for 2 years I think, I have a lot more to learn and put in practice. Thanks for your understanding!

Making two different folders in /media is not so difficult:

sudo mkdir /media/win /media/win1

After that we have to modify the fstab file like this:

sudo gedit /etc/fstab

and to add at the bottom of the file this two lines (like I said these is only for me):

dev/sda1 /media/win ntfs-3g defaults,nls=utf8,umask=007,gid=46 0 1
dev/sda5 /media/win1 ntfs-3g defaults,nls=utf8,umask=007,gid=46 0 1

After this steps you have to restart the system to see the effects.
Hope that is working great for you and that you didn't had any problems.

If by any way you don't trust what I'm saying please look on this tutorial from ArsGeek site or site where you can find out how to mount FAT32 partitions.