/var is full and mounted on a separate partition

Abstract: Resolve /var full errors on separate partitions by identifying large files, safely truncating logs, and resizing LVM volumes.

Created: 2026-09-19 by

When /var is full on a separate partition in Debian, you must identify the largest files using du, clean up logs or caches safely, and if necessary, resize the partition. This process involves stopping services like Postfix to prevent further writes, removing old compressed logs, and potentially expanding the logical volume using LVM tools.

Diagnosing Disk Usage

The first step is to understand what is consuming space within the /var directory. Since /var is mounted separately, standard disk usage commands might not show the specific constraint unless you target that mount point. Use the following command to see the total size of /var:
df -h /var
If the "Use%" column shows 100%, you are indeed out of space. To find which subdirectories are the largest, use du with the -sh flags (summarize and human-readable). Start from the root of the partition:
sudo du -sh /var/* | sort -hr
This output will likely reveal that /var/log, /var/lib, or /var/cache are the primary culprits. For deeper inspection, drill down into these directories. For example, to find large log files:
sudo du -sh /var/log/* | sort -hr
It is crucial to stop writing to /var before performing cleanup operations to avoid data corruption or service crashes. If you are running a mail server, which heavily uses /var/mail and /var/spool, stop the relevant services immediately. In many Debian setups, this includes Postfix or Exim.
sudo systemctl stop postfix
sudo systemctl stop exim4

Safely Cleaning Logs and Caches

Once the services are stopped, you can proceed with cleaning. Never delete active log files directly using rm while a service holds the file descriptor open; instead, truncate them. This preserves the file handle so the service can continue logging when restarted. To clear a specific log file without deleting it:
sudo truncate -s 0 /var/log/syslog
sudo truncate -s 0 /var/log/mail.log
For older rotated logs (e.g., syslog.1.gz), you can safely remove them. However, be cautious with /var/cache/apt. Clearing the apt cache is safe but does not free up much space compared to logs. If you need to reclaim significant space from package managers, consider purging unused kernels or cleaning up Docker images if applicable.
sudo apt-get clean
sudo apt-get autoremove --purge
If your system uses journalctl for logging, you can limit its size automatically. Edit /etc/systemd/journald.conf and set SystemMaxUse=50M to restrict journal size, then restart the service:
sudo systemctl restart systemd-journald

Handling Large Data Directories

If /var/lib is full, check for database files or container storage. For PostgreSQL or MySQL, you may need to archive old tables. For Docker, ensure you are not pruning images accidentally. As noted in our guide on managing disk space issues, understanding the specific application's data retention policy is key. Do not blindly delete files in /var/lib/docker unless you have verified they are unused containers.

Resizing the Partition

If cleaning does not resolve the issue, you may need to expand the /var partition. This assumes you are using LVM (Logical Volume Manager), which is common in modern Debian installations. First, check your volume group status:
sudo vgdisplay
Look for "Free PE / Size" in the output. If there is free space in the volume group, you can extend the logical volume. Replace vgname and lvname with your actual names:
sudo lvextend -l +100%FREE /dev/vgname/lvname
After extending the logical volume, you must resize the filesystem to utilize the new space. For ext4, use:
sudo resize2fs /dev/vgname/lvname
For XFS, use:
sudo xfs_growfs /var
Finally, restart any stopped services to resume normal operation.
sudo systemctl start postfix

Preventing Future Issues

Implement monitoring to alert you before /var reaches capacity. Tools like nagios, zabbix, or simple cron jobs checking df output can send email alerts at 80% usage. Additionally, configure log rotation policies to ensure logs do not grow indefinitely. Review server boot issues related to partitions to ensure your fstab entries remain stable after resizing.

Frequently Asked Questions

Can I delete files in /var/log directly?

Yes, but only if the associated service is stopped or if you use truncation. Deleting an active log file can cause the service to fail to write new logs until it is restarted. Always prefer truncating over deleting for active files.

What if I don't have LVM?

If you are not using LVM, resizing partitions requires more complex steps involving live CDs or backup and restore procedures. You may need to shrink adjacent partitions to create space, which carries a higher risk of data loss. Consider migrating to LVM for easier management in the future.

How do I find large files across the entire /var tree?

Use the command find /var -type f -size +100M to list files larger than 100MB. This helps identify unexpected large files that are not part of standard log or cache structures. Combine this with ls -lh to inspect their details.

Is it safe to run apt-get clean?

Yes, apt-get clean removes all cached .deb packages from /var/cache/apt/archives. It does not affect installed software. This is a safe way to reclaim several hundred megabytes of space on systems with frequent updates.

Why did my service crash after clearing logs?

Services expect log files to exist. If you deleted the file instead of truncating it, the service might lose its file descriptor. Restarting the service usually resolves this by recreating the log file. Ensure you stop services before making changes to prevent race conditions.

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