How to mount a windows partition on Linux automatically on each start up

Share this article

In Ubuntu (and other LiUbuntunux OS) , the external drives are mounted automatically but the Windows drives (NTFS partitions) are required to be mounted manually in each login. Though this mounting is just a click away, in some situation one requires the other partitions to be mounted automatically in each start up. In this tutorial I’ll try to explain the procedure to mount a Windows partition automatically on each start up. Again, the tutorial is performed on Ubuntu but most of the commands are applicable to other major Linux OS. Please follow these steps:

Step 1.

Check what is the name of the drive/partition you want to automatically mount. The name is like /dev/sda. Check the partition with NTFS format. Check the size and otherthing to select the partition you want to mount. Go to the terminal (Ctrl+Alt+T) and enter this command:

sudo fdisk -l

For me the command output looks like this:

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 102400 7 HPFS/NTFS
/dev/sda2 13 13417 107667456 7 HPFS/NTFS
/dev/sda3 13418 38914 204798797 f W95 Ext’d (LBA)
/dev/sda5 13418 26165 102398278+ 7 HPFS/NT

Step 2.

Now we need the UUID of the desired drive/partition. The UUID can be obtained by using the following command:

sudo blkid

The command output looks like this:

/dev/sda1: LABEL=”System Reserved” UUID=”E400CABD00CA95C8″ TYPE=”ntfs”
/dev/sda2: UUID=”E61CD55A1CD525F9″ TYPE=”ntfs”
/dev/sda5: UUID=”01CB76F7C2628FB0″ TYPE=”ntfs”
/dev/sda6: UUID=”01CB76F7F289ADE0″ TYPE=”ntfs”
/dev/sda7: UUID=”b9a176e1-d122-4ea7-815b-555063d

Step 3.

Now make a directory in Ubuntu where you want to mount the drive. Lets say you want to mount the Windows drive in root folder. We will create a directory name mount and under that a directory say WindowsDrive. For this use the command:

mkdir /mount/WindowsDrive

Step 4.

The mount information can then be added to fstab file which stores the information about the storage devices. In the terminal enter:

gksu gedit /etc/fstab

The command will open the fstab file. In here, at the end of the file add this line like this:

UUID=insert_the_UUID_here /mount/WindowsDrive ntfs defaults 0 0

Note: Replace the insert_the_UUID_here with UUID you noted from the blkid command. Save and exit. Now, in terminal enter:

sudo mount -a

Troubleshoot:

The following errors may be generated:

1.

“The file system wasn’t safely closed on Windows. Fixing.
fuse: failed to access mountpoint /mnt/win7: No such file or directory”

2.

“Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel’, but failed: Failed to create file ‘/root/.local/share/recently-used.xbel.CNQ0UV': No such file or directory”

The reason (in both cases) is that it is looking for the directory specified in the fstab file and cannot find it. Check the path and verify that the directory exists at the specified path. If the directory /root/.local/share doesn’t exist, make it manually.

Hope this article helped you. Suggestions, feedbacks and tiny thanks is always welcomed. Enjoy :)