« JavaScript Validation for HTML Forms |
Creating Flash Video in Linux »
Mounting NTFS Partitions in Linux
Even if you use Linux as your primary operating system, you may still run into situations where you may need access to a partition that is formatted as NTFS.
My girlfriend uses a desktop system that I had loaded with three hard drives. Two of the drives are full partitions of the ext3 filesystem and one is NTFS. There is a good reason for this - she was used to using Windows XP and I wanted to gradually ween her off of it. It was easier to do this when Linux was already available on the system via a dual-boot. She has been on Linux for a good five or six months now (at home, work is a different story). She emailed me today asking me to see if I could get a particular file off of the computer that she had not accessed since she was using Windows XP. I was already on the system via SSH and knew that I could get the file without rebooting into Windows or even getting up to go into that room. All that I needed to install was an NTFS reading kernel module. In Fedora, I would type (as root):
[root@localhost ~]# yum install kmod-ntfs
Upon completion of the installation, I needed to determine which drive the NTFS partition was on:
[root@localhost ~]# fdisk -ul
Disk /dev/hda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders, total 39102336 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 63 208844 104391 83 Linux
/dev/hda2 208845 39102209 19446682+ 8e Linux LVM
Disk /dev/hdb: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders, total 78125000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 63 78124094 39062016 8e Linux LVM
Disk /dev/hdd: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders, total 78125000 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/hdd1 * 63 78108029 39053983+ 7 HPFS/NTFS
From the output, I could tell that /dev/hdd was my NTFS drive. To access the drive immediately I would need to mount it. I first create a directory as my mount point and then issue the mount command:
[root@localhost ~]# mkdir /media/drive_c
[root@localhost ~]# mount /dev/hdd1 \\
/media/c_drive -t ntfs -rw -o umask=0000
It is likely that she is going to want to access this drive again in the future, so I appended the following line to /etc/fstab to enable it each the system boots:
/dev/hdd1 /media/c_drive ntfs rw,defaults,umask=0000 0 0
The options I have used here allow for full read/write access to the drive, so if you intend to boot into Windows again, then be careful with what you delete from that partition - Linux will not warn you about removing critical system files from your Windows partition.
Topics: Linux
Share: del.icio.us | digg | reddit
No comments yet.