How to Fix Low Disk Space Issues on Ubuntu Linux

How to Fix Low Disk Space Issues on Ubuntu Linux

How to Fix Low Disk Space Issues on Ubuntu Linux


While using Ubuntu Linux, you may encounter various issues caused by insufficient storage space. 

Over time, the system may become slower, software updates may fail, or files may no longer be saved properly.


1. Why Disk Space Runs Out on Ubuntu

Ubuntu is designed to manage storage efficiently, but disk usage can increase gradually due to several factors:

  • Cached files created during system updates

  • Log files that grow continuously over time

  • Snap packages storing multiple revisions

  • Unused packages and dependencies left behind

  • Large user files accumulated in the home directory

These files often grow unnoticed until the system begins to show warning signs.



2. Checking Current Disk Usage

The first step in resolving low disk space issues is understanding the current storage situation.

2.1 Check Overall Disk Usage

Run the following command in a terminal:

df -h

This command displays total disk size, used space, and available space for each partition in a human-readable format.

If the root (/) partition usage exceeds 90%, disk management is recommended.


2.2 Identify Large Directories

To see which directories are consuming the most space:

du -h --max-depth=1 /

Pay special attention to directories such as:

  • /var

  • /home

  • /usr

These locations commonly contain files that grow over time.



3. Cleaning Package Cache

Ubuntu stores downloaded package files locally to speed up installations and updates. 

Over time, this package cache can occupy significant disk space.

3.1 Remove Package Cache Files

sudo apt clean

This command removes cached package files and does not affect installed software.


3.2 Remove Unused Packages

sudo apt autoremove

This removes packages that were installed as dependencies but are no longer required.

It is especially useful after kernel updates.



4. Managing Old Linux Kernels

Ubuntu keeps older kernel versions installed as a safety measure. 

While useful, multiple old kernels can take up unnecessary disk space.

4.1 List Installed Kernels

dpkg --list | grep linux-image

If several old kernels are installed, they may be candidates for removal.


4.2 Use Automatic Cleanup

In many cases, running sudo apt autoremove is sufficient to clean up unused kernels safely.



5. Disk Usage Caused by Snap Packages

Snap packages are widely used in Ubuntu and provide isolation and rollback capabilities. 

However, Snap keeps multiple revisions of each application by default.

5.1 Check Snap Package Revisions

snap list --all

Disabled or older revisions can accumulate and consume disk space.

5.2 Limit Stored Revisions

Reducing the number of retained Snap revisions can help manage disk usage over time. 

This is more of a preventive approach than an immediate fix.



6. Managing Log Files

Ubuntu stores system logs in the /var/log directory. Even under normal conditions, logs are continuously generated and can grow large.

6.1 Check Log Directory Size

du -sh /var/log


6.2 Review systemd Journal Usage

journalctl --disk-usage

If logs occupy excessive space, configuring log retention limits can help prevent future disk shortages.



7. Cleaning the Home Directory

Most user-generated files are stored in the /home directory. Common space consumers include:

  • Large downloads

  • Old compressed archives

  • ISO images

  • Unused project or test folders

7.1 Find Large Files in Home Directory

du -h ~/ | sort -h

This helps identify files or folders that may no longer be needed.



8. Temporary Files and Application Caches

Applications create cache files to improve performance, but these can accumulate over time.

Examples include:

  • Web browser cache

  • Application temporary files

  • User cache directories (such as ~/.cache)

Periodically reviewing these locations can help reclaim storage without affecting system stability.



9. Habits to Prevent Disk Space Issues

Low disk space often appears sudden, but it is usually the result of gradual accumulation. 

Developing simple maintenance habits can prevent future problems:

  • Regularly check disk usage with df -h

  • Run autoremove after system updates

  • Review large downloads and temporary files

  • Monitor logs and cache directories

These practices contribute not only to disk health but also to overall system stability.



10. Conclusion

Low disk space issues on Ubuntu Linux should be addressed by understanding the system’s structure and identifying which components are using disk space.

While finding an immediate solution is important when storage problems occur, regularly checking and managing disk usage helps maintain a much more stable and reliable Ubuntu environment.

Popular posts from this blog

Understanding Computer System

Understanding System Software

Understanding Operating Systems