How To Automount File Systems on Linux

Today I’m going to show you how automount a drive in Linux. My laptop have one SSD and one mechanical drive. I install operating systems on SSD and store files on mechanical drive. So often times I need to mount the mechanical drive in file manager manually to access my mp3 and video files. Mounting drive manually is just a waste of time. So I’m going to show you an easy way to automount drive in Linux.

Step1 Get the Name, UUID and File System Type

Open your terminal, run the following command to see the name of your drive, its UUID(Universal Unique Identifier) and file system type.

sudo blkid

sudo blkid command

In the output of this command, the first column is the name of your drives. The second column is the label of the drive (if you set a label for it) and the third column is the UUID of your drives.

First you need to know the name of the drive that is going to be automatically mounted. For example, the name of the drive that is going to be automatically mounted on my computer is /dev/sdb9.

Then you need to know it’s UUID and file system type. As you can see the UUID of /dev/sdb9 is eb67c479-962f-4bcc-b3fe-cefaf908f01e and the file system of /dev/sdb9 is ext4 which is the standard file system in Linux.

Step2 Make a Mount Point For Your Drive

We are going to make a mount point under /mnt directory. Enter the following command,

sudo mkdir /mnt/<name-of-the-drive>

For example, I issued the following command:

sudo mkdir /mnt/sdb9

Step3 Edit /etc/fstab File

Run the following command to edit the /etc/fstab file. nano is a command line editor on Linux.

sudo nano /etc/fstab

We need to append one line of code at the end of the file. The format of this line of code is as follows:

UUID=<uuid-of-your-drive> <mount-point> <file-system-type> <mount-option> <dump> <pass>

Note that you need to separate these items with Tab key. For example, I added the following line to the end of /etc/fstab.

UUID=eb67c479-962f-4bcc-b3fe-cefaf908f01e /mnt/sdb9 ext4 defaults 0 2

/etc/fstab automount

If you want to automount a NTFS file system, here is an example.

UUID=<uuid-of-ntfs-file-system>  /mnt/ntfs  ntfs  defaults 0 2

Save and close the file. Then reboot your system to see the if it works. So that’s how you automount a file system in Linux.

Some Explanation

For swap partitions, the mount point field should be specified as none.

The defaults mount option will give users read and write access to the file system.

The value of dump field is usually zero.

The pass field is used by the fsck program to determine the order in which filesystem checks are done at reboot time. As you can see in this file, the value of the pass field for the root file system is 1. Swap partitions do not need to be checked and the value for them is zero. All other file systems should have a value of 2. So I set the pass value as 2 for my drive.

Rate this tutorial
[Total: 2 Average: 5]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • If you ask me more than 5 questions, I expect you to make a donation, or I would stop answering your questions.