/var is full and mounted on a separate partition

Abstract: Resolve critical storage bottlenecks caused by a full /var partition by clearing APT caches and managing log file growth.

Created: 2026-07-29 by
When /var is full on a separate partition, immediate space recovery involves clearing package manager caches and log files. Use apt-get clean to remove cached .deb packages and rotate logs with journald or manual deletion in /var/log. This resolves the critical storage bottleneck without requiring complex partition resizing.

Identifying the Culprits

The first step in troubleshooting a full /var partition is to understand what is consuming the space. Because /var is mounted separately, filling it up does not necessarily affect your root filesystem, but it can prevent services from writing new data, causing application failures or system instability. You need to pinpoint the specific subdirectories that are growing uncontrollably.

Start by checking the overall usage of the partition using the df -h command. This will confirm that /var is indeed at 100% capacity. Once confirmed, drill down into the directory structure. The most common offenders are typically located in /var/cache/apt, /var/log, /var/lib/docker, or /var/mail.

To see which directories are using the most space, use the du command with human-readable output. Run the following command to get a summary of the top-level directories under /var:

sudo du -sh /var/* | sort -hr

This command lists the size of each immediate subdirectory, sorted by size in descending order. If you find a specific folder like /var/lib/docker or /var/cache/apt taking up gigabytes, you have identified your primary target for cleanup. For a more granular view, you can recursively check deeper levels, such as sudo du -sh /var/log/* | sort -hr.

Cleaning Package Manager Cache

In Debian-based systems, the APT package manager stores downloaded installation files in /var/cache/apt/archives. Over time, this directory can accumulate hundreds of megabytes or even gigabytes of old .deb files that are no longer needed because the packages are already installed. This is often the easiest and safest place to reclaim significant space.

To clear this cache, run the following command:

sudo apt-get clean

This command removes all files from the /var/cache/apt/archives directory except for the lock file. It does not uninstall any software; it only deletes the installer packages. If you want to be slightly more conservative and keep the most recent versions of packages, you can use sudo apt-get autoclean instead, which only removes obsolete package files. After running the clean command, verify the freed space with df -h /var.

If you frequently install and remove packages, consider configuring APT to automatically clean the cache after each operation. Add the line D::Keep-Downloaded-Packages "0"; to /etc/apt/apt.conf.d/99clean-cache. This ensures that future updates do not contribute to the bloat. For more details on managing disk space, see our guide on resolving /var full issues.

Managing Log Files

Log files in /var/log are another major contributor to disk space exhaustion. Services like Nginx, Apache, Postfix, and the systemd journal write continuously to these files. Without proper rotation policies, these files can grow indefinitely until they fill the partition.

First, check if journald is storing excessive data. The systemd journal can be configured to limit its size. Edit the /etc/systemd/journald.conf file and ensure the following settings are present:

SystemMaxUse=50M
RuntimeMaxUse=10M

After making changes, restart the journal service with sudo systemctl restart systemd-journald. This forces the journal to truncate old entries and adhere to the new size limits. Additionally, you can manually vacuum the journal to immediately free up space using sudo journalctl --vacuum-size=50M.

For traditional log files, ensure that logrotate is configured correctly. Check the configuration files in /etc/logrotate.d/. If you find specific service logs that are not being rotated, you may need to add a custom rotation rule. For example, if you have large Nginx access logs, ensure they are included in the logrotate configuration. Manually deleting logs (e.g., sudo rm /var/log/largefile.log) should be done cautiously, as some services hold file descriptors open. Instead, truncate them using sudo truncate -s 0 /var/log/largefile.log to preserve the file handle while clearing the content.

Handling Docker and Application Data

If your server runs Docker, /var/lib/docker can become a massive sinkhole for disk space. Images, containers, volumes, and build caches accumulate rapidly. To identify unused resources, run docker system df to see a breakdown of space usage.

To safely remove stopped containers, unused networks, and dangling images, execute:

docker system prune

This command prompts for confirmation before removing objects. Be careful not to remove running containers or essential volumes unless you are certain they are no longer needed. For a more aggressive cleanup, including build cache, use docker system prune --all --volumes. However, this is destructive and should only be used when you are sure you can rebuild your environment if necessary.

Other applications may also store temporary data in /var/tmp or /var/spool. Review these directories periodically. For instance, /var/spool/postfix might contain queued emails if your mail server is experiencing delivery issues. Cleaning these queues requires specific commands depending on the MTA, such as postsuper -d ALL for Postfix.

Preventing Future Issues

Once you have reclaimed space, implement monitoring to prevent recurrence. Set up alerts using tools like Nagios, Zabbix, or simple cron jobs that check disk usage via df and send an email if /var exceeds 80% capacity. This proactive approach allows you to address growth trends before they cause outages.

Consider implementing automated cleanup scripts for known bloat sources. For example, a weekly cron job that runs apt-get clean and docker system prune can keep the system healthy without manual intervention. Regularly review the growth rate of your log files and adjust logrotate thresholds accordingly. If your application generates substantial data, consider archiving older logs to external storage or a centralized logging server like ELK Stack or Graylog, rather than keeping them locally on the /var partition.

Frequently Asked Questions

Can I delete files in /var/lib/dpkg/info?

No, you should never manually delete files in /var/lib/dpkg/info. This directory contains metadata required by the APT package manager to track installed packages. Deleting these files can corrupt your package database and prevent future installations or updates. Always use apt-get commands to manage packages.

Why is /var/log/syslog so large?

A large syslog file usually indicates verbose logging enabled by default or a misconfigured service generating excessive debug messages. Check the configuration of your syslog daemon (rsyslog or syslog-ng) and reduce the log level for non-critical services. Also, ensure that logrotate is properly configured to compress and archive old syslog entries.

How do I find hidden large files in /var?

Use the find command to locate files larger than a specific threshold. For example, to find files larger than 100MB in /var, run: sudo find /var -type f -size +100M. This helps identify unexpected large files that might not be obvious from standard directory summaries.

What if /var is full due to deleted files still held open?

If you delete a large log file but the space doesn't free up, a process might still have the file open. Use lsof +L1 to list deleted files that are still held open by processes. Restarting the affected service will release the file descriptor and free the space.

Is it safe to mount /var on a larger partition later?

Yes, but it requires careful planning. You must ensure the new partition is formatted and ready, then move data, update /etc/fstab, and remount. Refer to our guide on fixing boot issues after partition changes to avoid breaking your system during the transition.

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