An XFS filesystem that has held constantly appended log files for two years has become badly fragmented. Which command reorganises the files to reduce fragmentation while the filesystem stays mounted and in use?

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 xfs_repair /dev/sdb1

Wrong. xfs_repair checks and repairs structural damage, and it refuses to run on a mounted filesystem. Fragmentation is not damage.

Correct xfs_fsr /dev/sdb1

Correct. xfs_fsr is the XFS filesystem reorganiser: it rewrites fragmented files into contiguous extents on a live, mounted filesystem, and with no argument it works through every mounted XFS filesystem listed in /etc/mtab.

Not correct xfs_db /dev/sdb1

Wrong. xfs_db is an expert debugger that examines and, in unsafe hands, edits raw XFS metadata. It is a diagnostic tool, not a maintenance one.

Not correct e2fsck -D /dev/sdb1

Wrong twice. -D reindexes and compacts directories, and e2fsck only understands ext2/3/4, so pointing it at XFS is useless at best.

Why

XFS keeps a toolset of its own, each member with one job: xfs_repair checks and repairs an unmounted filesystem, xfs_fsr defragments a mounted one, xfs_db inspects metadata, xfs_info reports geometry, xfs_admin changes the label and UUID. The distinction to carry away is that repair tools demand the filesystem be offline because they rewrite metadata the kernel also owns, whereas xfs_fsr moves file data through ordinary filesystem calls and is therefore safe while mounted.

Where this comes from

Cited
manual page xfs_fsr(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