Mounting Windows (NTFS) Drives In Linux (Ubuntu)
0 Comments Published January 4th, 2007 in Linux, SoftwareMy tower has two hard drives in it, one SATA and one (parallel) ATA. I didn’t have anything too important on the ATA drive, but I thought it would be nice to be able to access some of the data. Unfortunately, it was formatted as two separate NTFS partitions, which are not typically “Linux-friendly.” I had to do a bit of research to figure out how to access these partitions from Linux.
Most of my Linux experience is limited to development, so I was unfamiliar with the need to use “mount” to, well, mount the drive. Basically, the idea is that you mount a drive to a directory and then you can access the files on it at that directory. The windows equivalent might be if you had a floppy drive (ancient technology, right?) and rather than accessing it at “A:\” you would mount it to a folder, perhaps “C:\mount\floppy” or something similar. The file system in Linux is obviously different (and far better), but the concept is relatively parallel.
Anyway, I tried to mount the drive and found out I couldn’t as a user, so I used sudo (sudo allows you to run a command as the “super user”). Unfortunately, “sudo mount -L WD-120-P1 /home/ian/p1” only partly worked. The mount was controlled by “root” (the “super user”), so I couldn’t do anything as a regular user. When I tried to change the file permission, I received this message: “chmod: changing permissions of `p1′: Read-only file system” and it wasn’t entirely helpful.
A bit of Google diving and I found bits and pieces that eventually led to the answer. First, use “sudo fdisk -l” to find out which drive you want. It should be the one (or ones) that is “HPFS/NTFS.” Then, use your favorite editor as the super user (I’ll give directions for vim) to edit “/etc/fstab” (e.g., “sudo vim /etc/fstab“). In vim, you can CTRL+F to jump forward, hit “o” to start inserting on a new line, then add:
/dev/hda5 /media/hda5 ntfs ro,users,noauto,uid=1000,gid=1000 0 0
Replace “hda5″ with the correct drive. This sets the drive to be mounted at “/media/hda5″ and tells Linux it uses NTFS and is read-only. It also lets users mount the drive. “noauto” means that the drive will not mount automatically (you can change that if you’d like). To exit vim, press escape and then type “:wq” and press enter. You should also create the directory that the drive will be mounted to (e.g., “sudo mkdir /media/hda5“).
To actually mount the drive, just run “mount /media/hda5” (or wherever the location it should be mounted is). You don’t have to use sudo, and you’ll be able to access the files as your actual user.


0 Responses to “Mounting Windows (NTFS) Drives In Linux (Ubuntu)”
Please Wait
Leave a Reply