fstab Integration
FlexFS volumes can be mounted automatically at boot by adding entries to /etc/fstab. The mount.flexfs init fstab command generates the correct entry and optionally mounts the volume immediately.
Creating an fstab entry
Section titled “Creating an fstab entry”sudo mount.flexfs init fstab my-volume /mnt/dataThis appends a line to /etc/fstab:
my-volume /mnt/data flexfs _netdev,nofail 0 0The command also creates the mount point directory if it does not exist.
init fstab flags
Section titled “init fstab flags”| Flag | Type | Default | Description |
|---|---|---|---|
--credsFile | string | ~/.flexfs/mount/creds/<name> | Path to the credentials file. Only written to fstab if it differs from the default. |
--mountOptions | string | (empty) | Additional mount options to include (comma-separated) |
--now | bool | false | Mount immediately after creating the fstab entry |
--force | bool | false | Replace an existing fstab entry for the same mount point |
Examples
Section titled “Examples”Mount with additional options:
sudo mount.flexfs init fstab my-volume /mnt/data \ --mountOptions "ro,acl,verbose"Produces:
my-volume /mnt/data flexfs _netdev,nofail,ro,acl,verbose 0 0Mount immediately and replace any existing entry:
sudo mount.flexfs init fstab my-volume /mnt/data --now --forceUse a non-default credentials file:
sudo mount.flexfs init fstab my-volume /mnt/data \ --credsFile /etc/flexfs/my-volume-credsProduces:
my-volume /mnt/data flexfs credsFile=/etc/flexfs/my-volume-creds,_netdev,nofail 0 0fstab entry format
Section titled “fstab entry format”A flexFS fstab entry uses the following fields:
<name> <mount-point> <type> <options> <dump> <pass>| Field | Value | Description |
|---|---|---|
| name | Volume name | The flexFS volume name |
| mount-point | Absolute path | Where the filesystem will be mounted |
| type | flexfs | The filesystem type |
| options | Comma-separated | Mount options (see below) |
| dump | 0 | Not used by flexFS |
| pass | 0 | Not used by flexFS |
Recommended options
Section titled “Recommended options”_netdev— Tells the system this is a network filesystem, ensuring network is available before mounting.nofail— Prevents boot failure if the mount cannot be completed (e.g., if the admin server is unreachable).
systemd directives
Section titled “systemd directives”When using systemd, you can add additional directives to control mount behavior:
my-volume /mnt/data flexfs _netdev,nofail,x-systemd.after=network-online.target 0 0Common systemd directives:
| Directive | Description |
|---|---|
x-systemd.after=<unit> | Wait for the specified systemd unit before mounting |
x-systemd.requires=<unit> | Require the specified systemd unit to be active |
x-systemd.automount | Mount on first access rather than at boot |
x-systemd.mount-timeout=<seconds> | Override the default mount timeout |
Mounting from fstab
Section titled “Mounting from fstab”Once the fstab entry exists, mount the volume with:
sudo mount /mnt/dataOr mount all fstab entries:
sudo mount -aAt boot, systemd reads /etc/fstab and creates mount units automatically. The _netdev flag ensures flexFS mounts wait for network availability.
Removing an fstab entry
Section titled “Removing an fstab entry”Use the deinit fstab subcommand to remove a flexFS entry from fstab and optionally unmount:
sudo mount.flexfs deinit fstab /mnt/dataDuplicate mount protection
Section titled “Duplicate mount protection”When mount.flexfs start detects that it was invoked from an fstab-triggered mount (detected via environment), it silently exits if the volume is already mounted. This prevents errors during mount -a when the volume is already active.