Skip to content

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.

Terminal window
sudo mount.flexfs init fstab my-volume /mnt/data

This appends a line to /etc/fstab:

my-volume /mnt/data flexfs _netdev,nofail 0 0

The command also creates the mount point directory if it does not exist.

| 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. | | --force | bool | false | Replace an existing fstab entry for the same mount point | | --mountOptions | string | (empty) | Additional mount options to include (comma-separated) | | --now | bool | false | Mount immediately after creating the fstab entry |

Mount with additional options:

Terminal window
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 0

Mount immediately and replace any existing entry:

Terminal window
sudo mount.flexfs init fstab my-volume /mnt/data --now --force

Use a non-default credentials file:

Terminal window
sudo mount.flexfs init fstab my-volume /mnt/data \
--credsFile /etc/flexfs/my-volume-creds

Produces:

my-volume /mnt/data flexfs credsFile=/etc/flexfs/my-volume-creds,_netdev,nofail 0 0

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 |

  • _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).

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 0

Common 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 |

Once the fstab entry exists, mount the volume with:

Terminal window
sudo mount /mnt/data

Or mount all fstab entries:

Terminal window
sudo mount -a

At boot, systemd reads /etc/fstab and creates mount units automatically. The _netdev flag ensures flexFS mounts wait for network availability.

Use the deinit fstab subcommand to remove a flexFS entry from fstab and optionally unmount:

Terminal window
sudo mount.flexfs deinit fstab /mnt/data

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.