Mount Partition On Startup
To automatically mount a partition on startup we need to add a line to the fstab file. But first we need the UUID of the partition.
To view all the block devices use the lsblk
command:
The partition I want to mount is nvme0n1p2, it has 460G, and because his last column does not contain a path, we know it’s not mounted.
We can check the UUID using the blkid
command with grep to show only the line that interests us:
Now, open (with root privileges) /etc/fstab
with your favorite text editor and add a line for the partition:
-
In the first column we specify the UUID.
-
In the second the path where we want to mount the partition.
-
In the third the file system type, ext4 in this case.
-
In the fourth some options, we can leave it at “defaults” if we don’t want anything special. All the options available can be viewed here.
-
The fifth column is used to make backups, with a 0 we disable it.
-
Finally, the last column determines the mount order. This is important. In my case I want to mount the partition to ‘/home/mateus/Games’, but this path is inside ‘/’, mounted by the third entry in fstab. To make the new partition mount after the root partition ‘/’, the value in this last column must be bigger. Thats why I put a 1 on the ‘/’ partition and a ‘2’ on the new one.
That’s it, next time you boot the computer, the new partition will be mounted automatically.