Troubleshooting Ubuntu 20.04.6 LTS Machine with Large Storage Usage

Abstract: Resolve high disk usage on Ubuntu 20.04.6 LTS by cleaning APT caches, managing systemd journal logs, and identifying large directories with ncdu.

Created: 2026-08-17 by
High disk usage on Ubuntu 20.04.6 LTS is typically caused by accumulated system logs, cached package files, or orphaned kernels. You can quickly identify the largest directories using terminal commands like ncdu or df -h. Resolving this involves cleaning up these specific areas to reclaim space and ensure system stability without removing essential operational files.

Identifying the Culprits

Before attempting any cleanup, it is crucial to understand where the storage is being consumed. The first step is to check the overall disk utilization to see if the root partition or a specific mount point is near capacity. Run the following command in your terminal:
df -h
This output shows the total size, used space, available space, and percentage of use for each mounted filesystem. If you see a partition with high usage, such as / (root) or /home, you need to drill down further. A powerful tool for visualizing directory sizes is ncdu (NCurses Disk Usage). Install it via:
sudo apt install ncdu
Then run sudo ncdu / to navigate through the file system interactively. This allows you to press 'd' to delete files directly within the tool, which is safer than guessing. Alternatively, for a quick summary of the top ten largest directories, use:
du -sh /* | sort -rh | head -n 10
Common offenders include the /var/log directory for old journal logs, /var/cache/apt for downloaded package binaries, and /usr/share/doc for documentation that may not be frequently accessed. Understanding these locations helps target your cleanup efforts effectively.

Cleaning Package Manager Cache

Ubuntu’s APT package manager stores downloaded .deb files in /var/cache/apt/archives/. Over time, this cache can grow significantly, especially if you have installed many applications or performed frequent updates. To clear this cache safely, use the following command:
sudo apt clean
This removes all cached package files from the local repository. It does not uninstall any software; it only deletes the installation files so they must be re-downloaded if you reinstall a package later. If you want to remove only obsolete packages that are no longer needed by the system, run:
sudo apt autoremove
This command checks for dependencies that were automatically installed to support other programs but are no longer required. Removing them frees up space and keeps your package database tidy. For a more aggressive cleanup that also removes configuration files of uninstalled packages, you can combine these steps, but always review the list of packages to be removed before confirming.

Managing System Logs

The /var/log directory often contains large log files from the systemd journal and various services. Journal logs can accumulate rapidly, especially on systems with frequent restarts or errors. To view the current size of the journal, use:
journalctl --disk-usage
To limit future growth, edit the configuration file at /etc/systemd/journald.conf. Find the line #MaxUse= and change it to something like MaxUse=50M to cap the total size. Similarly, set MaxFileSec=1week to rotate logs weekly. After making changes, restart the journal service:
sudo systemctl restart systemd-journald
You can also manually vacuum the journal to immediately free space:
sudo journalctl --vacuum-time=2d
This keeps only logs from the last two days. Be cautious when deleting individual log files manually, as some services may write to them continuously. Using the journalctl commands ensures proper rotation and handling.

Handling Old Kernels

Each kernel update installs new headers and modules while keeping older versions for fallback. Over multiple updates, this can consume several gigabytes. List installed kernels with:
dpkg --list | grep linux-image
Keep the currently running kernel (check with uname -r) and the previous one for safety. Remove older versions using:
sudo apt purge linux-image- linux-headers-
Replace <version> with the specific version numbers you wish to remove. This process is safe as long as you retain the most recent stable kernel.

Checking for Large User Files

Sometimes the issue lies within user home directories. Videos, downloads, and virtual machine images can take up substantial space. Use the find command to locate files larger than 100MB:
find ~ -type f -size +100M -exec ls -lh {} \; 2>/dev/null | awk '{ print $9 ": " $5 }'
Review these files to determine if they are necessary backups or temporary downloads. Additionally, check for core dumps in the root directory or home folders, which are created when applications crash unexpectedly. These can be deleted safely if you do not need them for debugging. For users managing containers, similar issues arise with Docker volumes and images. If you suspect container-related bloat, refer to our guide on Troubleshooting Docker Container Unable to Write to Removable Drive to understand how storage management impacts container performance and space allocation. Properly pruning unused images and containers is essential for maintaining healthy disk usage in containerized environments.

Preventive Measures

To prevent future storage crises, automate regular cleanups. Add the apt clean and autoremove commands to a monthly cron job. Monitor disk usage with tools like ncdu periodically. Consider moving large data directories like /var/log or user media to separate partitions if storage becomes a recurring bottleneck. Regular maintenance ensures your Ubuntu 20.04.6 LTS system remains responsive and stable.

Frequently Asked Questions

Is it safe to delete files in /var/log?

No, you should never manually delete files in /var/log while services are running, as this can cause errors. Instead, use journalctl commands to vacuum logs or configure journald.conf to limit their size automatically.

How do I find the largest files in my home directory?

You can use the find command with the -size flag to locate files exceeding a specific size threshold. Combining this with ls -lh provides a human-readable list of these large files for easy review.

What happens if I purge an old kernel?

Purging an old kernel removes its modules and headers, freeing up significant space. However, you cannot boot into that kernel version if your current one fails, so always keep at least one previous kernel as a fallback.

Can I move /var/log to another drive?

Yes, you can bind-mount a larger partition to /var/log. This requires creating the directory on the new drive and adding an entry to /etc/fstab to mount it at boot, ensuring logs are stored elsewhere.

Why does my disk usage show high even after cleaning?

Some processes hold open file handles to deleted files, preventing space from being reclaimed until the process restarts. Rebooting the system releases these handles and updates the actual available disk space.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More