Chapter Two
Files and the Filesystem
Where everything lives on a Linux box, what a file actually is underneath the name, and how separate disks become one directory tree you can mount, manage, and trust.
Linux presents every disk, partition, and pseudo-device as one tree rooted at /. That single namespace is the abstraction the rest of the system is built on, and it only helps you if you know where things belong, what a file is below the name you type, and how storage gets attached to the tree in the first place.
This chapter takes the filesystem apart layer by layer. It maps the standard directories so you know where a binary, a config, or a log should sit, separates the inode from the filename so links and permissions stop being surprising, covers the day-to-day commands for moving data around, and ends at /etc/fstab and the on-disk formats — ext4, XFS, Btrfs, ZFS — that decide how your data is actually stored.
Topics in This Chapter
/ and the FHS rules behind it: what belongs in /etc, /var, /usr, and /opt, and why /bin and /lib are now symlinks into /usr on modern Debian and Ubuntu.stat shows you.ls, cp, mv, rm, find — and the sharp edges that bite: mv across filesystems silently copies, and rm has no undo.mount, why production entries use a UUID instead of /dev/sda1, and the /etc/fstab mistake that leaves a server hung at boot waiting on a disk that is not there.