Automounting a NTFS partition or drive when Linux boots

So you have a NTFS partition on your hard drive, or perhaps a separate NTFS hard drive or even an external USB NTFS hard drive? And you want to mount the NTFS partition or NTFS drive automatically when Linux boots? In this post I explain how to do this, and also take into account removable drives.

Open a Terminal window, enter the command su and login as the root user:

$ su
Password: <--- type the root user's password here and hit Enter
#

Then use the blkid command to see what device your NTFS drive is seen as:

# blkid
/dev/sda1: LABEL="PQSERVICE" UUID="0E4E-05CE" TYPE="vfat"
/dev/sda2: LABEL="ACER" UUID="320D-180E" TYPE="vfat"
/dev/sda3: UUID="6922fb8c-6ba1-4657-97a9-a640eb8e6537" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda5: UUID="e19b8c79-b65e-46bf-9273-abd228d7eec2" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda6: UUID="2322ac6a-3f45-451a-a57a-a88f63d41e8b" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda7: TYPE="swap" UUID="f6c9d273-f339-4d21-be63-ca64bcb88534"
/dev/sdb1: UUID="9884B0A684B08870" LABEL="SEA_DISC" TYPE="ntfs"
/dev/sdc1: UUID="E8E8ED01E8ECCEBE" LABEL="IOMEGA_HDD" TYPE="ntfs"
/dev/sdd1: LABEL="IHP100" UUID="1B05-1B41" TYPE="vfat"

Notice that my two NTFS drives SEA_DISC and IOMEGA_HDD are devices /dev/sdb1 and /dev/sdc1 respectively.

Let’s say that I want my NTFS drive SEA_DISC (/dev/sdb1) to be mounted automatically upon boot. Type the following commands into your open Terminal window (substituting, of course, the drive label for yours):

# mkdir /media/SEA_DISC  <--- This creates a mount point called "SEA_DISC" for your drive.
# locale -a  <--- This lists the locales (countries and languages) currently configured on your PC
# nano /etc/fstab  <--- This runs the text editor Nano to open the fstab file

(Nano is an easy-to-use text editor that does not need a GUI to run. You’ll see the commands it accepts listed along the bottom of the Terminal window.)

So I would add the following line to the end of my fstab file:

/dev/sdb1 /media/SEA_DISC ntfs-3g defaults 0 0

If you use a language that uses diacritics — let’s assume you use French, for the sake of argument — and you have that locale configured on your PC (as shown above, enter the command locale -a to find out what locales are configured on your PC), then you’ll want to be able to save file names with diacritics. In that case, you can add the locale to the new fstab command like so:

/dev/sdb1 /media/SEA_DISC ntfs-3g defaults,locale=fr_FR.utf-8 0 0

(If the output of the locale -a command earlier was fr_FR.UTF-8 then I would type fr_FR.UTF-8, but if it was fr_FR.utf-8 then I would type fr_FR.utf-8)

Reboot and you’ll find that your NTFS drive is automatically mounted.

Now, notice something called a ‘UUID’ in the output from the blkid command I posted above. UUID stands for ‘Universally Unique Identifier’. If your NTFS drives are external and connected via USB, and you sometimes plug USB pen drives or other hard drives into your PC, you may find (just like under Windows) that your NTFS drive is no longer seen as the same device (e.g. in my case no longer /dev/sdb1). However the UUID should stay the same. So I could refer to the drive by its UUID instead in my fstab file, like so:

UUID=9884B0A684B08870 /media/SEA_DISC ntfs-3g defaults 0 0

or, e.g.

UUID=9884B0A684B08870 /media/SEA_DISC ntfs-3g defaults,locale=fr_FR.utf-8 0 0

To summarise, here’s what my original /etc/fstab file looked like:

UUID=2322ac6a-3f45-451a-a57a-a88f63d41e8b /                       ext3    user_xattr,commit=60,noatime,nodiratime      1 1
UUID=e19b8c79-b65e-46bf-9273-abd228d7eec2 /home                   ext3    user_xattr,commit=60,noatime,nodiratime      1 2
UUID=6922fb8c-6ba1-4657-97a9-a640eb8e6537 /boot                   ext3    user_xattr,commit=60,noatime,nodiratime      1 2
/dev/shm                                  /dev/shm                tmpfs   defaults                                     0 0
UUID=f6c9d273-f339-4d21-be63-ca64bcb88534 swap                    swap    defaults                                     0 0

and here’s what it would look like after my edit (this time with the locale en_GB.utf-8 as an example):

UUID=2322ac6a-3f45-451a-a57a-a88f63d41e8b /                       ext3    user_xattr,commit=60,noatime,nodiratime      1 1
UUID=e19b8c79-b65e-46bf-9273-abd228d7eec2 /home                   ext3    user_xattr,commit=60,noatime,nodiratime      1 2
UUID=6922fb8c-6ba1-4657-97a9-a640eb8e6537 /boot                   ext3    user_xattr,commit=60,noatime,nodiratime      1 2
/dev/shm                                  /dev/shm                tmpfs   defaults                                     0 0
UUID=f6c9d273-f339-4d21-be63-ca64bcb88534 swap                    swap    defaults                                     0 0
UUID=9884B0A684B08870                     /media/SEA_DISC         ntfs-3g defaults,locale=en_GB.utf-8                  0 0

Here’s a good, easy-to-understand guide to fstab: How to edit and understand /etc/fstab.

Follow

Get every new post delivered to your Inbox.

Join 43 other followers