Raspberry Pi OS Trixie (2025) 

 

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.

Supports: Compressed RAM swap (zram), file-based swap, or hybrid modes.

Raspberry Pi OS Trixie (2025)  uses rpi-swap:

Config Directory: /etc/rpi/swap.conf (drop-in configuration files).

Default Swap File: /var/swap.

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.

 

 

Check Current Swap Configuration

 

Check total swap size and usage:

free -h

free -h
               total        used        free      shared  buff/cache   available
Mem:           7.9Gi       4.3Gi       1.1Gi        17Mi       2.6Gi       3.6Gi
Swap:          511Mi       1.0Mi       510Mi

 

Check swap details

cat /proc/meminfo | grep Swap

 

cat /proc/meminfo | grep Swap
SwapCached:          432 kB
SwapTotal:        524272 kB
SwapFree:         523248 kB

 

see where the swap file is located:

 

swapon --show

 swapon --show
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition   2G   0B  100

 

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'.

 

 

 install/configure rpi-swap (Trixie only):

sudo apt install rpi-swap
sudo reboot

 

/etc/rpi/swap.conf

 

Comments

Be the first to post a comment

Post a comment