Auto Mount Drives in Linux

To automatically mount a drive in Linux, one has to edit the /etc/fstab file and store the credentials that are required for the drive to mount.

“fstab” is the “file systems table” file, where all available disks and disk partitions are listed and is used by the “mount” command to determine which options to use when mounting a specified device.

To mount the drives, firstly, we have to get the UUID of the drive that is to be mounted. UUID is the unique ID of a drive.

To get the UUID of a drive, we use the following.

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

Once you enter these command you will get a list of drives/partitions that are present in your computer.

For example :

lrwxrwxrwx 1 root root  10 Jan  5 19:33 34ebd182-b74c-4838-ab46-64c6f4141b54 -> ../../sda9
lrwxrwxrwx 1 root root  10 Jan  5 19:33 4BFD-8F38 -> ../../sda5
lrwxrwxrwx 1 root root  10 Jan  5 19:33 5004C62804C610C0 -> ../../sda6
lrwxrwxrwx 1 root root  10 Jan  5 19:33 FC5C0AC95C0A7F20 -> ../../sda1

Here, the numbers 34ebd182-b74c-4838-ab46-64c6f4141b54, 4BFD-8F38, FC5C0AC95C0A7F20 and 5004C62804C610C0 are the UUIDs of the different drives.

Create a folder to which you want to mount the drive. For example, I mounted the first drive, i.e. sda1 with UUID FC5C0AC95C0A7F20 to /media/C. So create a folder named “C” in /media

$ sudo mkdir /media/C

Now to mount the drive, open the /etc/fstab in your preferred editor like vim, kate, gedit, nano, etc as super user and add the following entry.

UUID=FC5C0AC95C0A7F20 /media/C  ntfs  defaults,umask=007,gid=46 0   0
The first column is the UUID that we got.

The second column is the folder to which we are to mount the drive.

The third entry is the file system of the drive which is "ntfs" for ntfs, "vfat" for fat file system, "ext4" for ext4 file systems, etc.

The fourth column are the mount options for the drive.

The fifth and sixth column are the dump and fsck options.

For more info on fstab, please visit

Now save the file and restart. The drive should automatically mount to /meda/C.



Add a Comment

Your email address will not be published. Required fields are marked *