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

Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.

It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.

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 set from objective 104 and space the ones you get wrong.

Practise LPIC-1 Exam 101-500