Mounting Disks — mount and /etc/fstab
A formatted partition is still not anywhere you can cd to. Mounting attaches it to a folder — its mount point — and from then on whatever you write there lands on that disk.
sudo mkdir /srv/data
sudo mount /dev/sdb1 /srv/data
df -h /srv/data
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 20G 24K 19G 1% /srv/data
findmnt /srv/data and lsblk show it too. Files in a folder from before the mount aren't deleted — they're hidden under the disk until it's unmounted.
sudo umount /srv/data
It's umount — no "n". target is busy: something still uses it, often your own shell — cd out first.
Every boot: /etc/fstab
A mount lasts until the next reboot. What should be mounted at every boot is listed in /etc/fstab:
cat /etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=6f1c2b7a-… / ext4 errors=remount-ro 0 1
UUID=7C1A-3E2F /boot/efi vfat umask=0077 0 1
Add one line for the data disk — by UUID, not /dev/sdb1: device names can change when disks are added or removed, the UUID never does.
sudo blkid -s UUID -o value /dev/sdb1
sudo nano /etc/fstab
UUID=d4a70b1e-7e2a-4c1d-9f5b-3a8e6c2d1f07 /srv/data ext4 defaults,nofail 0 2
| Field | Here | Means |
|---|---|---|
| 1 | UUID=… | which filesystem |
| 2 | /srv/data | where |
| 3 | ext4 | its type |
| 4 | defaults,nofail | options — nofail: boot anyway if the disk is missing |
| 5 | 0 | dump (not used) |
| 6 | 2 | check order at boot: 1 for /, 2 for the others, 0 never |
Test before you reboot
sudo systemctl daemon-reload
sudo mount -a
sudo findmnt --verify
mount -a mounts everything in fstab that isn't mounted yet — a mistake shows up now, not at the next boot. findmnt --verify checks every line.
⚠️ A broken fstab line can stop a server from booting (emergency mode — no ssh). So:
mount -aandfindmnt --verifyafter every change, andnofailfor disks that might be missing.
Then the real test — the server forgets every hand-made mount on the way:
sudo reboot