Mounting NTFS partitions in Linux
For most of the newer Linux distributions this isn't an issue anymore, the mounting is done automatically and most users don't know what's happening behind the scenes. However I'm providing this guide for two purposes: Firstly, for that occasional time that you encounter a distribution that doesn't automount your NTFS partitions and as a general learning tutorial. This tutorial will cover mounting your partitions both with and without write support.
So let's jump right in, this might seem a long and tedious process but once you're used to it you'll see it's really fast and it's useful to know. We'll start off by listing your drives and the associated partitions. Do the following as root:
fdisk -l
This should output something similar to the following.
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 4080 32772568+ 7 HPFS/NTFS
/dev/sda2 4081 5394 10554705 83 Linux
/dev/sda3 6709 14593 63336262+ 83 Linux
/dev/sda4 5395 6708 10554705 83 Linux
Partition table entries are not in disk order
Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 66 530113+ 82 Linux swap / Solaris
/dev/sdb2 67 3349 26370697+ 83 Linux
/dev/sdb3 3350 14593 90317430 83 Linux
So now we can clearly see which partitions are on which drives. The only NTFS drive I have is on my very first partition on my primary SATA drive, hence /dev/sda1. There are two ways to mount this normally. We'll cover both.
The first way is to mount your partition from the command line interface (CLI). This has to be done as root and is as simple as the following line:
mkdir /mnt/ntfs
mount -t ntfs /dev/sda1 /mnt/ntfs
The above lines are pretty much self-explanitory, the first line creates a directory within /mnt called ntfs. The second line mounts your partition on /dev/sda1, the -t option specifies what kind of filesystem it uses and the very last part tells it to mount it on /mnt/ntfs. To test this you can do a quick check.
ls /mnt/ntfs
This should output your Windows directory.
Next, we're going to have Linux automount this partition every time on bootup. For this to work fluently I'd recommend unmounting your NTFS partition first by doing the following:
umount /dev/sda1
Now we're going to do a little bit of file manipulation, so that at every bootup your Linux system will read that file and read your line which tells it to mount your NTFS partition. I'm going to use the nano CLI text editor in my examples, feel free to use others such as kate, gedit etc.
nano /etc/fstab
Then add the following line below your very last line in the file. Then in the next line we mount everything in /etc/fstab.
/dev/sda1 /mnt/ntfs ntfs defaults,umask=0 0 0
mount -a
And that's it, now you have your NTFS partition mounted and it will automount it every time you reboot. Remember that your partition table layout will most likely differ from mine and thus it might be that you have IDE drives. In which case your partition will look something like /dev/hda1 (note that the 'a' and the '1' might vary). This is dependant on which physical drive from a-z and which partition it is 1,2,3 etc.
Mounting NTFS with write support
The steps are pretty similar to mount your drive with write support, however you will need two packages. Depending on your distribution you can probably download it via the repositories or get the ntfs-3g and FUSE sources or binaries.
I'm not going to cover the installation of sources or binaries in this section. So I assume you either know how to do that or that you you have gotten the necessary packages via your distribution's repositories. Mounting will be as simple as this.
mount -t ntfs-3g /dev/sda1 /mnt/ntfs -o defaults,umask=0
nano /etc/fstab
/dev/sda1 /mnt/ntfs ntfs-3g defaults,umask=0 0 0
The first line mounts it via the CLI and the last two lines open your /etc/fstab and the line looks very similar to mounting NTFS without write support. With the exeption of ntfs-3g which replaces the standard ntfs driver.
