The Internet slowed down, Xiaomi's router slowed down, and a warning appeared in the web interface about a memory shortage? These are typical symptoms of a crowded device storage. Unlike smartphones, where cleaning the cache is a routine procedure, routers are more complicated: there is no "Clear All" button, and improper actions can lead to loss of network settings or even a device blink.
In this article, we will analyze 7 working methods for cleaning memory on Xiaomi routers (including Mi Router models). 4A, 4C, 5, 6, AX3000, AX6000 You will learn how to delete temporary files, reset logs, optimize firmware and even return factory settings without losing performance.
Before you start cleaning, itβs important to understand what exactly is taking up your routerβs memory. Unlike computers where programs and media are eating space, Xiaomi routers are clogged with memory:
- π Log files of the system (logs of connections, errors, attacks)
- π Firmware cache (temporary update files)
- π‘ Guest network data (connection history)
- π Firewall files (traffic filtering rules)
- π¦ Residual settings after resetting
For example, the Xiaomi router AX3600 firmware MiWiFi_R3600 can accumulate up to 500 MB logs for six months of active use is almost half of the available 1 GB of memory! And it doesn't clean them automatically, which leads to lags and spontaneous reboots.
1. Memory load check: where to watch?
Before you clean, you need to diagnose the problem. Xiaomi routers have two ways to check the memory:
- Through the web interface: Open your browser and enter 192.168.31.1 (or miwifi.com). log in (username and password from the sticker on the router). Go to State β System (or Advanced) β System Tools β System Status for new firmware. Find the Memory Usage block).
- Through SSH (For advanced users: df -h The command will show the partitioning of memory. /overlay β This is the user section that is most often overflowing.
π What's normal? If less than 20 percent of the memory is free, it's time to clean it up. If it's less than 10 percent, the router can start to glitches (Wi-Fi falling off, Web interface slowing down).
| Model router | Total memory capacity | Critical threshold | Recommended minimum |
|---|---|---|---|
| Mi Router 4A/4C | 256MB | < 30MB | 50+ MB |
| Mi Router 5/6 | 512MB | < 60MB | 100+ MB |
| AX1800/AX3000 | 1GB | < 100 MB | 200+ MB |
| AX6000/AX9000 | 2GB | < 200 MB | 400+ MB |
β οΈ Attention: On Xiaomi routers with firmware MiWiFi_RB03 (For example, Redmi Router AC2100) partitions of memory may not be displayed correctly. If the web interface shows 100% Downloads but the router is stable - check through SSH.
2. Cleaning log files: the most secure method
Log files are the router's main garbage collection, and they record everything that happens: device connections, errors. DHCP, Attempts to hack, firmware updates, which can eventually reach hundreds of megabytes, and you can delete them without risking the system, like cleaning a basket on a computer.
Method 1: Through the Web Interface
- Get in Advanced. β System Tools β System Log.
- Press the "Clear Log" button (or "Clear Journal").
- Confirm the action.
Method 2: Through SSH (cleaned)
rm -f /var/log/*
echo "" > /var/log/messagesMethod 3: Automatic cleaning (for OpenWRT-based firmware):
crontab -e
Add a line for weekly cleaning (every Saturday at 3:00):
0 3 6 rm -f /var/log/* >/dev/null 2>&1Make a backup copy of router settings|Record the current Wi-Fi settings (SSID password)|Disconnect important devices from the network during cleaning|Check the vacant space before and after cleaning-->
π‘ Why are logs growing so fast? Xiaomi routers have extended logging enabled by default for diagnostics (10+), journals may be filled in on 50-100 MB per month. You can turn off the detailed recording by the team:
uci set system.@system[0].log_size=64
uci commit
/etc/init.d/log restartβ οΈ Attention: On routers with firmware MiWiFi_R3G (Like Mi Router. 3G) manually cleaning the logs SSH This can cause the web interface to crash, in which case, use only the web method or reboot after cleaning.
3. Reset firmware cache and temporary files
Firmware cache and temporary files (/tmp) They accumulate after updates, plugins or failures. Cleaning them does not remove the settings, but can eliminate lags and errors such as "Inadequate memory for the operation".
Instructions for the web interface:
- Go to Advanced. β System Tools β Reboot.
- Select the option "Clear Cache and Reboot" (if any).
- Wait. 2-3 minutes - the router will restart with cleared cache.
Instructions for SSH:
rm -rf /tmp/*
rm -rf /var/lock/*
syncπ§ What else can you clean? /tmp frequently:
- π Session files (e.g. dhcp.leases)
- π Remains of updates (folders like firmware_update)
- π Traffic statistics (files *.db)
On routers with Padavan firmware (alternative), the cache is cleared automatically when you restart, but sometimes there are tails from plugins left to manually remove them:
find /tmp-name "*.ko" -delete # Removes downloadable kernel modules
find /tmp -name "*.ipk" -delete # Removes packet residuesπ‘
If the router has become slower after cleaning the cache, check the QoS (Quality of Service) settings in the Advanced section. β Bandwidth Control. Traffic priorities may have been reset.
4. Removal of guest network and connection history
Guest network and connected history take up to 100 MB of memory on Xiaomi routers with active use, which is not critical to work, but their accumulation can lead to errors such as βToo many devices connectedβ even with real number of devices within the norm.
How to clean:
- In the web interface go to Advanced β Guest Network.
- Turn off the guest network (if not in use).
- Click on Clear Guest Devices (or Clear Guest List).
- For complete cleaning of connection history, perform through SSH: rm -f /var/dhcp.leases echo "" > /var/dhcp.leases
β οΈ Important: On Xiaomi routers with firmware MiWiFi_R4A (Like Mi Router. 4A Gigabit) cleaning the guest network can reset the main Wi-Fi settings. Write down before the procedure:
- π Name of the network (SSID)
- π Password.
- π‘ Channel and bandwidth
If the guest network is used regularly, set up autoclean through cron:
crontab -e
Clean up every Monday at 4:00.
0 4 1 rm -f /var/dhcp.leases_guest*5. Firmware optimization: removing unnecessary packages
Xiaomi firmware often contains unnecessary components: plugins for IP-TV, Support for outdated protocols, demo services, which can be deleted by freeing up to 300 MB of memory, but beware, removing critical packets will cause the router to fail!
Safe list of packets to remove:
| Package | Description | Can I remove it? | Frees him. |
|---|---|---|---|
| minidlna | DLNA-media-street | Yes (unless you use) | ~50MB |
| samba36-server | SMB-server | Yes (if you don't need to) | ~80MB |
| pppoe-relay | PPPoE Relays (for providers) | No (may break the internet) | β |
| luci-app-qos | QoS (Traffic Control) interface | Yes (unless you use) | ~30MB |
How to remove packages through SSH:
- Connect to the router via SSH.
- Check the list of installed packages: opkg list-installed
- Remove unnecessary package (e.g. minidlna): opkg remove minidlna --force-removal-of-dependent-packages
- Clean up dependent files: opkg autoremove
β οΈ Attention: On Xiaomi routers AX6000 and AX9000 Deleting wireless-tools or hostapd packets will result in Wi-Fi loss. Check dependencies with opkg dependant command before removing them].
How to recover a remote package?
6. Complete reset (hard reset)
If previous methods didn't work, and if there's a critically low amount of free memory, it's going to be a hard reset, and it's going to bring the router back to factory settings, and it's going to delete all the data, including:
- π Wi-Fi settings (name, password, channel)
- π Port configuration and VLAN
- π Firewall and Parental Control Rules
- π Traffic statistics
How to make a hard reset:
- Press and hold the Reset button on the back of the router (10-15 seconds).
- Wait for all the indicators to flash (usually in orange).
- Release the button - the router will restart with factory settings.
π§ Alternative method through web interface:
- Get in Advanced. β System Tools β Backup & Restore.
- Press "Factory Default."
- Confirm the action and wait for the reboot.
β οΈ What to do after a reset?
- π Update the firmware to the latest version (in Advanced) β System Tools β Upgrade).
- π Change the Admin password (by default β admin).
- π‘ Set up Wi-Fi again (name, password, channel).
- π‘οΈ Turn on firewall and update safety rules.
π‘
Hard reset is a last resort.Be sure to save the settings to the file through Backup & Restore before resetting. β Backup.The backup file can be downloaded back after the reset.
7. Alternative firmware: a radical solution
If the router is constantly clogging memory and standard methods are not helping, consider installing alternative firmware, such as OpenWRT or Padavan have more flexible memory management and automatic log cleanup.
The advantages of alternative firmware:
- β Automatic rotation of logs (does not accumulate for years).
- β Removing unnecessary services through the web interface.
- β Advanced cache settings (you can limit the size).
- β Support for external drives (USB-flash drive).
Cons:
- β Installation difficulty (risk of βbrickingβ router).
- β Loss of warranty (if router is guaranteed).
- β No official support from Xiaomi.
How to install OpenWRT on Xiaomi:
- Download the firmware for your model from the OpenWRT website.
- Connect to the router on SSH and do: cd /tmp wget [link to firmware] mtd -r write openwrt*.bin firmware
- Wait for the reboot (5-10 minute).
β οΈ Attention: On Xiaomi routers AX3600 And a newer installation of OpenWRT can lead to loss of support for Wi-Fi 6 due to closed drivers.