In one line: Linux has no drive letters — every storage device is mounted under / at some directory. To use a new disk, you partition it → create a filesystem → mount it.
What it is#
disk → partition → filesystem → mount point
/dev/nvme0n1
└ /dev/nvme0n1p1 (EFI)
└ /dev/nvme0n1p2 (ext4 → /)
└ /dev/nvme0n1p3 (ext4 → /var)
Adding /dev/sdb:
parted /dev/sdb mklabel gpt mkpart primary 0% 100%
mkfs.ext4 /dev/sdb1
mount /dev/sdb1 /mnt/data
Analogy#
A disk is a warehouse: first wall it off into rooms (partitions), then install a shelving system in each (filesystem), finally nail a sign on the door (mount it under /var/data).
Key concepts#
Common commands#
# View
lsblk -f # tree of disks + filesystems + mounts
df -hT # mounted partitions, free space, type
du -sh /var/log/* # directory usage
ncdu / # interactive disk usage
# Operate
mount /dev/sdb1 /mnt/data
umount /mnt/data
mount -o remount,ro / # remount read-only
# New disk from scratch
sudo mkfs.ext4 -L data /dev/sdb1
sudo mkdir /data
echo 'LABEL=data /data ext4 defaults,noatime 0 2' | sudo tee -a /etc/fstab
sudo mount -aHow it works#
VFS exposes a uniform interface; apps don't see what FS is underneath.
Practical notes#
-
Use
UUID=orLABEL=in/etc/fstab— never/dev/sdb1(device names can change on reboot). -
noatimedisables last-access timestamps — saves a write, friendly to SSDs. -
Disk full? Check inodes too:
df -ishows inode usage. -
Swap: paging file when RAM is exhausted. Cloud VMs often ship without swap; add a swapfile:
fallocate -l 4G /swapfile && chmod 600 /swapfile mkswap /swapfile && swapon /swapfile -
du -sh dir/* | sort -hto find the biggest directories. -
Emergency cleanup: clear old
/var/log/*.logand/var/cache, thenjournalctl --vacuum-size=200M. -
Big file deleted, disk still full? A process still holds an fd.
lsof | grep deletedthen restart it.
Easy confusions#
Instant.
Slower but tells you **who's using the space**.