Raspberry Pi

Guide to Save Disk Space on Raspberry Pi and Purge Bloat

An SD card is considered as the backbone of the Raspberry Pi device. The unnecessary usage of your SD card may reduce device performance. So, it’s better to remove the unnecessary disk usage to boost up Raspberry Pi’s performance.

In this tutorial, we will guide you in saving your Raspberry Pi disk space by finding the applications that are consuming large space on your device’s SD card so that you can remove them.

How to save disk space on Raspberry Pi and purge bloat

Here, you will find two methods that will help you in identifying those applications or software packages that are utilizing excess space on your disk. You can remove these applications to save disk space on your Raspberry Pi device. However, before moving towards the methods, first you will need to find out the file system on your Raspberry Pi’s SD card using the following command:

$ df -h

From the above output, you can see that 7% of your SD card space is utilized. It may be different in your case. Now, the task is to free up the space to enhance the device performance.

The details of these methods are provided below:

1: Finding the Large Size applications through dpkg command

To find out the information of the large size applications installed on your Raspberry Pi device, you can use the dpkg command to get the list of installed applications.

$ dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n -r | head -n 25

The above command will sort out the applications and provide you with the list of top 25 large size applications in descending order.

Now, if you want to remove the large size application from your Raspberry Pi device, use the purge command as this will completely remove the selected package from your system.

$ sudo apt purge chromium-browser -y

In this way, you can completely remove large size applications from your Raspberry Pi to free up the disk space.

2: Finding the Large Size Applications through Aptitude Utility

Aptitude is a simplified package management utility that will help you in finding the information of those applications that are utilizing large storage space. First, you will need to install this application on your Raspberry Pi device through following command:

$ sudo apt install aptitude -y

After the installation, you can view the list of top 20 application with large size by issuing the following command:

$ aptitude search "~i" --display-format "%p %I" --sort installsize | tail -20

The above command will provide you with the list of large applications in ascending order. You can pick the one you want to remove to free up the disk space on your Raspberry Pi device through the following command:

$ sudo apt purge <application_name> -y

In this way, you can remove several applications or software packages from your Raspberry Pi device that you are not using for a longer time. This will save your disk space and allow the device to provide you with a better performance.

Conclusion

The performance of your Raspberry Pi highly depends on disk space as less disk space slows down the device performance. To save disk space on your Raspberry Pi device, you will have to follow the two methods given in this guide that allow you to remove the unused large size applications from your device completely.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.