cetrafs
How-to guideTask-oriented

Monitor a volume

What to watch on a live cetrafs cluster: free space per node, node liveness, damage marks, contention, journal replays, discard and the kernel log.

Each mounted volume publishes its live state under /proc/fs/cetrafs/<dev>/, where <dev> is the kernel’s name for the device (sdb, dm-3…). Reading these files is safe on a live mount; info and cluster read the device and are root-only. Every field is described in the procfs reference.

Quick health check

D=/proc/fs/cetrafs/$(ls /proc/fs/cetrafs | head -1)
sudo cat $D/cluster
sudo grep -E '^(write_ready|fenced|stopped|fsck_needed|sb_copy|file_lock|free_data_blocks|free_inodes|cas_miscompares|journal_replay_refused|scrub_reclaimed|bmap_crc_bad|discard_pending_bgs|space_waits)' $D/info

What to watch

SignalWhereHealthyInvestigate when
Free space, per nodeinfo: free_data_blocks_owned + free_data_blocks_unowned_bgs, free_inodes; or df on each nodeSteady consumptionApproaching zero on any node. A node can run out while the volume has room; see Limits. Grow the volume, with -N for inodes.
Node livenesscluster: stale= per rowAll noA row shows stale=yes (that peer has crashed or stalled) or keeps showing it for a long time.
Stoppedinfo: fenced, stoppedno, nonefenced: yes: the mount has stopped and every access fails with EIO; stopped says why. See Recover from a node failure.
Damaged metadatainfo: corruptions, fsck_needed, bmap_crc_bad0, no, 0Anything else: writes to the damaged file fail with EUCLEAN. Run fsck.cetra --live, then repair offline.
Superblock copyinfo: sb_copyokstale or bad: run fsck.cetra -r at the next window to rewrite it.
Array out of spaceinfo: space_waits; dmesg0Rising: the thin pool is full and writes are waiting. Give it space.
Discardinfo: discard_pending_bgs, discard_errors0discard_pending_bgs staying above 0. See Reclaim thin space.
Journalinfo: journal_slots_stuck0Nonzero: the device refused writes.
Write readinessinfo: write_readyyes on nodes that writePersistently no: every Zone Group is owned by another node. Too few Zone Groups for the number of writers.
Contentioninfo: cas_miscomparesRising slowly while several nodes workStuck at 0 while two nodes are both busy: they may not really share the device (check the storage path).
Replay guardinfo: journal_replay_refused0 in steady stateRises with no recent crash. Each count is a cross-node overwrite that replay refused to apply; dmesg names the block. A burst right after a failover under nofilelock is expected.
Leak reclaiminfo: scrub_reclaimed, scrub_cyclesscrub_cycles keeps advancingfsck reports leaked blocks that never go down across several crashes. Check that the scrubber is on. A cycle that finds a node mid-truncate or mid-punch frees nothing and counts in scrub_inflight_skips, which only delays the reclaim.
Growinfo: layout_genThe same on every nodeStill lower on one node a heartbeat after a grow: check layout_refresh_refused and dmesg, and that its device shows the new size.
Kernel logdmesgLifecycle lines onlyAny EUCLEAN, leaking, WARNING or BUG line from cetrafs.

Free space as Proxmox sees it

statfs (so df, and Proxmox’s pvestatd) reports live counts. This node’s own use shows at once, and space other nodes have used within a second: the shared table is read from the LUN at most once a second, however often statfs is called, so even a tight df loop costs the storage one read a second. Its available figure is what this node can allocate, leaving out space in Block Groups a live peer owns, so df can show different free space on different nodes. It fails on a stopped mount.

Example: a simple Prometheus textfile exporter

cetrafs has no exporter of its own. The info file is key: value text, which is easy to turn into metrics for the node_exporter textfile collector:

#!/bin/sh
# /usr/local/bin/cetrafs-metrics.sh, run from cron or a systemd timer
OUT=/var/lib/node_exporter/textfile/cetrafs.prom
TMP=$OUT.$$
for d in /proc/fs/cetrafs/*/; do
  dev=$(basename "$d")
  awk -v dev="$dev" -F': *' '
    $1 ~ /^[a-z_]+$/ && $2 ~ /^[0-9]+$/ { printf "cetrafs_%s{dev=\"%s\"} %s\n", $1, dev, $2 }
    $1 == "write_ready" { printf "cetrafs_write_ready{dev=\"%s\"} %d\n", dev, ($2=="yes") }
    $1 == "fenced"      { printf "cetrafs_fenced{dev=\"%s\"} %d\n", dev, ($2=="yes") }
  ' "$d/info"
  printf 'cetrafs_stale_peers{dev="%s"} %d\n' "$dev" "$(grep -c 'stale=yes' "$d/cluster")"
done > "$TMP" && mv "$TMP" "$OUT"

Good alerts to start with: cetrafs_fenced == 1, cetrafs_stale_peers > 0 for longer than a few minutes, cetrafs_corruptions > 0 or cetrafs_bmap_crc_bad > 0, any increase in cetrafs_space_waits, a non-zero increase in cetrafs_journal_replay_refused with no failover, and low cetrafs_free_data_blocks_owned + cetrafs_free_data_blocks_unowned_bgs on any node. Add a fsck_needed check too: it isn’t numeric, so test for a line other than fsck_needed: no.

Last updated