Part 12 - update Raspberry Pi OS Trixie (2025) and increase swap to 4 GB
Raspberry Pi OS Trixie (2025)
Table of Contents
Expand Swap Using dphys-swapfile (Bookworm and Older).
Expand Swap Using rpi-swap (Trixie and Newer).
Raspberry Pi OS Trixie (2025) or newer, the system uses rpi-swap instead of dphys-swapfile.
rpi-swap is a new package that replaces/deprecates dphys-swapfile for configuring swap on your Raspberry Pi.it is a standard swap management solution, providing better performance and reliability than the old dphys-swapfile approach.
Supports: Compressed RAM swap (zram), file-based swap, or hybrid modes.
Using zram avoids small/frequent writes to /var/swap so as to increase SD card longevity.
Raspberry OS Version
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"
VERSION_CODENAME=trixie
DEBIAN_VERSION_FULL=13.4
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/" System Requirements
Raspberry Pi OS Trixie (2025) or newer
rpi-swap is installed.
Raspberry Pi OS Trixie (2025) uses rpi-swap:
Config Directory: /etc/rpi/swap.conf (drop-in configuration files).
Default Swap Type: Compressed RAM swap (zram).
Default Swap File: /dev/zram0.
Default Size: Up to 2048MB, sized to match RAM (capped at 50% of disk space).
Supports: Compressed RAM swap (zram), file-based swap, or hybrid modes.
rpi-swap
rpi-swap GitHub Repository (Official):https://github.com/raspberrypi/rpi-swap
Modern swap management for Raspberry Pi systems, designed to replace dphys-swapfile with a more flexible and efficient approach.
Check Current Swap Configuration
Check total swap size and usage:
free -h
free -h
total used free shared buff/cache available
Mem: 7.9Gi 5.7Gi 342Mi 2.7Mi 2.0Gi 2.2Gi
Swap: 2.0Gi 2.0Gi 656Ki
Check swap details
cat /proc/meminfo | grep Swap
cat /proc/meminfo | grep Swap
SwapCached: 48 kB
SwapTotal: 2097136 kB
SwapFree: 26944 kB
see where the swap file is located:
swapon --show
swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 2G 0B 100
rpi-swap uses systemd generators so 'rpi-zram-writeback' will not appear in the list of package files.
tree /run/systemd/generator/
tree /run/systemd/generator/
/run/systemd/generator/
├── boot-firmware.mount
├── dev-zram0.swap
├── getty.target.wants
│ └── [email protected] -> /usr/lib/systemd/system/[email protected]
├── local-fs.target.requires
│ ├── boot-firmware.mount -> ../boot-firmware.mount
│ └── -.mount -> ../-.mount
├── local-fs.target.wants
│ ├── systemd-fsck-root.service -> /usr/lib/systemd/system/systemd-fsck-root.service
│ └── systemd-remount-fs.service -> /usr/lib/systemd/system/systemd-remount-fs.service
├── -.mount
├── netplan.stamp
├── rpc_pipefs.target
├── [email protected]
│ ├── fast-symlink.conf
│ ├── no-dependency-cycle.conf
│ └── resize-swap.conf
├── rpi-zram-writeback.timer
├── run-rpc_pipefs.mount
├── sockets.target.wants
│ └── sshd-unix-local.socket -> ../sshd-unix-local.socket
├── [email protected] -> /usr/lib/systemd/system/[email protected]
├── sshd-unix-local.socket
├── swap.target.wants
│ └── dev-zram0.swap -> ../dev-zram0.swap
install/configure rpi-swap (Trixie only):
sudo apt install rpi-swap
sudo reboot
Configuration files are located at:
/etc/rpi/swap.conf
detailed configuration options
man swap.conf
verify that swap has been configured properly:
systemctl list-units --type swap
systemctl list-units --type swap
UNIT LOAD ACTIVE SUB DESCRIPTION
dev-zram0.swap loaded active active rpi-swap managed swap device (zram+file)
Legend: LOAD → Reflects whether the unit definition was properly loaded.
ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
SUB → The low-level unit activation state, values depend on unit type.
1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
References
rpi-swap GitHub Repository (Official):https://github.com/raspberrypi/rpi-swap
Comments
Be the first to post a comment