This guide walks through the four operations you do with a Linux disk: see what's there, partition it, format a partition, and mount it at boot. The vocabulary is older than most of us, so we'll explain each word as it comes up.
Heads up: partition and format commands destroy data. Practice the read-only steps freely, but double-check the device name before any write step. sda is your laptop's main disk; sdb is usually a USB stick — but not always.
The cast
- Block device — what Linux calls anything that looks like a disk: a hard drive, an SSD, a USB stick, a memory card. They live in
/dev/assda,sdb,nvme0n1, etc. - Partition — a chunk of a block device, like a slice of cake.
/dev/sda1is the first partition of/dev/sda. - Filesystem — the format inside a partition: ext4, btrfs, xfs, ntfs, vfat, etc. A partition without a filesystem is empty.
- Mount point — an empty directory where you attach a filesystem so its contents show up there.
Step 1: see what's connected
lsblk
Reads as: "list block devices." Tree view of every disk and its partitions, with their sizes and where (if anywhere) they're mounted.
NAME SIZE TYPE MOUNTPOINTS
sda 500G disk
├─sda1 512M part /boot/efi
└─sda2 499.5G part /
sdb 16.0G disk
└─sdb1 16.0G part
More detail:
lsblk -f # also show filesystem + UUID
sudo fdisk -l # partition table details for every disk
Step 2: partition a disk
The friendliest tool for new partitions today is cfdisk — a menu-driven version of fdisk. For a brand-new USB stick at /dev/sdb:
sudo cfdisk /dev/sdb
It asks which partition table to create (pick gpt on modern hardware), then drops you into a menu where you can create, resize, and delete partitions. Use the arrow keys, hit Write to commit, type yes to confirm.
Modify the disk, not a partition. Run cfdisk /dev/sdb, not cfdisk /dev/sdb1.
Step 3: put a filesystem on the partition
A partition is just empty space until you format it. Use mkfs (make filesystem):
sudo mkfs.ext4 /dev/sdb1 # standard Linux filesystem
sudo mkfs.ext4 -L mybackup /dev/sdb1 # with a friendly label
sudo mkfs.vfat -F 32 /dev/sdb1 # FAT32, e.g. for USB sticks shared with Windows
sudo mkfs.exfat /dev/sdb1 # exFAT, for big USB sticks shared everywhere
sudo mkfs.btrfs /dev/sdb1 # btrfs (snapshots, modern features)
Always check the device name twice before pressing Enter on a mkfs. It rewrites the start of the partition with no confirmation.
Step 4: mount it (once)
Pick or make an empty directory to use as the mount point:
sudo mkdir /mnt/backup
sudo mount /dev/sdb1 /mnt/backup
ls /mnt/backup # should be empty (you just formatted)
The mount lasts until you unmount or reboot. To unmount:
sudo umount /mnt/backup
("umount", not "unmount" — Unix is just like that.)
Step 5: mount it on every boot — /etc/fstab
/etc/fstab is the list of filesystems to mount automatically at boot. Each line is one filesystem.
First, find the UUID
Don't put /dev/sdb1 in fstab — device names can change between boots if you plug in a USB stick. Use the partition's UUID (Universally Unique Identifier) instead.
lsblk -f
# NAME FSTYPE LABEL UUID MOUNTPOINTS
# sdb1 ext4 mybackup c1d2-...e3f4 /mnt/backup
or, the venerable:
sudo blkid /dev/sdb1
# /dev/sdb1: LABEL="mybackup" UUID="c1d2e3f4-..." TYPE="ext4"
Add the entry
sudo nano /etc/fstab
Add one line (replace the UUID with yours):
UUID=c1d2e3f4-... /mnt/backup ext4 defaults,nofail 0 2
The six fields:
- What to mount — UUID, label (
LABEL=mybackup), or device path. - Where — the mount point.
- Filesystem type —
ext4,vfat,btrfs, etc. - Options —
defaultsis fine;nofailmeans "boot anyway if this disk isn't present." - Dump — almost always
0. - fsck order —
1for the root filesystem,2for other filesystems to check,0to skip.
Test without rebooting
sudo umount /mnt/backup # if it was already mounted
sudo mount -a # mount everything in fstab
If mount -a doesn't complain, you're good. Reboot when you're ready and the disk will mount automatically.
Test before rebooting. A broken fstab line can drop you into emergency mode at boot. Always run mount -a first.
Useful inspection commands
df -h # mounted filesystems and how full they are
du -sh ./* # disk usage per directory under here
mount | column -t # everything currently mounted, formatted
findmnt /mnt/backup # everything about one mount
Common gotchas
- "Device is busy" on umount. Something still has it open. Find what:
lsof /mnt/backuporfuser -vm /mnt/backup. - NTFS partition mounts read-only on Linux — install
ntfs-3gon older distros (modern kernels handle NTFS read-write natively). - USB stick won't format — Linux auto-mounts removable media. Unmount first with the file manager, then run mkfs.