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.

Practise LPIC-1 Exam 101-500

More questions on this objective

All questions on Devices, Linux filesystems, filesystem hierarchy standard

Practise LPIC-1 Exam 101-500