cetrafs
ReferenceInformation-oriented

fsck.cetra

Check and repair a cetrafs volume: synopsis, offline and live checks, the four passes, what -r repairs and refuses, and exit codes.

Synopsis

fsck.cetra [-r] <blockdev>
fsck.cetra --live <blockdev>
fsck.cetra --discard-journal <row> <blockdev>
OptionMeaning
(none)Check only, offline. Changes nothing.
-r, --repairCheck offline and repair the faults that have one correct answer. Refuses everything else.
--liveCheck a volume that other nodes have mounted, read-only, without claiming it. Can’t be combined with -r.
--discard-journal <row>Mark Node Registry row <row>’s journal clean without replaying it, then run as -r. Only for a journal a mount can’t replay because a block of it is unreadable: its pending writes are lost, and the walk afterwards reports what they would have repaired.

Offline checks

fsck.cetra and fsck.cetra -r refuse to run if the volume is mounted on this machine, in any mount namespace, or if its Node Registry has a live row: a node that is still heartbeating. To tell, it watches every row a node hasn’t left cleanly, for the longest stale window any row advertises (at most 240 s). A row whose heartbeat doesn’t move counts as gone; the verdict never depends on comparing clocks.

Live checks

fsck.cetra --live <dev> checks a volume while other nodes use it. It claims nothing and writes nothing, so the peers never notice it. Run it on a node that has the volume mounted, or on any other machine that sees the LUN; it first syncs this machine’s mounts of the volume and reads the device directly, past the page cache.

The volume changes under the walk, so it walks up to three times:

ResultExit
A walk finds nothing0, at once
Every walk reports the same problem, word for word1: damage repeats, a peer’s write in flight doesn’t. Take the volume offline on every node and run fsck.cetra -r.
Every walk saw problems, but never the same one3: the volume changed too fast to judge. Run it again when it is quieter.

--live never repairs.

Passes

PassChecks
1. StructuralFormat version (0x000A) and feature bits; the superblock’s checksum, fields and region map, and its copy at block 2048; the Block Group and inode table chains; Zone Group and Block Group descriptors against their headers; every Block Group owned by a real Zone Group or by none, with no two overlapping; Node Registry rows
2. Cluster metadataPer-node journals; pending-free queue entries, including a queued free for a block a file still uses
3. ContentEvery bitmap sector’s checksum; the inode and data bitmaps against the extent trees, at every depth, in both directions; cross-file block overlap; two extents of one file over the same logical block; cached free counts against bitmaps; leaks
4. NamespaceEvery directory’s entries and block tails; a directory’s size against its entries; a directory with more than one name; . and ..; link counts against referring entries; entry type against inode mode; reachability from the root

What -r repairs

FaultRepair
A bitmap bit disagreeing with the extent trees (leaked, or about to be allocated twice)Bit set to match the trees
A bitmap sector that fails its checksumRewritten from the bits the extent trees settle on
A Block Group, Zone Group or pool free count disagreeing with the bitmapsRecomputed
nlink disagreeing with the entries naming the inodeCorrected
An orphan inode with nlink = 0, or an empty file no entry namesFreed
An orphan inode with nlink > 0 (a lost directory entry)Linked into /lost+found as #<ino>
A directory’s size disagreeing with its entriesCorrected
A directory block with a bad tail checksum whose entries all parseTail re-stamped, names kept
A regular file’s extent leaf with a bad tail checksumSalvaged: an entry is kept if its blocks are in a data region, set in the bitmap, named by nothing else, inside the index range and clear of the damaged sector. The rest become holes.
A damaged Zone Group recordRebuilt
A damaged Block Group descriptorRebuilt from the Block Group’s header
A damaged Node Registry rowRebuilt, keeping the incarnation its claims carry
A garbage pending-free entryCleared
Block 0 that doesn’t verify, with a good copy at block 2048The volume is checked through the copy, then block 0 is restored from it
A copy at block 2048 that is missing, stale or damagedRewritten
The “needs fsck” mark a node left after finding damageCleared, at the end of a pass that finds the volume clean

-r also retires Node Registry rows of nodes that have left and that nothing references, so a volume that has seen many machines has room for new ones.

If -r reports reclaimed blocks, run it once more: some reclamation it enables is picked up on the next pass.

What -r refuses

Reported, never changed:

FaultWhy
Cross-file block overlapNothing on disk says which file should keep the block
An unreadable inode record or extent headerIts blocks can’t be marked as used, so clearing them as leaks could hand a live file’s blocks to someone else
A dangling directory entryRemoving it destroys a name
A directory with more than one name, or an extent tree no directory can haveRemoving either name frees what the other still names. Either blocks every repair in the run.
A deleted file whose blocks another file now holdsReviving it would give two files one block
Journal entries a mount hasn’t replayed yetThe next mount completes those writes, which a repair made around them would contradict. No group record is rebuilt and the “needs fsck” mark stays. Mount the volume once, unmount it, and run -r again.

Messages that aren’t damage

Leftovers of an interrupted operation are printed as WARN and don’t change the exit code. Each is a leak, the safe direction, and the scrubber or -r takes it back: a deleted record’s stale extents, a record that was never written, an empty file no entry names.

A Block Group or Zone Group free count behind its bitmap, in a Zone Group whose owner didn’t leave cleanly, is printed as a note:. The mount that takes over or re-attaches that Zone Group recounts it.

After an unclean shutdown, an offline fsck run before the next mount can also report an orphan or a link count that lags its entries. The next mount repairs those; fsck.cetra -r isn’t needed.

A file’s block count (blocks in stat) short of its extents is reported as an error, and the message names the cause. On a volume formatted with no journal (mkfs.cetra -J 0) it is what a crash in the middle of extending a file leaves; a journaled volume can show it in one narrow case after a crash. The data and the extents are intact, and fsck.cetra -r sets the count from the extents. A block referenced by a file but marked free is never a crash leftover: treat it as damage.

While -r runs

A repair writes the inode table, the bitmaps and directory blocks, so nothing may mount the volume meanwhile. fsck.cetra -r claims the volume first: it holds a Node Registry row in the REPAIR state, and a mount on any node is refused with EBUSY until it ends. Other nodes show the row as REPAIR-IN-PROGRESS in cluster.

  • The claim is taken, renewed and released with compare-and-write, so two repairs started together can’t both go ahead.
  • It is a lease, renewed every few seconds. A repair whose renewal stalls stops writing.
  • If a node starts heartbeating under the claim, the repair stops.
  • Killed with SIGINT, SIGTERM, SIGHUP, SIGQUIT, SIGPIPE or SIGABRT, it releases the claim. A claim left by SIGKILL or a crash is reaped by the next mount or tool, once it is no longer renewed.
  • When the registry is full, a repair borrows the row of a node that has provably left, and gives it back.

A second fsck.cetra -r on a volume already being repaired stops with is already being repaired and exit code 3. A check without -r takes no claim.

Unknown feature bits

The volume has an unknownfsck.cetrafsck.cetra -r
incompatible featurerefused, exit 1refused
read-only-compatible or compatible featurewarns and checksrefused, writes nothing, exit 3

Exit status

CodeMeaning
0Clean
1Problems found
2Bad invocation
3Couldn’t examine the device, or --live couldn’t reach a verdict

Notes

  • Use an fsck.cetra from the same release as the kernel module. A tool from another format version refuses the volume.
  • The volume’s UUID is printed at the start of the run.

Last updated