Free up disk space Proxmox
Running out of disk space on your Proxmox server can lead to performance issues and prevent you from performing essential tasks like updates or creating new virtual machines. Fortunately, there are several ways to free up disk space on Proxmox OS drive. In this article, we will explore four effective methods to reclaim disk space: managing the systemd journal, removing old kernels, deleting rotated log files, and cleaning the apt cache. By following these steps, you can ensure your Proxmox server runs smoothly and efficiently

Checking Disk Usage
Before proceeding with the cleanup methods, it’s helpful to check the current disk usage to identify which areas are consuming the most space. This step allows you to pinpoint directories or files that are taking up excessive space on your Proxmox OS drive.
You can use the following command to see the disk usage of the root filesystem:
df -h /
This will display the total size, used space, and available space on the root partition, giving you a quick overview of your disk’s status.
For a more detailed view of which directories are using the most space, run:
sudo du -sh /*
This command lists the size of each directory in the root filesystem. To dive deeper into specific directories, such as /var
, you can use:
sudo du -sh /var/*
This helps identify the largest consumers of disk space, such as logs or cached files, so you can target your cleanup efforts effectively.
Command | Purpose |
---|---|
df -h / | Shows disk usage for the root filesystem |
sudo du -sh /* | Lists sizes of directories in the root filesystem |
sudo du -sh /var/* | Provides detailed sizes for directories under /var |
Once you have identified the areas that need cleanup, you can proceed with the following methods to free up disk space on your Proxmox server.
1. Managing the Systemd Journal
The systemd journal, stored in /var/log/journal
, can grow significantly over time, consuming valuable disk space. Proxmox, being a Debian-based system, uses journalctl
to manage these logs. By removing old log entries, you can free up space without affecting system operations.
Steps to Clean the Systemd Journal
- Check Journal Size: First, determine how much space the journal is using:
journalctl --disk-usage
. This command outputs the total disk space used by both active and archived journal files, helping you decide how much to clean. - Remove Old Logs by Time: To delete logs older than a specific period, use the
--vacuum-time
option. For example, to keep only the logs from the past week:sudo journalctl --vacuum-time=1w
. This removes all journal entries older than one week, freeing up space while retaining recent logs for troubleshooting. - Limit Journal Size: Alternatively, you can restrict the journal to a specific size, such as 100MB:
sudo journalctl --vacuum-size=100M
. This command deletes older archived journal files until the total size is below the specified limit.
Precautions
- Avoid removing logs that might be needed for recent troubleshooting. For example, if you’ve encountered recent system issues, keep logs from the past few weeks.
- Ensure you have sufficient permissions by using
sudo
with these commands. - Regularly check journal size to prevent it from growing unchecked.
For more details on journalctl
, refer to the official systemd documentation.
2. Removing Old Kernels
Old kernel versions, stored in /boot
and /usr/lib/modules
, can accumulate and take up significant space. Proxmox frequently updates its kernels, and older versions are often no longer needed. Removing these can free up disk space on your Proxmox OS drive.
Steps to Remove Old Kernels
- List Installed Kernels: Check which kernel versions are installed:
dpkg --list | grep linux-image
. This lists all installed kernel images, including their versions, helping you identify which ones are outdated. - Check Current Kernel: Ensure you don’t remove the currently running kernel:
uname -r
. This command displays the version of the kernel currently in use, which must be retained for system stability. - Automatically Remove Old Kernels: To remove old kernels that are no longer needed, use:
sudo apt autoremove --purge
. This command removes packages, including old kernels, that were automatically installed to satisfy dependencies and are now obsolete. The--purge
option also deletes associated configuration files. - Manually Remove Specific Kernels: If you need to remove a specific kernel version, use:
sudo apt remove linux-image-<version>
Replace<version>
with the specific kernel version (e.g.,linux-image-5.15.10-1-pve
). Double-check that this is not the current kernel.
Precautions
- Always verify the current kernel with
uname -r
before removing any kernels to avoid rendering the system unbootable. - It’s recommended to keep at least one or two older kernels as a fallback in case a new kernel causes issues.
- After removing kernels, you may need to update the GRUB bootloader with
sudo update-grub
to reflect the changes.
For additional guidance, see the Proxmox Support Forum discussion on cleaning old kernels.
3. Deleting Rotated Log Files
Rotated log files, stored in /var/log
with extensions like .gz
, are compressed archives of old logs created by the logrotate utility. These files can be safely deleted to free up space, as they are no longer actively used by applications or the system.
Steps to Delete Rotated Log Files
- List Rotated Log Files: Identify the rotated log files in
/var/log
:ls /var/log/*.gz
This command lists all compressed log files, helping you see how many exist and their potential size. - Delete All Rotated Log Files: To remove all
.gz
files:sudo rm /var/log/*.gz
This deletes all rotated log files, freeing up space without impacting current logging or application functionality. - Delete Older Rotated Logs Selectively: If you want to keep recent rotated logs, you can delete only those older than a certain period, such as 30 days:
sudo find /var/log -name "*.gz" -type f -mtime +30 -delete
This command finds and deletes.gz
files in/var/log
that are older than 30 days, preserving newer logs.
Precautions
- Deleting rotated logs is generally safe, as they are archives, but ensure no critical debugging information is needed from older logs.
- Verify that logrotate is configured correctly to prevent excessive log accumulation in the future.
4. Cleaning the Apt Cache
The apt package manager stores downloaded package files in /var/cache/apt
, which can grow large over time, especially after frequent updates. Cleaning this cache is a safe and effective way to free up disk space on your Proxmox server.
Steps to Clean the Apt Cache
- Remove Outdated Packages: To delete package files that are no longer downloadable (i.e., outdated):
sudo apt autoclean
This command removes obsolete package files, keeping the cache manageable without deleting everything. - Remove All Cached Packages: To clear all downloaded package files:
sudo apt clean
This removes everything except the lock file from/var/cache/apt/archives
and/var/cache/apt/archives/partial
, maximizing space savings. - Remove Unnecessary Packages: To delete packages that were automatically installed and are no longer needed:
sudo apt autoremove
This can include dependencies for removed software or old kernels, further freeing up space.
Precautions
- Running
apt clean
removes all cached packages, so you’ll need to re-download them for future installations, which could be an issue with slow internet connections. - Ensure no apt processes are running before executing these commands to avoid conflicts (e.g., check with
ps aux | grep apt
).
For a deeper understanding, refer to this Ask Ubuntu discussion on apt commands.
Additional Best Practices To Free Up Disk Space Proxmox
To maintain optimal disk space on your Proxmox server:
- Schedule Regular Cleanups: Use cron jobs to automate commands like
journalctl --vacuum-time=2w
orapt autoclean
on a weekly or monthly basis. - Monitor Disk Usage: Periodically run
df -h
ordu -sh /*
to catch space issues early. - Consider Storage Expansion: If cleanups are insufficient, you may need to resize your disk or add storage, as outlined in the Proxmox VE Resize Disks guide.
- Check Virtual Machines: If disk space issues occur within virtual machines or containers, different methods (e.g.,
fstrim
for VMs) may apply, as discussed in this Reddit post on Proxmox cleanup.
Conclusion
By implementing these methods—managing the systemd journal, removing old kernels, deleting rotated log files, and cleaning the apt cache—you can effectively free up disk space on your Proxmox OS drive. These steps, tailored for Proxmox’s Debian-based environment, are safe when executed with care. Regularly performing these cleanups will help maintain your server’s performance and prevent disk space issues from disrupting your operations. Always double-check commands and retain critical data, such as recent logs or the current kernel, to ensure system stability.
Other Proxmox articles
Proxmox Rados Connect Failed? Here’s the Solution You’ve Been Waiting For!
Remove Node from Proxmox Ceph Cluster: Fix OSD Tab & Bucket Appearance
Proxmox VE OS ZFS Boot Disk Replacement
How to Convert a Proxmox Windows Guest from BIOS to UEFI
Proxmox When Connecting to VM Guest Console You Get WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!