cetrafs
How-to guideTask-oriented

Mount a volume at boot

Mount cetrafs read-write or as a read-only observer, by hand, from /etc/fstab, or with a systemd mount unit.

Mount by hand

Read-write, as a full cluster participant:

sudo mount -t cetrafs /dev/sdb /mnt/cetra

As a read-only observer, to inspect a live volume from another host without taking write capacity or replaying anything:

sudo mount -t cetrafs -o ro /dev/sdb /mnt/cetra

For a Proxmox/qemu cluster that live-migrates VMs, add nofilelock. See Enable live migration. To return freed space to a thin LUN as it is freed, add discard; see Return free space to a thin LUN.

Mount at boot with /etc/fstab

/dev/disk/by-id/dm-name-mpatha  /mnt/cetra  cetrafs  _netdev,nofail,x-systemd.mount-timeout=600  0  0
  • _netdev waits for the network, which iSCSI needs. It does no harm on Fibre Channel.
  • nofail lets the host finish booting if the LUN isn’t there.
  • x-systemd.mount-timeout=600 gives the mount ten minutes. A mount after a crash can legitimately wait minutes: up to the stale window (120 s by default, 240 s at most) to make sure no other machine is using its identity, and up to about 210 s more if another node is replaying its journal. systemd’s default timeout is 90 s; it kills the mount mid-wait, and the mount then starts over.
  • Add nofilelock to the options on a live-migration cluster, and add it on every node.
  • Use a stable device name. For multipath, /dev/disk/by-id/dm-uuid-mpath-<wwid> or /dev/disk/by-id/dm-name-<alias>: they keep pointing at the same device whatever its /dev/mapper name or dm-N number becomes after a reboot or a multipath configuration change. For a single-path disk, /dev/disk/by-id/wwn-... or scsi-.... Never a bare /dev/sdX or /dev/dm-N, which can change between boots.

You don’t need to load the module in advance. The first cetrafs mount loads it.

Mount with a systemd unit

If you prefer a unit, name it after the mount path (/mnt/cetra becomes mnt-cetra.mount):

# /etc/systemd/system/mnt-cetra.mount
[Unit]
Description=cetrafs shared datastore
After=network-online.target iscsid.service multipathd.service
Wants=network-online.target

[Mount]
What=/dev/disk/by-id/dm-name-mpatha
Where=/mnt/cetra
Type=cetrafs
Options=nofilelock
TimeoutSec=600

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now mnt-cetra.mount

Check the mount

ls /proc/fs/cetrafs/                         # one directory per mounted volume
grep -E 'write_ready|file_lock|fenced' /proc/fs/cetrafs/*/info

Changing mode later

Read-only and read-write participation, and the file-lock mode, are fixed at mount time. mount -o remount,ro and remounts that change nofilelock are refused. Unmount and mount again with the options you want.

If the mount fails

ErrorMeaning
EBUSYThe device has no atomic CAW and another node already has it mounted. Mount it on one node only.
EINVAL with a version or feature message in dmesgThe volume was made by a different format version, such as a 0.9.x volume on 0.10. Reformat it; there is no migration.
Refused, block 0 doesn’t verifySomething overwrote the superblock. Restore it from its copy.
EINVAL with a file-lock mode message in dmesgYou asked for a file-lock mode that conflicts with the one the cluster already uses. Use the same options as the other nodes.

The troubleshooting reference has more.

Last updated