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

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.[donotprint]
Tutorial details
DifficultyEasy (rss)
Root privilegesYes
Requirementsntfs-3g
Time5m
[/donotprint]

ADVERTISEMENTS

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
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
7 comments… add one
  • mica May 3, 2015 @ 22:37

    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.

  • Xylol May 4, 2015 @ 5:31

    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.

    • 🐧 Vivek Gite May 4, 2015 @ 6:18

      The faq has been updated. I appreciate your feedback.

  • Philip Gray May 4, 2015 @ 15:47

    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

  • Franco May 4, 2015 @ 17:39

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

    • Philip Gray May 5, 2015 @ 15:37

      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

  • Vince Sep 5, 2020 @ 3:40

    The ro and umask-0222 both caught my attention. If I’m not mistaken, that would result in a read-only mount where all the directories and files have read and execute bits set, but not write. I’m not sure why you’d want that.
    After reading the fstab and mount pages carefully, here’s what I used and it works great:

    UUID=2EE63C53E63C1E11 /mnt/windows ntfs defaults,uid=0,gid=0,umask=0000

    Note that I didn’t specify the last two fields. They have reasonable defaults.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.