Back to Browse

How to Expand OpenWrt Memory: USB Swapfile Setup Tutorial

228 views
Jan 6, 2026
6:41

Original Post: https://letitcode.dev/t/71 If your OpenWrt device has limited RAM, you can prevent Out of Memory (OOM) issues by setting up a swapfile on a USB disk. This setup is essential for maintaining stability when running heavy services like Docker on hardware with restricted memory. In this video, we walk through: • Creating and formatting a 512MB swapfile using the dd and mkswap commands. • Setting secure permissions and tuning swappiness to ensure your router prefers physical RAM whenever possible. • Automating the process with a custom init script that handles late USB mounting via mountd, ensuring your swap space is ready after every reboot. • Best practices, such as why you should use USB 3.0 storage for better stability and why a swapfile is more flexible than a dedicated partition. Using a swapfile is like having an overflow tank for your router's memory; while it won't make the system faster, it provides a crucial safety net to keep your services from crashing when the main "tank" is full

Download

0 formats

No download links available.

How to Expand OpenWrt Memory: USB Swapfile Setup Tutorial | NatokHD