swap(8) on Solnix vs Linux and the BSDs
swap is the illumos swap administrative interface at /usr/sbin/swap. One command adds (-a), deletes (-d), lists (-l) and summarises (-s) swap areas. Linux uses swapon/swapoff and FreeBSD uses swapon/swapoff/swapctl, so swapctl-style flags do not carry over: swap -a adds one area, and swap -d deletes it.
The manual pages
- Solnix: swap(8) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: swapon(8) util-linux-2.42.3 (different command, similar job)
- FreeBSD: swapctl(8) 15.1-RELEASE (different command, similar job)
- FreeBSD: swapinfo(8) 15.1-RELEASE (different command, similar job)
- OpenBSD: swapctl(8) 8.0 (different command, similar job)
- NetBSD: swapctl(8) 11.0 (different command, similar job)
What Solnix runs
A default Solnix system runs the illumos swap at /usr/sbin/swap. No other variants are shipped. The page says swap areas listed in /etc/vfstab are added at startup by the /sbin/swapadd script.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| all four | command name and structure | Solnix uses a single swap command with -a, -d, -l and -s. Linux uses swapon and swapoff. FreeBSD uses swapon, swapoff and swapctl. OpenBSD and NetBSD use swapctl, with swapon as a compatibility name.Source: Solnix swap(8) SYNOPSIS; Linux swapon(8) SYNOPSIS; FreeBSD swapctl(8) SYNOPSIS; OpenBSD swapctl(8) SYNOPSIS; NetBSD swapctl(8) SYNOPSIS |
| all four | boot-time configuration file | Solnix adds swap areas at startup through /sbin/swapadd, which reads /etc/vfstab. Linux, FreeBSD, OpenBSD and NetBSD read /etc/fstab. Linux skips entries with noauto. OpenBSD and NetBSD use the sw type.Source: Solnix swap(8) -a; Linux swapon(8) -a; FreeBSD swapctl(8) DESCRIPTION; OpenBSD swapctl(8) -A; NetBSD swapctl(8) -A |
| all four | adding all swap from the config file | Solnix swap -a takes a swapname and adds that one area. It cannot add everything from the config file. On Linux, swapon -a adds every swap entry in /etc/fstab. On OpenBSD and NetBSD, swapctl -A does this, and FreeBSD swapctl -A does too. FreeBSD swapctl -a means a specific list of devices.Source: Solnix swap(8) -a; Linux swapon(8) -a; FreeBSD swapctl(8) DESCRIPTION (-a, -A); OpenBSD swapctl(8) -A, -a; NetBSD swapctl(8) -A, -a |
| Linux | removing swap | Solnix removes a swap area with swap -d swapname. Linux uses a separate command, swapoff, and swapoff -a disables all known swap devices. The Solnix page documents no delete-all option.Source: Solnix swap(8) -d; Linux swapon(8) DESCRIPTION, SYNOPSIS (swapoff) |
| FreeBSD, OpenBSD, NetBSD | -d takes a path, with optional swaplow | Solnix swap -d takes swapname and an optional swaplow offset in 512-byte blocks. OpenBSD and NetBSD swapctl -d take only a path. Without swaplow, Solnix deletes starting at the second page.Source: Solnix swap(8) -d; OpenBSD swapctl(8) -d; NetBSD swapctl(8) -d |
| Linux, OpenBSD, NetBSD | swap priority | Solnix swap has no priority option. Linux swapon -p sets a priority from 0 to 32767. OpenBSD and NetBSD swapctl take -p priority, and -c changes the priority of an existing device. FreeBSD says there is no priority mechanism.Source: Solnix swap(8) SYNOPSIS; Linux swapon(8) -p; OpenBSD swapctl(8) -p, -c; NetBSD swapctl(8) -p, -c; FreeBSD swapctl(8) DESCRIPTION |
| FreeBSD, OpenBSD, NetBSD | -l list columns and units | Solnix swap -l prints path, dev, swaplo, blocks and free, in 512-byte blocks. -k gives 1024-byte units and -h scales by 1024. A sixth column shows INDEL while an area is being deleted. The BSD pages document 512-byte default blocks. FreeBSD and NetBSD swapctl also have -m and -g, which Solnix lacks.Source: Solnix swap(8) -l, -h, -k; FreeBSD swapctl(8) -h, -g, -k, -m; OpenBSD swapctl(8) -k, -l; NetBSD swapctl(8) -g, -k, -m |
| Linux | listing and output control | Solnix swap -l and -s are fixed-format. Linux swapon --show has selectable columns, --noheadings, --raw and --bytes. Linux swapon -s is deprecated in favour of --show. The Solnix page documents no equivalent options.Source: Solnix swap(8) -l, -s; Linux swapon(8) -s, --show, --noheadings, --raw, --bytes |
| FreeBSD, OpenBSD, NetBSD | -s summary content | Solnix swap -s reports allocated, reserved, used and available swap in bytes. The totals include physical memory used as swap space, and -h scales them. The BSD pages describe -s only as a single-line or summary line of swap statistics.Source: Solnix swap(8) -s; FreeBSD swapctl(8) -s; OpenBSD swapctl(8) -s; NetBSD swapctl(8) -s |
| all four | swap on regular files and ZFS | On Solnix with ZFS, swap must be a ZFS volume such as /dev/zvol/dsk/rpool/swap. A regular file is not supported for swap on ZFS. A ZFS volume cannot be both swap and dump device on a ZFS root. The other pages do not describe ZFS volumes. Source: Solnix swap(8) -a |
| NetBSD | dump device handling | NetBSD swapctl can set (-D) and show (-z) the kernel dump device. The Solnix swap page documents no dump-device option. It only says a ZFS volume cannot be both swap and dump on a ZFS root.Source: NetBSD swapctl(8) -D, -z; Solnix swap(8) -a |
| all four | exit status | The Solnix swap page has no EXIT STATUS section. Linux documents swapoff codes 0, 2, 4, 8, 16, 32 and 64. OpenBSD swapctl exits 0 or >0. NetBSD swapctl exits 0 or 1, and 2 when -A or -U finds no suitable swap device.Source: Linux swapon(8) EXIT STATUS; OpenBSD swapctl(8) EXIT STATUS; NetBSD swapctl(8) EXIT STATUS; Solnix swap(8) |
Everyday tasks
| Task | Solnix | Linux | FreeBSD | OpenBSD | NetBSD |
|---|---|---|---|---|---|
| add a swap area | swap -a swapname | swapon specialfile | swapon file, or swapctl -a file | swapctl -a path | swapctl -a path |
| remove a swap area | swap -d swapname | swapoff specialfile | swapoff file, or swapctl -d file | swapctl -d path | swapctl -d path |
| add all configured swap at boot | /sbin/swapadd (reads /etc/vfstab) | swapon -a | swapon -a, or swapctl -A | swapctl -A | swapctl -A |
| list swap areas | swap -l | swapon --show | swapctl -l | swapctl -l | swapctl -l |
| swap usage summary | swap -s | swapon -s (deprecated) | swapctl -s, or swapinfo | swapctl -s | swapctl -s |
| human-readable sizes | swap -l -h | — | swapctl -h or swapinfo -h | — | swapctl -l -h |
| set swap priority | — | swapon -p priority | — | swapctl -a -p priority path | swapctl -a -p priority path |
Standards
- POSIX: swap is not a POSIX.1-2024 utility.
Writing portable scripts
- Wrap swap operations in a function that checks which tool exists (swap, swapon/swapoff, swapctl). The flags mean different things:
-aadds one area on Solnix and all fstab entries on Linux. - Do not parse swap
-lor swapon-soutput across systems. Columns, units and headings differ, and Solnix lists sizes in 512-byte blocks unless-kor-his given.
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.