cetrafs
ReferenceInformation-oriented

defrag.cetra

Online per-file defragmentation: synopsis, preconditions, refusals and exit codes.

Synopsis

defrag.cetra <file-on-a-cetrafs-mount>

Relocates the file into one contiguous run while the filesystem is live. The file may be open and being written. The work is done in steps aligned to whole extents.

How it stays safe

The tool opens the file for writing on purpose. On a default mount, that write-open takes the file’s cross-node exclusive lock, so no other node can have the file open while its blocks move.

Refusals

Each refusal is explained, not just reported as an errno:

ConditionResult
File has interior holes (sparse)Declined
defrag=off in the mount’s controlsDisabled
Mount is nofilelockDisabled (the defragmenter depends on the lock)
Another node holds the fileRefused (foreign lock)
Path isn’t on a cetrafs mountRefused

Exit status

CodeMeaning
0Done
1Failed
2Bad invocation

Background defragmentation

The module also defragments in the background. A file is queued when its extent count is at least auto_defrag_min_extents and at least auto_defrag_min_pct percent of the minimum for its size. See module parameters and the auto_defrag key in controls.

Last updated