How to Fix Free Space Not Showing After Removing Packages in OpenWrt?

How to Fix Free Space Not Showing After Removing Packages in OpenWrt

Sometimes in OpenWrt you remove a package and expect free space to jump back instantly… but nothing changes. The storage bar in LuCI looks the same, and df -h shows almost no difference. This can be frustrating, especially on routers with small flash memory.

In this guide, I’ll explain why this happens and what’s going on inside the system. We’ll talk about how OpenWrt stores files, why removing packages doesn’t always free up space, and how to check your device’s storage before you try fixes.

How OpenWrt Stores Files?

OpenWrt isn’t like a normal desktop system where uninstalling a program frees space right away. It uses a read-only SquashFS image for its base firmware. That’s where built-in packages live.

On top of that, there’s OverlayFS, which adds a writable layer (stored in flash as JFFS2 or UBIFS) where your settings, installed packages, and downloaded files go. When you remove a built-in package, OpenWrt doesn’t delete it from SquashFS — it can’t. Instead, it adds a small “whiteout” marker in the overlay to hide it. The original data still exists in the read-only image, so your free space doesn’t change.

The only space you can reclaim is in the overlay. And on many routers, that’s just a few megabytes.

Signs That Free Space Is Not Updating in OpenWrt After Package Removal

Free Space Is Not Updating in OpenWrt After Package RemovalA lot of users see this: they run opkg remove on several packages, reboot, and still have 95–98% flash usage. That’s because most of what you “removed” was in SquashFS, not the writable overlay.

You might also notice that /tmp looks empty, but it doesn’t affect flash space because /tmp is in RAM. The space that matters is /overlay. Even then, a small gain in free space might be too small to see in LuCI, especially if it rounds the numbers.

Why Free Space in OpenWrt Stays the Same After Uninstalling Packages?

There are a few reasons why free space doesn’t change after removing packages in OpenWrt.

  • Built-in packages are stored in the read-only SquashFS image, so removal only hides them with whiteouts.
  • Configuration files, logs, and app data in /overlay/upper still take up flash space even if the package is gone.
  • Dependency packages remain unless removed with opkg autoremove.
  • Metadata in /usr/lib/opkg/info can still use storage.
  • Checking the wrong space (RAM instead of flash) can make it seem like nothing changed.
  • Extroot setups that aren’t mounted properly can cause misleading results.
  • On JFFS2 or UBIFS, garbage collection might delay space recovery until after a reboot.

How to See What’s Really Using Space?

Before you try any fix, it’s better to know exactly what’s eating up your writable flash. That way, you don’t wipe your whole overlay for no reason.

To check usage:

  • Run df -h /overlay to see how much space you have.
  • Use du -h --max-depth=1 /overlay/upper to spot large directories.
  • Find big files with find /overlay/upper -size +1M -exec ls -lh {} \;.
  • Check mounts with mount to confirm you’re using the right storage.
  • List installed packages with opkg list-installed and review details with opkg info <package>.

How to Fix Free Space Not Showing After Removing Packages in OpenWrt?

When the free space on your OpenWrt router doesn’t change after removing packages, it’s usually because of how the SquashFS and OverlayFS layers work. The key is figuring out whether the issue is from leftover configuration files, cache, or delayed cleanup in the flash filesystem. Start with easier fixes and move up to advanced ones.

1. Reboot the Router

Flash filesystems like JFFS2 and UBIFS don’t always release deleted blocks immediately. Some only free the space when the system restarts. A quick reboot can sometimes make a big difference in what df -h shows.
From LuCI, go to System > Reboot, or in SSH run: reboot

2. Remove Leftover Config and Data Files

Even if you run opkg remove, the package’s data may remain in /etc/var/log, or /overlay/upper. These files take up space even after the main program is gone.

Steps to clear them:

  • Use opkg remove --autoremove <package> so OpenWrt also deletes any packages it depends on that you no longer need.
  • Browse /overlay/upper and remove old folders from uninstalled software.
  • Delete large log files from /var/log if you don’t need them.
  • Check for temporary files in /tmp — while it’s RAM-based, leftover downloads here can be misleading during troubleshooting.

3. Clear Package Metadata

The /usr/lib/opkg/info directory stores .control and .list files for every installed package. When you uninstall something, those files often stay behind unless you remove them manually. Over time, they can pile up. Use rm to delete entries linked to packages you’ve removed.

4. Clean the Package Cache

Every .ipk file you install is downloaded and stored in the package cache. Clearing it out can help when space is extremely tight.

opkg clean

This removes the cached installation files but won’t affect installed packages.

5. Remove Whiteout Files

Whiteout files hide original SquashFS files from the overlay but still consume a tiny amount of flash space. You can find them with:

find /overlay/upper -name ".wh.*"

Removing them frees space, but be careful — this can bring back files you thought were gone.

6. Factory Reset the Router

If your overlay is bloated with years of changes, a full reset will rebuild it from scratch. This wipes all installed packages and settings, so make a backup first.

firstboot
reboot

7. Check and Fix Extroot Mounts

If you use extroot with USB or SD storage and it’s not mounting correctly, OpenWrt will write everything to internal flash instead. Confirm your mount is active by running mount and checking for /overlay pointing to your external device.

8. Reflash Firmware for a Clean Slate

Reflashing loads a new SquashFS image and completely replaces the overlay. Download the correct image from OpenWrt’s official site, then flash it from LuCI or SSH. This is the most effective way to reclaim all available space but requires reconfiguring your router.

When to Contact the OpenWrt Community?

If you’ve tried cleaning configs, removing whiteouts, clearing caches, and even reflashing, yet free space still looks wrong, the problem might be deeper. You could be dealing with bad NAND sectors, overlay mount failures, or a bug in your OpenWrt build.

In that case, reach out to the OpenWrt forums, developer mailing lists, or IRC channels. When you do, share your device model, OpenWrt version, df -h output, and any log entries that look suspicious. That way, experienced users and developers can guide you more effectively.

Tips to Avoid Space Issues in the Future

Flash memory in routers is limited, so using it wisely can help avoid headaches later.

  • Install only the packages you really need and remove extras quickly.
  • Redirect logs to RAM or external storage instead of writing to flash.
  • Clean the package cache after major updates or large installs.
  • Use extroot storage for big packages or media files.
  • Update firmware regularly to reset the overlay and start fresh.
  • Avoid keeping backups or archives on the router’s flash.
  • Monitor space with df -h every so often to catch problems early.

Conclusion

Free space in OpenWrt can be tricky to understand because of how SquashFS and OverlayFS work together. Uninstalling built-in packages won’t shrink the firmware image, but you can still clear the overlay to recover space.

By following these steps, watching your storage habits, and knowing when to ask the OpenWrt community for help, you can keep your router running smoothly without hitting that frustrating “No space left on device” error again.