You run `fsck /dev/sdb1` against an unmounted partition and never say what kind of filesystem it holds. What does fsck itself do with that request?
LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard medium
Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.
Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
The options
Correct It works out the filesystem type and executes the checker that belongs to it — fsck.ext4 for ext4, which is e2fsck under another name.
Correct. fsck is a front end for the various filesystem checkers, each named fsck.<type>, which it searches for along PATH, falling back to /sbin only when PATH is unset. The type is normally deduced from the entry for that device in /etc/fstab.
Not correct It carries checking code for every filesystem Linux supports and picks the right routine internally, so no second program runs.
Wrong. No knowledge of any filesystem's on-disk structures lives in fsck. Each family ships its own checker — e2fsck for the ext family, xfs_repair for XFS — and fsck's whole job is to choose one and run it.
Not correct It refuses to do anything until -t names the type, because guessing would risk running the wrong checker.
Wrong. -t exists but is not required. fsck works the type out for itself — normally from the device's entry in /etc/fstab — and where it cannot, it falls back to a default type rather than refusing to run.
Not correct It mounts the filesystem read-only, reads the superblock, and then checks it while it is mounted.
Wrong, and it inverts the rule. fsck mounts nothing. A filesystem must be unmounted, or already mounted read-only, before it is checked; repairing one that the kernel is still writing to is what corrupts it.
Why
fsck is a dispatcher, and knowing that answers a family of exam questions at once. The checker it runs is fsck.<type>: fsck.ext2, fsck.ext3 and fsck.ext4 are all e2fsck, so every e2fsck option is reachable through fsck. The same shape governs the boot-time check — `fsck -A` walks /etc/fstab, does the root filesystem first and then the others in the order of the sixth field, fs_passno, skipping every entry whose passno is 0. It is also why the answer to 'how do I check an XFS filesystem' is xfs_repair: fsck.xfs is a stub that does nothing and exits successfully, because XFS replays its log when it is mounted.
Where this comes from
- Cited
- manual page fsck(8)
Practise this
Reading one question is not practice. The trainer will draw a short set from objective 104 and space the ones you get wrong.
More questions on this objective
- A new disk /dev/sdb has no partition table at all. Which command writes an empty GPT partition table onto it without dropping you into an interactive editor? machine-checked
- You need the partition /dev/sdc1 on a USB stick to carry a FAT32 filesystem so that Windows machines can read and write it. Which command creates it? machine-checked
- You have just run `mkswap /dev/sdb2`. Which command makes the kernel start using that swap area immediately, without a reboot? machine-checked
- Why is it dangerous to run e2fsck against an ext4 filesystem that is currently mounted read-write? machine-checked
- On an ext4 filesystem at /dev/sda1 you want an automatic check to be forced after every 30 mounts. Which command sets that? machine-checked
- `df -h /var` reports the filesystem 100% full, but `du -sh /var` accounts for only about half that space. Nothing is hidden under a mount point. What is the most likely explanation? machine-checked
All questions on Devices, Linux filesystems, filesystem hierarchy standard