Amiga Unix — 68040 · 68060

Manual pages › System administration commands (1M)

bootswap(1M)

add the swap areas at boot

Package: amxbase, added for amigaux.

bootswap - add the swap areas at boot

/etc/init.d/swap start
/etc/init.d/swap stop

The base package's swap step runs at every boot as /etc/rc2.d/S90swap and at shutdown as /etc/rc0.d/K05swap, in the place of the system's own swap script.

At boot it adds the swap lines of /etc/vfstab (file system type swap), the slices first and then the files, and, as the system's script did, /SWAPFILE and /usr/src/SWAPFILE when they exist (see MORE SWAP, below):

(/dev/dsk/cndnsn) has its length read from the disk's partition table (with /usr/amiga/bin/rdb). The kernel may already swap on the start of the slice: when swap -l lists no area on it, the step adds from block 0; when it lists one area from block 0, the step adds from the next 16-block boundary past it; any other layout is left alone. swap -l counts its blocks in 2 KiB pages, so on a 68040 or 68060 kernel, whose pages are 4 KiB, it lists half of each area; there the step doubles the length it reads. It tells such a kernel by the CPU that heads the build id uname -a shows (68040-..., 68060-...). How far the added area reaches is set by swap_add, below: by default, to the end of the slice.
is added whole.

At shutdown the files are removed first, then every area after the first.

Each area added, and each one the kernel refused, is said on the console and written to /var/adm/rc.log, with the size that was used. An area added smaller than asked, or not at all, because the kernel had no memory for it, is one more line in both places, with the kernel's limit when it is known (one line on the machine):

swap: /dev/dsk/c6d0s2: 445 of 2028 MiB added; the kernel refused more
for want of memory (it takes at most 445 MiB per area with 13 MiB of
pageable memory)

swap -l shows the areas and swap -s the totals; both count 2 KiB pages, so on a 68040 or 68060 kernel both show half the real figures.

In /etc/rc.conf(4):

the sizes to try for a slice, in order; default all. On a kernel without the guard (below) a slice gets 30 whatever the list says, and the console says so: such a kernel is booted as a fallback, with a list set for another. A size is all (to the end of the slice) or a number of MiB counted from the start of the slice, the kernel's own area included, so that 30 means at most 61440 blocks of swap on the slice in all. A size past the end of the slice is the end.
The first size that adds at least 2048 blocks (1 MB) is asked. When the kernel refuses an area for want of memory (ENOMEM), the step steps down, for a file as for a slice: to the largest size below the refused one among the rest of the list and the kernel's own limit (below), and when there is none, to half the refused size, in whole MiB and not under 8 MiB. Each size is tried at most once, a size that ends where another does is the same size, and an area gets 8 tries at most. Any other failure ends the step for that area.

For every area swap -a adds, the kernel needs an array of 16 bytes for each page of the area, in kernel memory. A kernel with the guard refuses an area that does not fit, whole, with ENOMEM (swap prints SC_ADD failed, then swap: Not enough space, and exits 2), and the step steps down from it. A kernel without the guard waits forever on such a request, and the boot with it. The guard is in the kernels from 68030-261101-67 and 68060-261101-56 on; the step tells it by its marker, swg_magic, read with adb from the booted kernel's namelist (echo swg_magic/X | adb -k /stand/unix /dev/kmem prints 53574721), and reads the figures below the same way at the first refusal. The kernel's own area, added at boot, is exempt.

68040/68060 kernel
an area of M MiB is taken only when M is at most maxmem/8, maxmem being the pageable memory in 4 KiB pages (echo maxmem/D | adb -k /stand/unix /dev/kmem): about 445 MiB on a 16 MB machine, 948 on 32 MB, 1955 on 64 MB and 3968 on 128 MB. The array and 1 MiB more must also fit in the kernel's arena, which can refuse less: on a 128 MB machine with two areas already in, about 630 MiB.
68030 kernel
the array must fit in one free run of the kernel's map space and leave a free run of 1 MiB there. From 68030-261106-72 on, an area of M MiB is also taken only when M is at most maxmem/32, maxmem being in 2 KiB pages here: about 222 MiB on a 16 MB machine, 469 on 32 MB and 964 on 64 MB. The map space refuses first on a larger machine. Measured on 68030-261106-72, one area at a time: 192 MiB taken on a 16 MB machine (256 refused), 384 MiB on a 64 MB one (512 refused), and on a 32 MB one its limit, 469 MiB, added at boot. A refusal by the map space takes about 4 seconds.

A list sets what is asked first; on a kernel with the guard the step finds the rest, and the line on the console says what it got. A kernel without the guard, or one whose marker cannot be read (no adb, or a namelist that is not the booted kernel's), gets 30 MiB in all on a slice, which fits any kernel.

One area is at most what the kernel takes (above), whatever the size of the slice. For more swap, make a file of the size wanted, as /SWAPFILE on the root file system or /usr/src/SWAPFILE on /usr, whichever has room for it (df -k); the step adds it at every boot, after the slices, and steps down from it as from a slice when the kernel refuses it. For 128 MiB:

dd if=/dev/zero of=/SWAPFILE bs=1024k count=128
swap -a /SWAPFILE 0 262144

The second line adds it now (its length in 512-byte blocks). What swap -a adds lasts only until the next reboot; the swap step makes it last. Another file, or another slice, can be named in /etc/vfstab with file system type swap.

On a 68030 kernel 68030-261106-72 on a 32 MB machine (maxmem 15021), whose own area is the first 20476 blocks of a 512 MiB slice, with no swap_add line, the step first asks for blocks 20480 to the end (1028096 blocks, 502 MiB); the kernel refuses it, as its limit is 469 MiB, and the step adds 469 MiB (960512 blocks) from block 20480 and says on the console:

swap: /dev/dsk/c6d0s2: 469 of 502 MiB added; the kernel refused more
for want of memory (it takes at most 469 MiB per area with 29 MiB of
pageable memory)

Were 469 MiB refused as well, it would try 234 MiB, its half, and so on down to 8 MiB.

/etc/vfstab
the swap lines.
/etc/rc.conf
swap_add.
/SWAPFILE
/usr/src/SWAPFILE
swap files, added when they exist.
/var/adm/rc.log
what was added and refused.

rc.conf(4), rc.subr(1M), swap(1M)

6 November 2026 amix-base