How to Free Up Storage Space on Your Raspberry Pi (Keep Your System Lean)
Beginner, Other, PiShop, Platforms, Projects, Raspberry Pi, Resources, Skills, Tutorial getting started, raspberry pi, storage, Storage management, Tech, tutorial 1
We can’t imagine anything worse than getting a low storage space warning mid-project setup. Due to most Raspberry Pi setups running on microSD cards, storage space can disappear quite fast because of hidden logs, system chaches, and unused software packages.
If your pi is feeling a bit sluggish or maybe your just running tight on storage, here’s a step-by-step guide on cleaning your file system and reclaiming your storage.
Step 1: Check Your Current Disk Usage
Before we even begin deleting anything, we need to find out how much space we exactly have left and what the bloat is hiding behind. Open your terminal and run the following command
df -h
The df command display disk usage and the -h flag makes it human-readable showing the sizes in GB and MB instead of raw bytes. You’ll be looking for a line that says /dev/root or has a single / under the mounted on column.
Step 2: Clean the Package Manager Cache
Everytime something is installed or updated using apt, Raspberry Pi OS downloads the installer .deb files and stores them in a cache folder. Over months of use, these files can build up to several hundred megabytes of wasted space. Run these two commands to wipe the cache and remove the obsolete software pieces
sudo apt-get clean
sudo apt-get autoremove -y
- apt-get clean safely deletes the downloaded package archives that you no longer need.
- apt-get autoremove removes old software dependencies that were installed automatically by other programs but are no longer required by anything on your system.
Step 3: Clear Out Hidden System Logs
Linux system keep massive logs of everything happening under the hood. While these logs are pretty helpful for debugging, they can grow out of control if a system service keeps logging a minor error in the background. You can see how much space the system logs are taking by running this command:
journalctl --disk-usage
If it’s taking a few hundred megabytes you use the following command to delete all logs older than 7 days to shrink the storage useage:
sudo journalctl --vacuum-time=7d
Step 4: Find and Remove Massive Files
Still running low? Let’s search the /home/pi directory (or your specific user directory) for the largest folders so you can spot heavy downloads or forgotten video clips.
Run this command to list the largest directories, sorted by size:
du -h --max-depth=1 |sort -hr
This will give you a clear list (e.g. downloads, videos, desktop) and show you exactly where your personal file bloat lives so you can manually delete what you don’t need. Keep in mind this command only shows info on the chosen layer, you might need to cd into the second layer if the bigger file is there.
Upgrade Your Setup if You're Tired of Managing
While running a lean system is a great habit, the ultimate fix for storage anxiety is upgrading your hardware. MicroSD cards are great for getting started, but they aren’t built for heavy, long-term data storage.
If you find yourself constantly running out of space, consider these reliable upgrades:
Go Big on MicroSD: Upgrade to a premium, high-speed 128GB MicroSD Card to give your operating system plenty of breathing room.
The Ultimate Setup (Raspberry Pi 5): Take advantage of the Pi 5’s PCIe interface! Pair an M.2 NVMe SSD with a NVMe SSD HAT for blazing-fast read/write speeds and terabytes of reliable storage.
Conclusion
By running these quick commands once every few months, you can keep your Raspberry Pi running optimally and prevent unexpected crashes during critical projects.
Got a project that requires massive storage? Check out our full range of storage expansions, high-speed cards, and SSD accessories over at the PiShop Africa Store.

2026-07-09 @ 15:11
That’s a really good point about the logs – I’ve definitely wasted a lot of space just letting those accumulate. It’s easy to overlook those hidden bits!