Auto mount a Linux partition on boot

Step 1: 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

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 its 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.

Step 2: 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

Step 3: 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

Save and close the file. Then run the following command to see if it works.

sudo mount -a

Source: How To Automount File Systems on Linux – LinuxBabe