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
Section titled “Format”Format once, with the service running:
sudo systemctl daemon-reloadsudo systemctl enable --now flexblock@nvme1n1p1.servicesudo mkfs.xfs /dev/ublkb0The unit file name must be the escaped mount path, so /mnt/analytics becomes /etc/systemd/system/mnt-analytics.mount.
[Unit]Description=flexBlock analytics volumeRequires=flexblock@nvme1n1p1.serviceAfter=flexblock@nvme1n1p1.service
[Mount]What=/dev/ublkb0Where=/mnt/analyticsType=xfsOptions=noatime,discard,_netdev
[Install]WantedBy=multi-user.targetsudo systemctl daemon-reloadsudo systemctl enable --now mnt-analytics.mountAlso add the device timeout drop-in for dev-ublkb0.device, so systemd waits long enough for the device on a cold start.
The same dependencies can be written in /etc/fstab:
/dev/ublkb0 /mnt/analytics xfs noatime,discard,nofail,_netdev,x-systemd.requires=flexblock@nvme1n1p1.service,x-systemd.after=flexblock@nvme1n1p1.service,x-systemd.device-timeout=30min 0 0nofail keeps a missing volume from failing boot, and x-systemd.device-timeout=30min gives a cold start time to bring the device up.
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.
Why _netdev
Section titled “Why _netdev”_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.
Why discard
Section titled “Why discard”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
Section titled “Stopping”Stopping the flexBlock service unmounts first and signals the daemon second:
sudo systemctl stop flexblock@nvme1n1p1.serviceGrowing
Section titled “Growing”- After a live grow with
update --device-size, just runsudo xfs_growfs /mnt/analytics. - After an offline grow, start the service, mount, then run
sudo xfs_growfs /mnt/analytics.
See Growing a Volume.