Close Menu
    What's Hot

    How to Auto Start a Program on Raspberry Pi? (4 Ways)

    8 September، 2024

    List of Best Hacking Software For Windows, Linux, and Mac OS X

    7 September، 2024

    The rpm command

    20 December، 2022

    Copy virtual machine to the new host

    20 December، 2022
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    keepuptechnologykeepuptechnology
    • Home
      • Linux
      • Network
      • raspberry pi
      • mqtt
      • esp8266
    • Linux

      List of Best Hacking Software For Windows, Linux, and Mac OS X

      7 September، 2024

      The rpm command

      20 December، 2022

      Copy virtual machine to the new host

      20 December، 2022

      Remove password from Virtual Machine Manager on Linux

      20 December، 2022

      How to create FAT32 USB drive on Linux

      20 December، 2022
    • Network

      Wifi Pineapple Mark V on TP-Link MR3020

      10 September، 2022
    • IOT
      • esp8266
      • mqtt
      • raspberry pi
    • All
      1. IOT
      2. raspberry pi
      3. Linux
      4. View All

      How to Auto Start a Program on Raspberry Pi? (4 Ways)

      8 September، 2024

      How to Install VMWare ESXi on a Raspberry Pi? (Step by step)

      20 December، 2022

      Getting started with Proxmox on Raspberry Pi (Virtualization server)

      20 December، 2022

      How To Create USB Rubber Ducky With Raspberry Pi Pico

      24 November، 2022

      How to Auto Start a Program on Raspberry Pi? (4 Ways)

      8 September، 2024

      How to Install VMWare ESXi on a Raspberry Pi? (Step by step)

      20 December، 2022

      Getting started with Proxmox on Raspberry Pi (Virtualization server)

      20 December، 2022

      How To Create USB Rubber Ducky With Raspberry Pi Pico

      24 November، 2022

      List of Best Hacking Software For Windows, Linux, and Mac OS X

      7 September، 2024

      The rpm command

      20 December، 2022

      Copy virtual machine to the new host

      20 December، 2022

      Remove password from Virtual Machine Manager on Linux

      20 December، 2022
    • Contact Us
    Subscribe
    keepuptechnologykeepuptechnology
    Home » How to Free Disk Space on Raspberry Pi OS? (Desktop or Lite)

    How to Free Disk Space on Raspberry Pi OS? (Desktop or Lite)

    0
    By admin on 30 October، 2022 raspberry pi
    Share
    Facebook Twitter LinkedIn Pinterest Email

    SD cards sizes are not (yet) unlimited. If you have a small SD card or are trying many things, you’ll probably run out of space quickly.
    In this tutorial, I’ll show you how to find what takes up space on your SD card and how to remove it when possible.

    The best way to free up space on Raspberry Pi is to uninstall pre-installed applications that are not used. For example, Wolfram is taking almost 1 GB on the SD card on a fresh installation of Raspberry Pi OS.

    You’ll find two parts in this guide, one for each Raspberry Pi OS version (Desktop or Lite).
    You can absolutely follow the Raspberry Pi OS Lite procedure on Desktop if you prefer.

    Free disk space on Raspberry Pi OS with Desktop

    On the desktop version of Raspberry Pi OS, there are a few tools that can be installed to quickly find what use the most disk space on the SD card. The procedure will look like this:

    • Install a tool like Baobab to find the largest files on the SD card.
    • Remove the corresponding files when possible.
    • Uninstall the unnecessary applications that take too much space.

    Find the large files on Raspberry Pi OS with Desktop

    If you have a desktop environment, you are lucky, no need to use command lines, we can install a tool to help us find the large files on the system. A tool I like, with a name easy to remember, is Baobab.

    Install Baobab

    • You can install it graphically by going into the Main Menu > Preferences > Add/Remove Software.
    • Type “baobab” in the search engine on the left.
    • Check the box corresponding to the Baobab package.
    • Click “Apply” to install it.
      Enter your password to confirm the installation.

    That’s it! Baobab is ready to use.

    Start and use Baobab (Disk Usage Analyzer)

    The tool is now available in the Main menu:

    • Open the software by clicking on System Tools > Disk Usage Analyzer.
    • Select the folder to scan (probably /, so the second one).
    • The software will scan your SD card and display the results with a chart like this:


    • On the left, you can see a list of the folders in the selected path (/ in my example).For each folder, you have the total size in the second column. And you can click on the left arrow to browse inside each folder and see the details.
    • On the right, there is a graphical visualization of the SD card usage.
    • If you prefer, you can click on the icon under the graphic to switch to an alternate view:


    • This allows you to quickly locate the largest folders on your SD card.
    • For example, in my case I see that opt is taking up over 1 GB, and I have no idea what it is.
    • By opening this folder, I can see that “Wolfram” is installed.



    If I don’t need it, I can uninstall it and save 1 GB.

    Remove files and packages to free up space

    Once you know what is taking too much space on your SD card, you can analyze it and remove any unnecessary files.

    How to remove files on your Raspberry Pi

    The first possibility is to remove files completely.
    For example, you may have old files in your Downloads folder.

    To do this, open the file explorer, go to Downloads and remove the unneeded files (press DEL or do a right-click > Move to Wastebasket).
    Don’t forget to empty the wastebasket on the desktop after doing this.

    Click on Move to wastebasket

    Note: If you don’t have the permission to remove a file, you can use the command I gave in the Raspberry Pi OS Lite part. Just open a terminal and type the commands.

    How to remove applications on Raspberry Pi OS

    It can also be that you install too many packages that you don’t eventually use.
    For example, Wolfram is a package installed by default on Raspberry Pi OS.

    If you don’t need the files, you can remove it in the Add/Remove Software tool.

    I already wrote a tutorial about this topic. If you need help, check it out here: How to uninstall programs on Raspberry Pi?.

    That’s it for Raspberry Pi OS Desktop. Basically, finding the biggest files and removing them should do the trick (either directly or via the add/remove software tool if it’s an app).

    Free disk space on Raspberry Pi OS Lite

    On Raspberry Pi OS Lite, you don’t have a fancy graphical tool to find and remove files the same way :).
    But you can use many commands that will often be faster to use, if you know how to use them.

    Find the largest files with a command line

    There are several commands that can be used on Raspberry Pi to find what take space on the SD card:

    • df: to show the disk usage summary.
    • du: to get the disk usage for a specific folder.
    • tree: to analyze the sub-folders.
    • find: to list the biggest files.

    Disk usage

    The first command you’ll probably need, is “df”.

    df is a tool that you can use to display the disk summary.
    It will show you a list of partition with several columns:

    • Filesystem: basically the partitions, on Raspberry Pi you have generally / and /boot
    • 1K-blocks: It represents the total size available on this partition
    • Used: the disk space currently used
    • Available: the available disk space
    • Use%: the percentage of use
    • Mounted on: the real location of the partition on the system

    To get a more readable display, you can add the -h option like this:

    If you want, you can also specify the partition, like this:
    df -h /

    Analyze sub-folders

    Once you know what is the partition to analyze, you can go deeper, and check folder by folder.
    To do this, you can use the “tree” command:
    tree -dh --du

    Don’t forget to use “sudo” in system directories

    It’s not perfect. If you have many folders and subfolders, it can be difficult to find the biggest folder which may be an issue.
    But, it’s a good tool that you can use once you know approximately where the problem is.

    The next command may help you find the specific folder to analyze.

    Find the biggest files in a specific folder

    Ok, it’s a warrior command here, but it’s very useful.
    I’m using it almost every week, and I’ve saved myself a lot of time since I’ve known it.
    So, I’ll share it with you here.

    “du” is a popular command on Linux to list all the files and folders in a specific folder.
    The problem is almost the same as with “tree”, as you will need to scroll many files to find what you are looking for (and the display is not optimal).

    Anyway, the idea here is to combine 3 commands:

    • du: to display all the files and folder.
    • sort: to sort the result by size.
    • head: to display only the top 100 of the biggest files.

    The command looks like this:
    du -ak | sort -nr | head -100

    And the result is perfect:

    You can use it on the entire partition
    Same thing, you need to use sudo to get all the information

    At the top, you have the biggest files and folders.
    Then, they are sorted by size.

    At a glance, you can see that Wolfram, Chromium and LibreOffice are taking a lot of space.
    If you don’t need the files, uninstall them :).

    Find files by names or sizes

    Finally, the last command I use regularly is “find”.
    Like the name suggests, “find” is a command to search for specific files your system.

    Here are a two command options you can try:

    • Search for files larger than X:
      find <path> -size +<size>
      Example: find /home/pi -size +100M
    • Search for files with a specific extension:
      find <path> -iname *.<extension>
      Example: find /home/pi -iname *.mkv

    As usual, use “sudo” if you want to search on the entire SD card.

    Remove them

    Once you know which files are taking too much space, you can remove them if you don’t need them.

    Remove the file

    The first idea is to remove the files.
    Basically, you can delete all the files in your user folder, if you don’t use them.

    The command to do this is:
    rm <file> or rm -rf <folder>
    Example:
    rm /home/pi/Pycharm.tar.gz

    Even if it’s not recommended removing system files like this, don’t forget to add sudo at the beginning to remove a file where you don’t have the permission. For example:
    sudo rm /var/log/syslog.1

    Uninstall a package

    The second option is to uninstall a package.
    You can use apt to do this
    , for example:
    sudo apt remove openjdk-11-jdk

    If you have any question about this, you can check my tutorial on how to uninstall packages.

    Clear the apt cache

    And the last one is a bonus, that can often save you from a full SD card issue.

    When your SD card is full, you can’t use most of the previous commands.
    They need a minimum disk space to run (for example the “du” command uses a cache file to store all the results before sorting it by size).

    What you can often try, is to remove the apt cache.
    When you install a package, Raspberry Pi OS will download it locally before installing it.

    Here is the command to remove all this temporary files:
    sudo apt-get clean

    And here is the result:

    I just save 700M in two seconds :).

    What to do if nothing works?

    Generally, you will find a solution by using all the techniques and commands I gave you in this tutorial.
    But sometimes, it’s just not possible to save enough space on the disk.

    If you are using too much of your SD card, you may need to consider changing it to a bigger one.

    How to I check free space on my Raspberry Pi?

    On a Desktop version, open a file explorer and click on “Filesystem root” on the top left of the screen. The available disk space will be shown in the bottom-right corner. Another solution is to use the command “df -h” and look at the “Avail” column.

    How big of a SD card do I need on Raspberry Pi?

    As a general rule, an 8 GB SD card is the minimum requirement to install Raspberry Pi OS. If your usage implies to install heavy applications or to store big files, a 32 GB SD card should be enough in most cases.

    Conclusion

    That’s it! You now know how to solve your disk space issue on Raspberry Pi.
    Most of the time, some cleaning will be enough to find a solution.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram Email
    Previous ArticleHow to Uninstall Programs on a Raspberry Pi? (Free up space)
    Next Article The Ultimate Guide to Backup and Restore your Raspberry Pi
    admin
    • Website

    Related Posts

    How to Auto Start a Program on Raspberry Pi? (4 Ways)

    8 September، 2024

    How to Install VMWare ESXi on a Raspberry Pi? (Step by step)

    20 December، 2022

    Getting started with Proxmox on Raspberry Pi (Virtualization server)

    20 December، 2022
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Subscribe to Updates

    Get the latest sports news from SportsSite about soccer, football and tennis.

    Keep Up Technologies. Articles and topics to keep up with computer science and technology
    We're social. Connect with us:

    Facebook X (Twitter) Instagram Pinterest YouTube
    Top Insights
    Get Informed

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    © 2025 Makrof. Designed by Makrof.

    Type above and press Enter to search. Press Esc to cancel.