INSTALLING SLACKWARE64-CURRENT ON BTRFS SUBVOLUMES ================================================== This is a short recipe for installing Slackware64-current with Btrfs subvolumes using the normal Slackware installer. The basic layout is: @ / @home /home Both subvolumes share the free space of one Btrfs filesystem; no separate /home partition is required. Optional @tmp and quotas are covered at the end. WARNING: partitioning and filesystem creation destroy data. Confirm the target disk with lsblk before running any destructive command. For clarity, use three virtual consoles during the installation: Console 1 (Alt-F1) this document, mounted at /doc Console 2 (Alt-F2) commands and checks Console 3 (Alt-F3) setup If this document is on a USB drive, identify its partition first. Do not assume that the USB drive is /dev/sda or /dev/sdb: lsblk -o NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS mkdir -p /doc mount /dev/sdX1 /doc less /doc/README_BTRFS.TXT Replace /dev/sdX1 with the actual USB partition. Do not mount the whole disk when it has a partition table. Keep setup open in Console 3 while running the required checks in Console 2. Return to Console 3 only after the checks have succeeded. 1. BOOT THE INSTALLER AND IDENTIFY THE DISK ------------------------------------------- Boot the Slackware64-current installer and log in as root. Check the boot mode and available disks: test -d /sys/firmware/efi && echo UEFI || echo Legacy lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS Use the whole disk name with cfdisk, not a partition name. For Legacy/BIOS on /dev/sda, create an MBR/DOS partition table: cfdisk /dev/sda /dev/sda1 swap /dev/sda2 remaining space for Btrfs For UEFI/GPT on /dev/nvme0n1, use cfdisk and select a GPT partition table: cgdisk /dev/nvme0n1 /dev/nvme0n1p1 512 MiB or larger EFI System Partition /dev/nvme0n1p2 swap /dev/nvme0n1p3 remaining space for Btrfs Use the corresponding /dev/sda names for a SATA disk. Confirm the result: lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS Switch to Alt-F2 and set the variables for your layout. Keep Alt-F2 for all manual commands in this guide. Run only setup on Alt-F3; variables defined in one console are not available in the shell on another console. Legacy/MBR: SWAP=/dev/sda1 ROOT=/dev/sda2 UEFI/GPT on NVMe: EFI=/dev/nvme0n1p1 SWAP=/dev/nvme0n1p2 ROOT=/dev/nvme0n1p3 Adapt the device names to your disk (for UEFI/SATA, use /dev/sda1, /dev/sda2, and /dev/sda3 respectively). 2. FORMAT THE FILESYSTEMS ------------------------- Verify the variables before continuing: printf 'EFI=%s\nSWAP=%s\nROOT=%s\n' "$EFI" "$SWAP" "$ROOT" For Legacy, EFI will be empty. Format the Btrfs partition now. The Slackware installer will format and activate swap in ADDSWAP: /sbin/mkfs.btrfs -f -L SLACK_ROOT "$ROOT" For UEFI, also format the EFI System Partition: mkfs.fat -F 32 -n SLACK_EFI "$EFI" 3. CREATE THE SUBVOLUMES ------------------------- Mount the Btrfs top-level subvolume and create @ and @home: mount -o subvolid=5 "$ROOT" /mnt /sbin/btrfs subvolume create /mnt/@ /sbin/btrfs subvolume create /mnt/@home Make @ the default subvolume: /sbin/btrfs subvolume set-default /mnt/@ /sbin/btrfs subvolume get-default /mnt The last command must show the ID and path of @, not ID 5 (FS_TREE). This is required because the unmodified Slackware installer mounts the selected partition without subvol=@. Unmount the top-level subvolume: umount /mnt 4. RUN THE NORMAL SLACKWARE INSTALLER -------------------------------------- Switch to Alt-F3 and run: setup In ADDSWAP, select the swap partition and let setup format it. In TARGET, select the Btrfs ROOT partition and choose not to format it. Do not skip TARGET: even though the filesystem is already prepared, setup needs this step to mount /mnt and record the root partition for installation and the initial fstab. The root entry will be corrected in the next section. After TARGET and before installing packages, switch to Alt-F2 and remount /mnt with compression: mount -o remount,noatime,compress=zstd /mnt findmnt -no SOURCE,FSTYPE,OPTIONS /mnt Continue only when the output shows subvol=/@ and compress=zstd (possibly with a level, such as zstd:3). Then return to Alt-F3. Adding compression to fstab later does not compress files already installed. Do not select ROOT as a second target for /home. The installer does not know that @ and @home are separate subvolumes in one partition. For UEFI, let setup detect and mount the EFI System Partition at /boot/efi. Configure the bootloader normally. Bootloader details are outside this guide. 5. MOUNT @HOME AND FIX /ETC/FSTAB --------------------------------- After installation and configuration, exit setup and choose Shell instead of Reboot. Return to Alt-F2, where ROOT was defined. With the installed root still mounted at /mnt, mount @home: mkdir -p /mnt/home mount -o noatime,compress=zstd,subvol=@home "$ROOT" /mnt/home findmnt /mnt/home Edit the fstab of the installed system, not the installer environment: vi /mnt/etc/fstab Replace the Btrfs root entry generated by setup and add the /home entry: Legacy/MBR example: /dev/sda2 / btrfs noatime,compress=zstd,subvol=@ 0 0 /dev/sda2 /home btrfs noatime,compress=zstd,subvol=@home 0 0 UEFI/GPT example: /dev/nvme0n1p3 / btrfs noatime,compress=zstd,subvol=@ 0 0 /dev/nvme0n1p3 /home btrfs noatime,compress=zstd,subvol=@home 0 0 Use the actual device names; UUID= entries are also valid. Keep the swap, /boot/efi (UEFI), proc, devpts, and tmpfs entries generated by setup. Avoid duplicate mount points. Verify that the boot configuration selects @, either through the default subvolume or an explicit rootflags=subvol=@ kernel parameter. Regenerate the bootloader configuration if its settings change. 6. VERIFY AND REBOOT -------------------- Check the target, subvolumes, and fstab before rebooting: findmnt /mnt /sbin/btrfs subvolume list /mnt cat /mnt/etc/fstab In fstab, / must use subvol=@ and /home must use subvol=@home. reboot After the first boot, verify: findmnt / findmnt /home findmnt --verify btrfs subvolume list / For UEFI, also check: findmnt /boot/efi 7. OPTIONAL: @TMP AND QUOTAS ---------------------------- Do this only after the basic installation boots successfully. To create @tmp, mount the top-level subvolume and set the permissions required by /tmp: ROOT=/dev/sda2 # Legacy example # ROOT=/dev/nvme0n1p3 # UEFI/NVMe example mkdir -p /mnt/btrfs-top mount -o subvolid=5 "$ROOT" /mnt/btrfs-top btrfs subvolume create /mnt/btrfs-top/@tmp chmod 1777 /mnt/btrfs-top/@tmp umount /mnt/btrfs-top rmdir /mnt/btrfs-top Mode 1777 allows all users to create temporary files while the sticky bit restricts who can delete or rename them. Add this to /etc/fstab, using the actual device name: /dev/sda2 /tmp btrfs noatime,compress=zstd,subvol=@tmp 0 0 Move or remove existing /tmp contents only when no programs are using them, then reboot to mount the new subvolume. Btrfs quotas are optional. These commands enable accounting and display usage; they do not set space limits. Review the performance considerations first: https://btrfs.readthedocs.io/en/latest/btrfs-quota.html btrfs quota enable / btrfs quota rescan -w / btrfs qgroup show / ================================================================== Author: Ricardson Williams ------------------------------------------------------------------ Last Modified: 2026-10-18 20:57:34 UTC