A server has dropped into a maintenance shell because the unmounted ext4 filesystem on /dev/sdb1 has errors. You want the check to run unattended, answering yes to every question it asks. Which command does that?
LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard easy
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
Not correct e2fsck -n /dev/sdb1
Wrong, and the opposite. -n answers no to every question and opens the device read-only, which makes it the safe way to see what is broken without changing anything.
Correct e2fsck -y /dev/sdb1
Correct. -y assumes an answer of yes to all questions, so the check runs to completion without a human at the console.
Not correct e2fsck -p /dev/sdb1
Wrong for this requirement. -p means preen: it repairs only problems that are safe to fix without any question at all, and exits with an error the moment it meets one that needs a decision. It is what boot scripts use, not what finishes a damaged filesystem.
Not correct e2fsck -c /dev/sdb1
Wrong. -c runs badblocks over the device to build a bad-block list. It scans the media rather than resolving metadata questions.
Why
e2fsck has three answering modes: -p fixes only the unambiguous problems and bails out otherwise, -y says yes to everything, and -n says no to everything and stays read-only. -f is separate and orthogonal: it forces a full check even when the superblock says the filesystem is clean. The front-end fsck simply dispatches to the fsck.TYPE helper for the filesystem in question, so `fsck -y /dev/sdb1` reaches the same e2fsck here.
Where this comes from
- Cited
- manual page e2fsck(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