Owners of Raspberry Pi 4s with 2GB of RAM, until now green-eyed and furious with envy at 4-8GB owners running full desktop Ubuntu, can now join Canonical’s party. The trick, as reported by OMG Ubuntu based on an Ubuntu Blog post, is in the compression.
Like many operating systems, Ubuntu uses a swapfile on a computer’s storage system to hold data that won’t fit in RAM. In the case of the Pi, this is often a Micro SD card, not noted as the speediest medium in terms of either read or write performance, unless you buy the best micro SD cards. Enter zswap, a compression tool that intercepts processes about to be sent to the swapfile, and compresses them. Chances are that the newly crunched data can stay in RAM, and it’s much quicker to decompress it than fetch data from the SD card. This trick can even improve performance on 4GB and 8GB Pi boards, including the Pi 400 all-in-one.
The best news is that zswap is already in Ubuntu, there's no need to wait for another release (although it will be enabled by default in 22.04, which should release in April), and a simple one line Bash command is all you need to enable it now.
Stay on the Cutting Edge
Join the experts who read Tom's Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We'll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.
Ian Evenden is a UK-based news writer for Tom’s Hardware US. He’ll write about anything, but stories about Raspberry Pi and DIY robots seem to find their way to him.