An XFS filesystem on /dev/sdb1 was damaged by a power loss and must be checked and repaired. Which command is the right tool, and what state must the filesystem be in?

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

Not correct tune2fs -f /dev/sdb1, with the filesystem mounted

Wrong twice. tune2fs edits ext filesystem parameters, not XFS, and it is not a repair tool in any case.

Not correct xfs_fsr /dev/sdb1, with the filesystem mounted

Wrong. xfs_fsr is the filesystem reorganiser — a defragmenter. It works on mounted filesystems and repairs nothing.

Not correct e2fsck -f /dev/sdb1, with the filesystem unmounted

Wrong. e2fsck understands only ext2/ext3/ext4 superblocks and will refuse or misread an XFS filesystem.

Correct xfs_repair /dev/sdb1, with the filesystem unmounted

Correct. xfs_repair is XFS's checker and it refuses to touch a mounted filesystem. Note that mounting an XFS filesystem normally replays its log; xfs_repair -L discards a dirty log and is a last resort because it loses data.

Why

XFS keeps its own toolset: xfs_repair to check and repair (unmounted only), xfs_fsr to defragment, xfs_db to inspect, xfs_info to report geometry. Running plain `fsck` on XFS does almost nothing — fsck.xfs is essentially a stub that exits successfully so boot scripts do not stall.

Where this comes from

Cited
LPI exam objective 104.2
What it says
Repair XFS filesystems with xfs_repair; xfs_fsr reorganises rather than repairs.

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