~ /posts /articles /presentations /code /about

How to mount a drive on Linux

2026-03-07

This is a small blog post with how to set up a drive on Debian.

Find the drive / device location:

lsblk

Make drive point (it can be whatever, on my system I use /mnt):

cd /mnt
sudo mkdir data2

Mount the drive:

sudo mount /dev/sdb1 /mnt/data2

That's it, the drive is now available under /mnt/data2.

Automounting

To automount the drive after reboot, add it to the fstab table:

First, get the GUID:

$ sudo blkid
/dev/sdb1: LABEL="Data" UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Note the UUID variable. Add the line to /etc/fstab.

$ nano /etc/fstab

Add:

/dev/disk/by-uuid/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx /mnt/data2 auto nosuid,nodev,n>