Troubleshooting the ‘Disk Full’ Error on Linux Systems

When encountering the Disk Full error on a Linux system, it indicates that the partition being used to write or save data does not have enough space to perform the operation. There are various solutions to troubleshoot this error, which involve either creating more space on the partition or expanding the overall storage capacity. This tutorial will demonstrate how to resolve the Disk Full error and provide some fundamental Linux commands to help identify the issue.

In this tutorial you will learn:

  • How to use the df command to determine which partition is full
  • How to identify largest directories using the du command
  • How to use Disk Analyzer GUI utility to find big directories
  • How to clear the browser and user cache
  • How to resize disk partitions by shrinking or extending them
Troubleshooting the 'Disk Full' Error on Linux Systems
Troubleshooting the ‘Disk Full’ Error on Linux Systems
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Troubleshooting the ‘Disk Full’ Error on Linux Systems




If you encounter the Disk Full error on Linux, there are various ways we can resolve it. The first approach is to remove data from the partition, which will free up space. A second option is to expand the file system and increase the partition’s size. The following steps explain how to carry out this process and remedy the error.

  1. Let’s begin by identifying which partition is full and thus causing the error to occur. The df command along with the -h option will show us a list of our partitions and their current sizes, along with how much room is left on each.
    $ df -h
    
    Executing the df command in terminal
    Executing the df command in terminal

    There are other commands you can use alongside of df. Check out our other tutorial on How to check disk usage by folder on Linux for extra command examples.

  2. Since we know which partition is full from the previous step, we can now proceed to identify which files are consuming the most disk space by using the du command. We will once again supply the -h option to make the sizes very easy to read. We will also pipe our command to sort so we can get a descending list of which directories are consuming the most space.
    $ du -h | sort -h
    415M    ./Gentoo
    671M    ./Arch Linux
    1.9G    ./RHEL-based/Fedora
    6.5G    ./Debian-based/Kali Linux
    9.4G    ./Debian-based/Ubuntu
    11G     ./RHEL-based/AlmaLinux
    14G     ./RHEL-based/CentOS
    17G     ./Debian-based
    27G     ./RHEL-based
    44G     .
    
    OR:
    
    $ du -h --max-depth=1 | sort -h
    415M    ./Gentoo
    671M    ./Arch Linux
    17G     ./Debian-based
    27G     ./RHEL-based
    44G     .
    

    Looking for more examples? See this article: How to check disk usage by folder on Linux.

  3. If you prefer to visualize disk usage through the use of a GUI program instead of executing commands, you can install and use the Disk Usage Analyzer GUI utility. It can be installed as baobab via your system’s package manager.
    Disk Usage Analyzer gives us a breakdown of how the storage is being distributed across our disk
    Disk Usage Analyzer gives us a breakdown of how the storage is being distributed across our disk
  4. One way that we can free up space and resolve the Disk Full error is by clearing the web browser cache. This can often grow to multiple gigabytes of size in very little time. The process will vary depending on your browser, but it is easy to find the option in your browser’s menus.



    Clearing browser cache in Firefox on Linux
    Clearing browser cache in Firefox on Linux

    You can also clear your current user’s general cache with this Linux command:

    $ rm -rf ~/.cache/*
    
  5. Another option is to extend the length of the partition which is out of room. This can only be done if you have unused storage space on the disk or plan to shrink another existing partition and repurpose that space for the partition which is out of room. This process involves use of the parted command and is beyond the scope of this tutorial, so check out our other guide on How to partition a drive on Linux to see how to shrink and extend a partition in Linux.
  6. There is another obvious option which is to simply store your data on a different partition. Once again, you can use the df command to figure out if you have any usable partitions that have free space on them. If so, just save your data to the partition that has some space on it.
  7. The last option is to simply get your hands on more storage. You may need to install a new hard drive, which means physically installing a new disk in the machine, or you can purchase cloud storage or network attached storage. This should only be necessary if you have many important files that you can’t afford to lose and they are consuming all of your current disk space.

Closing Thoughts

In this tutorial, we covered the steps to resolve the Disk Full on a Linux system. These included identifying the partition that was full and causing the error, and determining which files could be safely removed to free up space. Additionally, we explored various alternatives, such as utilizing a different partition for storage, expanding the file system, employing a NAS device, using cloud storage, or upgrading your current hardware with larger disk drives.



Comments and Discussions
Linux Forum