lofiadm(8) on Solnix vs Linux and the BSDs
lofiadm is the illumos command at /usr/sbin/lofiadm that attaches a file to a block device through the lofi driver. Its flags do not carry over from losetup, mdconfig, vnconfig or vndconfig: -a adds, -d removes, -c names a crypto algorithm, and -r makes the device read-only.
The manual pages
- Solnix: lofiadm(8) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: losetup(8) util-linux-2.42.3 (different command, similar job)
- FreeBSD: mdconfig(8) 15.1-RELEASE (different command, similar job)
- OpenBSD: vnconfig(8) 8.0 (different command, similar job)
- NetBSD: vndconfig(8) 11.0 (different command, similar job)
What Solnix runs
A default Solnix system runs the illumos lofiadm at /usr/sbin/lofiadm. No other variants are shipped. The page also documents compression (-C, -U) and encryption (-c, -k, -T, -e), which the other pages in the bundle do not match one for one.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| all four | different command and model | Solnix uses one command, lofiadm, with action flags -a (add) and -d (delete). Linux uses losetup, FreeBSD mdconfig, OpenBSD vnconfig and NetBSD vndconfig. Flags are not interchangeable between them, so compare tasks rather than options.Source: Solnix lofiadm(8) SYNOPSIS; Linux losetup(8) SYNOPSIS; FreeBSD mdconfig(8) SYNOPSIS; OpenBSD vnconfig(8) SYNOPSIS; NetBSD vndconfig(8) SYNOPSIS |
| Linux | -a meaning | On Solnix, lofiadm -a file adds a device for a file. On Linux, losetup -a shows the status of all loop devices. A Linux habit of using -a to list would try to attach on Solnix.Source: Solnix lofiadm(8) -a; Linux losetup(8) -a, --all |
| Linux, NetBSD | -c meaning | Solnix -c selects the encryption algorithm, used together with -a. Linux -c (--set-capacity) rereads the size of a loop device's file. NetBSD -c configures the device, and is assumed if no action option is given.Source: Solnix lofiadm(8) -c; Linux losetup(8) -c, --set-capacity; NetBSD vndconfig(8) -c |
| FreeBSD | -r and -s meaning | Solnix -r opens the device read-only and must come before -a. Solnix -s is the compression segment size. FreeBSD mdconfig -r resizes a memory disk, and -s is the disk size, not a segment size.Source: Solnix lofiadm(8) -r, -s; FreeBSD mdconfig(8) -r, -s |
| all four | choosing a device | lofiadm -a file picks a free device when none is named. Naming one is meant for scripts that rebuild a set of associations, and it fails if that device is not available. Linux uses -f for a free device. FreeBSD and OpenBSD name the device on stdout when none is given. The Solnix page does not say it prints the name.Source: Solnix lofiadm(8) -a; Linux losetup(8) -f, --show; FreeBSD mdconfig(8) -a; OpenBSD vnconfig(8) DESCRIPTION |
| all four | listing and lookup | lofiadm with no arguments lists all associations. lofiadm file shows the device for a file, and lofiadm device shows the file for a device. The other tools list with -l (Linux also -a). The Solnix page warns the output may change in future releases.Source: Solnix lofiadm(8) OPERANDS (device, file), NOTES; Linux losetup(8) -l, -j; FreeBSD mdconfig(8) -l; OpenBSD vnconfig(8) -l; NetBSD vndconfig(8) -l |
| Linux, FreeBSD, NetBSD | removing a busy device | Solnix -d removes the association only if the block device is not busy. FreeBSD mdconfig -d -o force can destroy a disk still in use. NetBSD vndconfig -u -F forces unconfigure. Linux marks a busy device for later destruction instead of failing with EBUSY.Source: Solnix lofiadm(8) -d; FreeBSD mdconfig(8) -o [no]force; NetBSD vndconfig(8) -F; Linux losetup(8) -d |
| OpenBSD, NetBSD | unconfigure flag | Solnix has no -u for unconfiguring: -d removes an association. On Solnix -U uncompresses a compressed file, which is unrelated. OpenBSD vnconfig -u and NetBSD vndconfig -u unconfigure the device.Source: Solnix lofiadm(8) -d, -U; OpenBSD vnconfig(8) -u; NetBSD vndconfig(8) -u |
| OpenBSD | encryption | Solnix encrypts with -c algorithm (aes-128-cbc, aes-192-cbc, aes-256-cbc, des3-cbc or blowfish-cbc). It takes a raw key file with -k, a PKCS#11 key with -T, an ephemeral key with -e, or prompts for a passphrase of at least 8 characters. OpenBSD vnconfig uses Blowfish only. Its -k prompts for the key, and -K rounds also asks for a salt file.Source: Solnix lofiadm(8) -c, -k, -T, -e, OPERANDS crypto_algorithm; OpenBSD vnconfig(8) -k, -K, -S |
| all four | encryption and compression exclusivity | On Solnix, encryption and compression options cannot be combined. An encrypted file cannot be compressed later, nor a compressed file encrypted later. The Linux, FreeBSD and OpenBSD pages in the bundle document no compression of this kind. Source: Solnix lofiadm(8) DESCRIPTION, -C, -U; Linux losetup(8) OPTIONS; FreeBSD mdconfig(8) OPTIONS; OpenBSD vnconfig(8) OPTIONS |
| NetBSD | compressed images | Solnix lofiadm -C gzip, gzip-N or lzma compresses the file in place with an optional -s segment size, and -U uncompresses it. NetBSD vndconfig -z attaches an existing cloop2 image read-only, made with vndcompress(1). A compressed Solnix file cannot be written or mounted read/write.Source: Solnix lofiadm(8) -C, -s, -U; NetBSD vndconfig(8) -z |
| all four | labeled devices and persistence | lofiadm -l creates a labeled device with /dev/{dsk,rdsk} links for slices, to be partitioned with format(8) or fdisk(8). Mappings are not persisted and must be recreated after reboot. A labeled device cannot be made from an existing unlabeled image.Source: Solnix lofiadm(8) Labeled Devices, -l; Linux losetup(8) -P, --partscan |
| all four | permissions and exit status | Solnix access is governed by /dev/lofictl. As shipped, any user can query but only root can change associations. Exit status is 0 on success and >0 on error. Linux losetup returns 1 for an unconfigured device and 2 for other errors when displaying status. NetBSD vndconfig returns 0 or 1. Source: Solnix lofiadm(8) NOTES, EXIT STATUS; Linux losetup(8) EXIT STATUS; NetBSD vndconfig(8) EXIT STATUS |
Everyday tasks
| Task | Solnix | Linux | FreeBSD | OpenBSD | NetBSD |
|---|---|---|---|---|---|
| attach a file as a block device | lofiadm -a file [device] | losetup -f --show file | mdconfig -a -t vnode -f file (or mdconfig file) | vnconfig [vnd_dev] image | vndconfig vnode_disk regular_file |
| attach read-only | lofiadm -r -a file | losetup -r -f file | mdconfig -a -t vnode -o readonly -f file | — | vndconfig -r vnode_disk regular_file |
| detach | lofiadm -d file|device | losetup -d loopdev | mdconfig -d -u unit | vnconfig -u vnd_dev | vndconfig -u vnode_disk |
| list associations | lofiadm | losetup -l | mdconfig -l | vnconfig -l | vndconfig -l |
| find the device used by a file | lofiadm file | losetup -j file | mdconfig -l -f file | — | — |
| force detach of an in-use device | — | — | mdconfig -d -u unit -o force | — | vndconfig -u -F vnode_disk |
Standards
- POSIX: lofiadm is not a POSIX.1-2024 utility.
Writing portable scripts
- Wrap attach, detach and list in a function that branches on which tool exists (lofiadm, losetup, mdconfig, vnconfig, vndconfig). Do not reuse flags across them:
-a,-c,-rand-smean different things. - On Solnix, pass lofiadm an absolute file path. The page says file names must be valid absolute pathnames.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.