Published

Linux

Mount a Drive Permanently on Linux (fstab)

Mount a second disk so it's there every time Linux boots, using its UUID in /etc/fstab.

1. Find the disk and its UUID

lsblk -f

2. Make a mount point

sudo mkdir -p /mnt/data

3. Add it to fstab

Use the UUID, not /dev/sdb1 (device names can change). nofail lets the system boot if the disk is missing.

UUID=1234-ABCD  /mnt/data  ext4  defaults,nofail  0  2

4. Test before you reboot

If mount -a errors, fix the line: a bad fstab can stop the system from booting.

sudo systemctl daemon-reload && sudo mount -a

FAQ

What filesystem type do I put?

The TYPE shown by lsblk -f, for example ext4, xfs, btrfs or ntfs3.

What does nofail do?

It lets the system finish booting even if that disk isn't connected.