Auto mount Windows Drives (NTFS) in Ubuntu Linux

Submitted by Karthik on Mon, 04/05/2020 - 10:34

Many of us have a dual operating system installed in our PC. Windows uses NTFS file system while Linux uses EXT4 and other file systems. You can mount NTFS formatted drive in Linux, but you can't mount Linux based file systems in Windows. So, we have to store the files that need to be accessed in both Operating Systems in an NTFS formatted drive. Every time when we start Linux (Ubuntu - my favourite distribution), we have to Open File Explorer and go to Others to Mount Windows Drives. But, we can configure it to automount while booting.

Step 1: Know the partition name to be mounted

Use lsblk command to view the list of devices and partitions available.

lsblk

 

lsblk ubuntu

Also, you can use the file manager to get name of the partition.

Ubuntu file manager

Here, I wish to auto mount DEV drive into my Ubuntu OS on every boot.

So, the partition ID is /dev/sda4

Step 2: Create a mount point & Mount

Create a mount point (directory) where you want to mount the drive.

In my case, I want to mount on the default location where Ubuntu mounts.

Example: /dev/media/karthik/DEV

You can also mount directly to root or anywhere else. E.g. /dev

sudo mkdir /dev/media/karthik/DEV

Before running the above command unmount the devices if you already mounted.

Now mount the device.

sudo mount /dev/sda4 /dev/media/karthik/DEV

Step 3: Note UUID of the device & Update fstab file

Use the following command and note the UUID of the device you want to mount

ls -al /dev/disk/by-uuid/

Create entry in fstab file.

For safety reasons, backup fstab file.

sudo cp /etc/fstab /etc/fstab.backup

Now edit the fstab file and add the line

sudo gedit /etc/fstab

# Mount dev
UUID=7EEEC63DEEC5ED89 /media/karthik/DEV ntfs   0       2

Now unmount the drive if you already mounted, then run the below command to check whether the entry in fstab works correctly. If the below command provides an error, correct the entry or restore the original file before rebooting the system. If you have incorrect entries in fstab file, then you can't reboot into the OS.

Mounts all drives/disks.

sudo mount -a

If the above command does not provide any errors, you are done. Now you can reboot the system and check automount works. 

Category