Ubuntu insights, Programming in groovy, java, et als!

Saturday, November 05, 2011

Automount NTFS drives on Ubuntu

Well, here's for the lazy ones out there. I came across this simple tweak to fix the problem of manually mounting disks (either external/NTFS) on Linux.

If you have frequently accessed files placed on several drives or partitions that are external to Linux, you need to manually mount these partitions manually from Nautilus or terminal prior to accessing files/directories in them. To avoid this, you can change the contents etc/fstab file in such a way that they are auto mounted on startup.

Prior to editing the fstab content, you need to know the partition label of your drive. Partition labeling (alphabets followed by a number) is quite different in Linux when compared to Windows. Your NTFS partition might look something like sda2 or sda3.

For the geek

Step 1: Running the

fdisk -l

command will give you details of all the partitions like the one shown above.

Step 2: If you fail to decipher anything out of the above output, Just run the below command against the device names whose System column of the above output contains NTFS in it.

fdisk -s /dev/sda6

Running the above command will give you the size of the partition sda6 in bytes which gives you a better chance of identifying the drive (presuming that you might at least know the approx size of the NTFS drive you want to mount).

Step 3: Run the below command below 

sudo mkdir /media/Windows
sudo echo "/dev/sda6 /media/Name_of_Your_Partition ntfs-3g defaults,locale=utf8 0 0" >> /etc/fstab
sudo mount -a

which will add up the details of your partition to etc/fstab.

For the noob

1) Install mount manager via Ubuntu software center, open the app and identify the partition label of the drive to be mounted based on the disk size and partition details shown in it.

2) Hit Alt+F2 and type in
    gksudo nautilus

3) Open the file named fstab under etc folder of file system.

4) Add the below line to the file and save. 

/dev/sda6 /media/Name_of_Your_Partition ntfs-3g defaults,locale=utf8 0 0

Note: Replace sda6 by your partition label and Name_of_Your_Partition should be the name of your NTFS drive. 


blackscribe said...

Thanks, this help me loads!

Post a Comment