If you’re running AdGuard Home or other memory-hungry services on a device like the GL.iNet GL-X3000, you’ve probably hit the dreaded Out of Memory (OOM) errors, especially when using large blocklists like HaGeZi Pro++ or OISD.
Here’s how I gave my router a massive stability boost by converting a 7.5 GB microSD card into a full dedicated swap partition.

Why Add Swap?
With just 512 MB of RAM, the router can easily get overwhelmed. Swap acts as overflow memory, slower than RAM, but far better than crashing and having not internet at all.
What I Used
- GL.iNet GL-X3000 router (OpenWrt 21.02)
- 8 GB microSD card (used ~7.5 GiB for swap)
- LuCI (Web UI) and SSH access
Steps
- Connect to router via SSH
- Install fdisk to re-partition the microSD
opkg update && opkg install fdisk
Code language: Shell Session (shell)
- Use fdisk /dev/sda to
- Delete the existing partition (
d
) - Create a new one (
n
) - Change type to Linux swap (
t → 82
) - Write changes and exit (
w
)
- Delete the existing partition (
- Reboot the router
reboot
Code language: Shell Session (shell)
- Format the new partition as swap
mkswap /dev/sda1
Code language: Shell Session (shell)
- Enable the swap manually
swapon /dev/sda1
Code language: Shell Session (shell)
- Verify it is working
root@GL-X3000:~# free -h
total used free shared buff/cache available
Mem: 491528 212732 123340 1192 155456 261220
Swap: 7863292 0 7863292
root@GL-X3000:~# swapon -s
Filename Type Size Used Priority
/dev/sda1 partition 7863292 0 -2
Code language: Shell Session (shell)
This confirmed that my full 7.5 GB swap partition was active and ready.
- Make it persistent using LuCI
- Opened System → Mount Points → Swap
- Added
/dev/sda1
as a swap device and enabled it - Saved and applied settings

- Double-check again after reboot with free and swapon commands. Same output means swap remains active permanently.
Results
- Stable AdGuard Home with HaGeZi Pro, URLHaus, and more
- No OOM crashes even under high DNS load
- Full 7.5 GB of swap available at all times

Final Thoughts
If you’re running into memory issues on OpenWrt, adding swap with a microSD card is a simple, effective fix. With LuCI and a few commands, your router goes from fragile to rock solid.
PS: If you usually keep your SSH service disabled, do not forget to disable it again afterwards.
Leave a Reply