Skip to content

XFS Filesystem

This example puts an XFS filesystem on the volume served by flexblock@nvme1n1p1.service and mounts it at /mnt/analytics. It assumes the systemd service is installed and its environment file pins --ublk-dev-id 0, so the device is /dev/ublkb0.

Format once, with the service running:

Terminal window
sudo systemctl daemon-reload
sudo systemctl enable --now flexblock@nvme1n1p1.service
sudo mkfs.xfs /dev/ublkb0

The unit file name must be the escaped mount path, so /mnt/analytics becomes /etc/systemd/system/mnt-analytics.mount.

[Unit]
Description=flexBlock analytics volume
Requires=flexblock@nvme1n1p1.service
After=flexblock@nvme1n1p1.service
[Mount]
What=/dev/ublkb0
Where=/mnt/analytics
Type=xfs
Options=noatime,discard,_netdev
[Install]
WantedBy=multi-user.target
Terminal window
sudo systemctl daemon-reload
sudo systemctl enable --now mnt-analytics.mount

Also add the device timeout drop-in for dev-ublkb0.device, so systemd waits long enough for the device on a cold start.

Enabling the mount pulls the flexBlock service in through Requires=, and After= holds the mount until the service’s readiness gate passes, so the device exists before the mount is attempted.

_netdev is needed even in a mount unit. Without it, systemd files a mount under /mnt with local-fs.target. The flexBlock service itself waits on that target (through sysinit.target), so the result is an ordering cycle that systemd-analyze verify reports.

With _netdev, the mount is ordered under remote-fs.target, after the network is online, instead of making early boot wait on it. That is where a volume that lives in object storage belongs.

This example mounts with discard, so space the filesystem frees is returned to flexBlock as it happens. On a write-back cached volume that matters more than on a plain SSD: a dirty chunk the filesystem frees in full is dropped before it is ever uploaded, and a fully freed chunk’s object is deleted from the bucket. The ext4 page explains the trade-off against a periodic fstrim.timer.

Stopping the flexBlock service unmounts first and signals the daemon second:

Terminal window
sudo systemctl stop flexblock@nvme1n1p1.service
  • After a live grow with update --device-size, just run sudo xfs_growfs /mnt/analytics.
  • After an offline grow, start the service, mount, then run sudo xfs_growfs /mnt/analytics.

See Growing a Volume.