Search This Blog

Monday, November 16, 2009

How to mount NTFS partition in Linux

Well, these days, NTFS partitions do get auto-mounted. But it may get a little irritating when you are asked for the admin password every time you boot your comp and click on the partition.

So, to make the mounting "truly" automated, you have to add an entry to the file /etc/fstab.

In my case, I had to add
/dev/sda3  /media/cdrive  ntfs-3g defaults

So, the first thing you have to do is - create a directory /media/cdrive. Then, to find out which device your ntfs partition is listed as, run

# fdisk -l
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x01238b30

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          26      208813+  83  Linux
/dev/sda3           29447       38913    76043677+   7  HPFS/NTFS
/dev/sda4              27       22978   184361940    f  W95 Ext'd (LBA)
/dev/sda5              27       20914   167782828+  83  Linux
/dev/sda6           20915       22873    15735636   83  Linux
/dev/sda7           22874       22978      843381   82  Linux swap / Solaris

From what I can see, my NTFS partition is /dev/sda3. This is how my /etc/fstab looks after making the entry.

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda6 during installation
UUID=295dd122-7bd3-49e3-8e94-e192bd48e741 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=31640fe8-bd0a-409f-b09e-f340e31b87ce /boot           ext4    defaults        0       2
# /home was on /dev/sda5 during installation
UUID=88e313d9-2537-466d-9856-4ae03bf75f81 /home           ext4    defaults        0       2
# /media/cdrive was on /dev/sda3 during installation
UUID=286841F96841C672 /media/cdrive   ntfs    defaults,umask=007,gid=46 0       0
# swap was on /dev/sda7 during installation
UUID=872f1854-af38-48ee-807d-b46ec1db6a75 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/sda3 /media/cdrive ntfs-3g defaults



--------------------------------------------
Reboot. You'll find your partition mounted :)

No comments: