HowTo Debian/Ubuntu Linux Auto Mount Windows NTFS File System [ntfs-3g]

Posted on in Categories , , , last updated May 4, 2015

I‘m dual booting MS-Windows with a Debian / Ubuntu Linux desktop. How can I auto mount a drive containing a MS-Windows NTFS file system on a Linux based systems?

The New Technology File System (NTFS) is a file system developed by Microsoft in 1995 with Windows NT. You can easily auto mount a hard disk drive partition containing a NTFS using the following method on any modern Linux desktop.

Out sample setup

  1. /dev/sdb1 = NTFS partition (use fdisk -l command to find out NTFS partitions names)
  2. Linux user id = 1000 (vivek)
  3. Linux group id = 1000 (vivek)
  4. Linux mount point = /mnt/ntfs
  5. Required package : ntfs-3g (3rd generation read/write NTFS driver

A note about ntfs-3g

Type the following apt-get command to install the same:

sudo apt-get install ntfs-3g

Sample outputs:

Fig.01: Install the ntfs-3g package from the official repositories on a Debian/Ubuntu
Fig.01: Install the ntfs-3g package from the official repositories on a Debian/Ubuntu

Auto mounting a drive containing a Windows (NTFS) file system using /etc/fstab

The file /etc/fstab contains descriptive information about the various file systems. You need to edit this file and append the following information.

Step 1: Edit /etc/fstab

Open the terminal application and type the following command:

sudo vi /etc/fstab

Step 2: Append the following configuration

/dev/sdb1 /mnt/ntfs/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,ro 0 0

A note about the /dev/sdb1 device name

If /deb/sdb1 path will change due to system configuration, I recommend that you use the UUID (Universally Unique Identifier) of the partition. To find the UUID of /dev/sdb1, enter:

sudo blkid  /dev/sdb1

Note down the UUID value and update /etc/fstab as follows:

# syntax
# UUID="YOUR-UID-HERE" /mnt/ntfs/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,ro 0 0
UUID="c2dbc0c5-a8fc-439e-aa93-51b0a61372e8" /mnt/ntfs/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,ro 0 0

Save and close the file.

Step 3: Create the /mnt/ntfs/ directory

Type the following mkdir command:

sudo mkdir -p /mnt/ntfs/

Step 4: Test it

Type the following command:

sudo mount -a
df -h
cd /mnt/ntfs/
ls -l
cp -v "My File Name.Doc" $HOME

Step 5: Unmount NTFS partion

Type the following command:

sudo umount /mnt/ntfs
## OR ##
sudo umount /deb/sdb1

Optional: Manual mounting using ntfs-3g cli option

The syntax is as follows to mount /dev/sdb1 to /mnt/ntfs/:
sudo mkdir -p /mnt/ntfs
Mount it:

ntfs-3g /dev/sdb1 /mnt/ntfs

OR

mount -t ntfs-3g /dev/sdb1 /mnt/ntfs

You can mount the ntfs data partition /dev/sda3 to /mnt/data with standard Linux permissions applied :

ntfs-3g -o permissions /dev/sda3 /mnt/data

You can do read-only mount /dev/sda5 to /home/user/mnt and make user with uid 1000 to be the owner of all files:

ntfs-3g -o ro,uid=1000 /dev/sda5 /home/user/mnt
References

6 comment

  1. It’s worth noting that Windows sometimes makes a small partition at the beginning of the disk and you need to mount the second partition (e.g. /dev/sda2) instead of the usual first one.
    I had to figure this out when I was mounting remotely a usb hdd with gpt / ntfs on a debian server.

  2. On a System with often switching configurations it may be helpful to identify the partition by UUID.
    sudo blkid
    to get something like:
    /dev/disk/by-uuid/F656C6B256C67455.
    Then replace the /dev/sdb1 from above with /dev/disk/by-uuid/F656C6B256C67455.

  3. Hi nice article. It previous Ubuntu verions 9.04, 10.04 and 12.04 I used ntfs-config. Can this program be used in later Ubuntu versions, Zorin 9 and Mint 17.1? I can do work using the CLI but I prefer using a GUI application/program as much as possible. I usually only use the CLI as a last resort.

    An issue I have with most of the answers to queries on forums etc is that the answers given are almost always the CLI entries. It would be if the GUI route was also given.

    Regards
    Philip

  4. The “ro” option stands for read only? Is not possible to have a read write mounted NTFS partition?

    1. Hi Franco normally if you manually mount a NTFS partition it mounts as a read/write so you should also be able to do it automatically. The ntfs-config program automounted NTFS partitions as read/write. I am wondering why a person would want to mount a NTFS partition in read only mode in their home folder.

      Regards
      Philip

Leave a Comment