Chapter 2 · Lesson 9
Advanced
1 min read
Disks, Filesystems and Mounts
Overview
A disk block device may contain a partition and filesystem. Linux mounts a filesystem onto a directory. Capacity checks use both block storage and inode accounting; a disk can report little free space or run out of metadata entries.
Detailed Notes
Identify storage
bash
lsblk
df -h
df -i
du -xh /var/log | sort -h | tail
lsblkshows block devices and mount relationships.df -hshows mounted filesystem capacity.df -ishows inode usage.dushows directory disk usage.
Mount a filesystem
bash
mkdir -p /mnt/data
sudo mount /dev/sdb1 /mnt/data
df -hT /mnt/data
sudo umount /mnt/data
mount attaches a filesystem. umount detaches it. Never unmount a busy filesystem without stopping the process that uses it.
Persistent mounts
/etc/fstab describes persistent mount entries:
text
UUID=1234 /data ext4 defaults,nofail 0 2
Use UUID or filesystem label rather than /dev/sdb1 when devices can change order.
Test an fstab configuration:
bash
sudo findmnt --verify
sudo mount -a
Validate the configuration before rebooting. A bad root or essential mount can prevent normal startup.
Common Interview Questions
Finished this lesson?
0 of 25 lessons done · 0% of the course

