Based on the Linux Master 1 exam syllabusReport an error
df -i, not df -h.Even on the same physical disk, the maximum file size, recovery ability, and performance change completely depending on which filesystem you format it with. The starting point is how a file is actually represented.
mkfs), and each file consumes one inode.| Item | Description |
|---|---|
| File type | Regular file / directory / symbolic link / device, etc. |
| Permission mode | rwxrwxrwx (12 bits, including SUID/SGID/Sticky) |
| Owner UID / GID | Whose file it is |
| Link count | Number of hard links pointing to this inode |
| Size | File size in bytes |
| Timestamps | atime (access), mtime (modification), ctime (inode change) |
| Data block pointers | Locations of the blocks where the actual content is stored |
A directory is not "a folder that contains files"; it is a special file whose content is a list of "file name → inode number" pairs. All ls does is open the current directory file and read that list. That is why deleting a file from a directory (unlink) requires write permission on the directory, not permission on the file itself. The sticky bit (the t on /tmp) is the mechanism that closes this loophole.
The data block pointers in an inode traditionally used a structure of 12 direct blocks + single indirect + double indirect + triple indirect (ext2/3). Small files are fine with the 12 direct pointers, but large files are represented by stacking up "pointers to blocks that hold pointers" in stages. Instead of this scheme, ext4 introduced extents — expressing a range at once as "start block + contiguous length" — so contiguous large files are handled with far less metadata. Performance improves significantly for large, low-fragmentation files.
⚠️ Pitfall: A situation where "there is free disk space but I can't create a file" is inode exhaustion.
df -hshows block (capacity) usage, whiledf -ishows inode usage separately. When huge numbers of small files (mail queues, session files, etc.) pile up, capacity is fine but inodes hit 100% andNo space left on deviceappears. On the exam, "free space available but file creation fails → cause?" The answer is inode exhaustion.
# Try it yourself — observing inodes
ls -i file.txt # Print the file's inode number
stat file.txt # Everything: inode, link count, timestamps
df -i # Inode usage per filesystem
ls -id /tmp # Inode number of a directoryThe etymology of "inode" is not clear, but Dennis Ritchie recalled it as short for "index node". This design — managing file metadata by number, separate from the name, since the early 1970s Unix — has survived as the backbone of Linux filesystems to this day.
Once you understand inodes, the difference between the two kinds of links becomes obvious.
| Aspect | Hard link | Symbolic link |
|---|---|---|
| inode | Same as the original | Separate inode |
| Link count | Increases it | No effect |
| Filesystem boundary | Cannot cross | Can cross |
| Directory target | Not allowed (normally) | Allowed |
| When the original is deleted | Data kept | Broken link |
What rm does is not erase data but detach the name from the directory and decrease the inode's link count by 1. Only when the count reaches 0 and no process has the file open are the blocks reclaimed. That is why, if you rm a log file that a running process has open, the disk does not free up immediately — the inode stays alive until the process closes it.
# Try it yourself — links and link count
echo hello > a.txt
ln a.txt b.txt # Hard link
ls -li a.txt b.txt # Same inode number, link count 2
ln -s a.txt c.txt # Symbolic link
ls -li c.txt # Separate inode, shows '->'fsck had to scan the entire disk, which took tens of minutes to hours on large disks.The three journaling modes of ext3/ext4:
| Mode | What is recorded in the journal | Safety | Performance |
|---|---|---|---|
| journal | Both metadata and data | Highest | Slowest (writes twice) |
| ordered (default) | Metadata only, but data is written to disk first, then metadata is committed | High | Balanced |
| writeback | Metadata only, no guarantee on data ordering | Low | Fastest |
A common misconception is that "journaling protects data". The default mode (ordered) only guarantees metadata consistency; it does not guarantee that the user data being written at the very last moment is lost-free. Only the journal mode, which double-writes data to the journal as well, protects data. On the exam, "What does ext3's default journaling guarantee?" → metadata consistency is the answer.
ext4's journal lives in a separate small area, and you can check the "Journal inode" entry with tune2fs -l. data=ordered is adjusted through a mount option (/etc/fstab or mount -o data=ordered). btrfs and xfs take different approaches from ext — xfs uses metadata journaling, and btrfs uses copy-on-write (CoW), always writing to a new location instead of using a journal and atomically swapping the pointer. That is why btrfs gets snapshots naturally for free.
ext3 came out (2001) by adding only journaling to ext2 while keeping on-disk format compatibility. So you could mount an ext3 partition as ext2 or vice versa. This "evolution that doesn't break existing assets" strategy is the secret behind the ext family's long reign as the default Linux filesystem.
The evolution of the ext family at a glance:
| Item | ext2 | ext3 | ext4 |
|---|---|---|---|
| Journaling | None | Yes | Yes |
| Max file size | 2TB | 2TB | 16TB |
| Max filesystem | 32TB | 32TB | 1EB (exabyte) |
| Block allocation | Indirect blocks | Indirect blocks | Extents |
| Features | Simple, fast | ext2 + journal | Extents, delayed allocation, backward compatible |
Other major filesystems:
| Filesystem | Key characteristics | Strengths |
|---|---|---|
| xfs | Metadata journaling, extents, dynamic inodes | Strong with large files and parallel I/O. Default in RHEL 7+ |
| btrfs | Copy-on-Write, snapshots, built-in RAID, pooling | Integrates snapshots, checksums, and volume management |
| swap | Not a filesystem; swap area for virtual memory | (Covered on Day 3) |
xfs cannot be shrunk. It can only be grown (xfs_growfs). ext4 can be both grown and shrunk (after unmounting) with resize2fs. This asymmetry is easy to test together with LVM — "How do you shrink an LV formatted with xfs?" → The only way is to back up and recreate.
btrfs's Copy-on-Write never overwrites data; it always writes to new blocks and then atomically swaps the metadata pointer. Thanks to this, snapshots are nearly free (only changed blocks take extra space), and every block has a checksum, so silent corruption can be detected and repaired. However, in workloads like databases that constantly overwrite the same location, CoW fragmentation can slow things down, so the nodatacow attribute is sometimes applied to those files.
# Try it yourself — checking filesystem types
df -T # Mounted filesystems and their types
lsblk -f # FSTYPE, UUID per block device
blkid # UUID and TYPE per device
cat /proc/filesystems # List of filesystems the kernel supports
tune2fs -l /dev/sda1 | head # ext-family superblock info (including journal)mkfs time.du) is larger than the nominal size (ls -l), i.e., internal fragmentation.⚠️ Pitfall: When the superblock is corrupted, recover by using a backup superblock with
fsck -b <backup block number> /dev/sdaX. Find the backup locations withdumpe2fs /dev/sdaX | grep -i superblockormke2fs -n(prints only the locations without actually formatting). It appears as a short-answer question on "what to do when the primary superblock is damaged".
The practice of choosing a 4KB block size is to match the memory page size of most CPUs (4KB). When filesystem blocks and memory pages are aligned, I/O between the page cache and disk maps cleanly 1:1, which is efficient.
Next, Day 2 covers the process of putting this filesystem onto an actual disk — partitions, mkfs, mount, fstab.
df -i.fsck : The command that checks and repairs filesystem consistency. Before journaling was introduced, it needed a full scan.resize2fs / xfs_growfs : ext can be grown and shrunk, but xfs can only be grown.Click a choice to reveal the answer and explanation.
Question 1
Which of the following correctly describes where a file's name (filename) is actually stored in Linux?
Question 2
df -h shows plenty of disk capacity, yet creating a new file fails with a "No space left on device" error. What is the most likely cause?
Question 3
Which best describes what ext3's default journaling mode, ordered, guarantees?
Question 4
Which of the following is NOT a key change ext4 introduced compared with ext3?
Question 5
Which statement about the difference between hard links and symbolic links is correct?
Question 6
Which statement about the xfs filesystem is correct?
Question 7
When the primary superblock is damaged and the filesystem cannot be mounted, which recovery method is correct?