Under the hood
Follow Slax from its boot files to a writable desktop, with OverlayFS and DynFileFS along the way.
Slax directory structure
The Slax system lives in a directory called slax on the boot medium. The boot files get things started,
and the compressed .sb modules contain the actual operating system. Here is a simplified view;
directories are red, and files are in italic.
Optional directories may be empty or created when needed. The ISO also includes the standard EFI/BOOT
loaders and a small EFI boot partition. Slax Installer copies the system files and sets up booting
for the selected USB drive or disk. On a supported UEFI system, it can use the existing EFI partition
while keeping the existing system’s boot files. The four base modules and any additional modules live
inside /slax/modules/.
Booting the Linux kernel
When the computer starts Slax, its BIOS or UEFI firmware runs GRUB 2. On a UEFI system with Secure Boot enabled, the signed shim, GRUB and Linux kernel provide the verified boot path.
GRUB reads its configuration from /slax/boot/grub.cfg and shows the Slax logo with a short countdown.
Press Enter to start immediately, or Esc to open the full menu. The selected entry tells GRUB which kernel,
initial filesystem and boot parameters to load.
Two files are loaded into memory: vmlinuz, the Linux kernel, and initrfs.img, the small
filesystem used to prepare Slax. GRUB then hands control to the kernel.
Pre-init
Slax has no ordinary installed root filesystem to mount at this point. Instead, the kernel unpacks
initrfs.img, a compressed CPIO archive, into its initial in-memory root filesystem and runs
the /init script found there. It contains just enough tools and drivers to locate the rest of Slax.
Escaping initramfs
This early root cannot be used directly with pivot_root, which Slax needs later. The
transfer_initramfs function copies the small environment to a new tmpfs mount at
/m, uses switch_root to move into it, and restarts the init script there.
Everything is still in memory; the full desktop has not been loaded yet.
The stars mark the same tmpfs mount before and after switch_root. This temporary root makes
the later pivot_root possible, once Slax has assembled its complete system.
Next, it mounts /proc and /sys, creates device nodes and loads the drivers needed for
storage, SquashFS and OverlayFS. Early storage support includes VirtIO, Intel VMD, device-mapper and
VMware, Hyper-V and Xen devices, with common USB/HID and Apple SPI keyboard drivers for boot menus. The graphical splash keeps this work out of the way; Esc reveals the boot log.
Finding Slax data
The early system now looks for the slax directory. GRUB passes the identity of the filesystem it
booted from, so that medium is tried first. An explicit from= parameter can select a different
directory or ISO. Other detected storage is searched if necessary.
Once the directory is found, Slax prepares the selected changes store, if any. With toram,
it also copies the Slax data into memory. It then mounts the base modules and additional modules from
modules/ as read-only SquashFS filesystems under /memory/bundles/.
A module is not unpacked into a second copy of all its files. SquashFS decompresses the parts that are read,
while the original .sb stays compressed. A typical USB boot now looks roughly like this:
Each solid or dotted route links a compressed .sb file to its own read-only SquashFS mount.
The files stay compressed on the boot medium; their contents are read through the loop mounts.
ISO-file and copy-to-RAM boots use different data locations, but the same module-to-mount relationships.
Helper mounts and uninteresting files are omitted.
Putting it together with OverlayFS
The modules contain separate pieces of the operating system. During boot, OverlayFS combines them at
/memory/union. This mount becomes the live root (/), so applications see a single
filesystem containing /etc, /usr, /root, and everything else they expect.
The SquashFS mounts are the read-only lowerdir layers. When modules supply the same file,
the highest-numbered module wins. The writable upperdir at /memory/overlay/changes
takes priority over all of them. OverlayFS keeps its internal workdir beside it at
/memory/overlay/workdir. Both directories share the same mount, either the initramfs tmpfs
or the XFS filesystem inside the saved-changes container.
The solid and dotted lines show the lower layers feeding into the union. The double line shows the writable
upper layer. After Slax switches to the live root, its files are directly accessible at
/run/initramfs/memory/overlay/changes. Boot records this path in
/run/initramfs/memory/storage/upper, which savechanges reads. The XFS mountpoint
is recorded separately in storage/changes for storage management.
Changes
The writable upper layer makes the desktop behave like an ordinary installed Linux system. New files go there. Before a lower-layer file is modified, OverlayFS copies it into the upper layer; this is copy-up. Deletions are recorded there too, hiding the original read-only files.
Without persistence, /memory/overlay/changes and /memory/overlay/workdir are in
tmpfs and disappear at shutdown. With persistence, /memory/overlay is the loop-mounted
XFS filesystem supplied by DynFileFS. Both OverlayFS directories remain on that same filesystem.
Slax uses this container layout on all supported backing filesystems, including ext4. It does not use
native Linux directories as a separate persistence mode. One store and its saved-state history live
directly under slax/changes/ on the selected drive; the compressed base modules are unchanged.
Persistent storage with DynFileFS
DynFileFS presents a virtual Linux disk backed by ordinary files. This works on FAT32, which cannot
directly store Linux permissions and links and limits individual file sizes, and on supported Linux
filesystems too. Inside slax/changes/, changes.dat holds metadata, numbered
parts hold payload data and changes.dat.snapshots/ holds saved-state metadata.
DynFileFS exposes virtual.dat through FUSE; the loop device and XFS turn that file into
Linux files for OverlayFS. The FUSE mount at /memory/changes.dfs and the XFS mount at
/memory/overlay are separate. After the root switch, both are under
/run/initramfs/memory/.
Slax derives virtual capacity from the backing filesystem, rounds it up and retains an already larger
stored size. It grows XFS after mounting. Files allocate blocks on demand, with Slax’s 4,000 MiB
data parts staying below FAT32’s per-file limit. This logical capacity does not reserve real space;
the drive’s actual free space remains the limit. There is no perchsize= override.
Saved states and retention
Saved states share unchanged blocks rather than copying the whole virtual disk. DynFileFS keeps their identities and ancestry in a history tree. Slax retains four recent automatic states and keeps named and protected states. Discarding a run suppresses its automatic end state, while an explicitly named state remains available.
Restoring selects a saved image before persistent writes begin. Slax can first retain the state being left, reusing an identical saved state where possible; existing branches remain available. Read-only saved-file views expose a saved filesystem root through the base modules and that state’s changes. Deleting states releases blocks no longer referenced by retained history. Backing files reuse those blocks instead of shrinking, and individual deletion estimates are not additive.
Current DynFileFS upgrades format-500 storage automatically. Slax can import the previously selected
numbered DynFileFS session into the direct slax/changes/ store, leaving other sessions in
place. An imported history may lack a clean Initial state. Back up the complete inactive changes
directory, including snapshot metadata. See Persistent changes
for the backup and recovery workflow.
Switching to the real root
Once OverlayFS is ready, Slax copies the contents of rootcopy/ into the combined root, prepares
the mount configuration, and runs rootcopy/run/preinit.sh if supplied. The writable filesystem
at /memory/union is now ready to become the real /.
The early init uses pivot_root to make that switch, keeping its small tmpfs environment at
/run/initramfs. Finally, it executes the real /sbin/init, which starts systemd,
services and the desktop. The blue stars mark the same temporary tmpfs root before and after the switch; the green stars
mark the OverlayFS filesystem becoming the new root. The original mountpoint at
/run/initramfs/memory/union is left empty.
That is why helper mounts remain under /run/initramfs/memory/ after you reach the desktop.
Boot also retains boot.log, livedbg and from.log under
/var/log/. The generated /etc/fstab and /media catalogue are rebuilt
at startup; a one-off mount or an edit to that generated fstab is not a permanent mounting policy.
Adding modules at the next boot
To include another module, copy its .sb file into /slax/modules/ in the Slax data
directory you boot from. The next startup finds it, mounts it alongside the base modules and includes it in
the OverlayFS stack. Removing the module from that directory leaves it out of the following boot.
On read-only media, add the module while creating a new ISO. The current Slax does not change module layers
inside a running session; you can still install applications immediately with apt.
See Customize & modules for examples.
Network boot and custom images
pxe [INTERFACE] serves Slax over DHCP, TFTP and HTTP to BIOS and UEFI clients. UEFI network
boot uses the bundled signed shim and network GRUB, supporting Secure Boot. Run it only on a network
where providing DHCP is intended. HTTP ISO boot can instead use
from=http://server/path/slax.iso ip=dhcp.
Generated hybrid ISOs use ISO 9660 level 3, allowing individual files larger than 4 GiB, including large SquashFS modules. The output still needs a destination filesystem able to store the resulting ISO. See Customize & modules for making an image.
Slax shutdown
At shutdown, systemd stops applications and services and unmounts ordinary filesystems. Slax then returns
to its small initramfs environment and runs /run/initramfs/shutdown. This lets it finish after
the desktop and its root filesystem are no longer needed.
The shutdown script releases the OverlayFS root, module loop mounts and remaining storage mounts. For a DynFileFS-backed store, XFS is unmounted before its virtual disk and FUSE backing mount are released. The computer can then power off or reboot. Physical optical media may be ejected; virtual CD/DVD media stay attached in a virtual machine.