Skip to main content
Maintenance operations help keep your Proxmox VE environment healthy, optimized, and running efficiently. These scripts automate routine tasks and help prevent common issues.

Regular Maintenance Tasks

System Updates

Update All LXC Containers

Keep all containers up-to-date with the latest packages:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/update-lxcs.sh)"
  1. Detects all LXC containers on the host
  2. Allows selection of containers to skip
  3. Option to skip stopped containers
  4. Automatically identifies package manager (apt, apk, dnf, yum, pacman)
  5. Runs update and upgrade commands
  6. Reports success or failure for each container
For automated updates, use the cron-based version:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/update-lxcs-cron.sh)"
This installs a weekly cron job for automatic container updates.

Update Applications

Update self-hosted applications within containers:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/update-apps.sh)"
Supports automatic updates for:
  • Docker containers
  • Node.js applications
  • Python applications
  • Custom update scripts
  • Binary-based applications

Cleanup Operations

Container Cleanup

Remove unnecessary packages and clear cache:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/clean-lxcs.sh)"

Package Cache

Clears APT/DNF/YUM package caches to free disk space

Unused Packages

Removes automatically installed packages no longer needed

Log Rotation

Truncates old log files

Temp Files

Cleans temporary directories
What gets cleaned:
  • /var/cache/apt/archives/ (Debian/Ubuntu)
  • /var/cache/dnf/ (Fedora/Rocky)
  • /var/cache/yum/ (CentOS)
  • /tmp/ temporary files
  • Orphaned packages
  • Old log files

Clean Orphaned LVM Volumes

Remove LVM volumes no longer associated with containers:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/clean-orphaned-lvm.sh)"
This script permanently deletes orphaned volumes. Ensure you have backups before running.
The script:
  • Scans for LVM volumes not linked to any container
  • Lists orphaned volumes with sizes
  • Prompts for confirmation before deletion
  • Removes selected volumes and frees space

Kernel Cleanup

Remove old kernel versions:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/kernel-clean.sh)"
  1. Detects currently running kernel (automatically excluded)
  2. Lists all installed kernel versions
  3. Displays kernel sizes
  4. Allows interactive selection of kernels to remove
  5. Removes selected kernel packages and associated files
  6. Updates GRUB configuration
Benefits:
  • Frees /boot partition space
  • Reduces package update overhead
  • Simplifies kernel management
  • Prevents boot partition full errors

Storage Maintenance

FSTRIM for SSDs

Optimize SSD performance with periodic TRIM operations:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/fstrim.sh)"
FSTRIM helps maintain SSD performance and longevity by informing the SSD which blocks are no longer in use.
What it does:
  • Enables weekly fstrim.timer systemd service
  • Runs TRIM on all mounted filesystems with SSD support
  • Logs TRIM operations for monitoring
  • Configurable schedule via systemd timer
Check TRIM status:
# View timer status
systemctl status fstrim.timer

# View last TRIM operation
journalctl -u fstrim.service

# Manually run TRIM
systemctl start fstrim.service

Backup Operations

Host Configuration Backup

Backup critical Proxmox host configuration:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/host-backup.sh)"
  • /etc/ - System configuration files
  • /etc/pve/ - Proxmox VE configuration
  • /etc/network/ - Network settings
  • /etc/apt/ - Repository configuration
  • Custom directories (optional)
Usage example:
  1. Run the script
  2. Specify backup destination (default: /root/)
  3. Choose directory to backup (default: /etc/)
  4. Select specific subdirectories or backup all
  5. Script creates compressed tar archive
Restore from backup:
# Extract backup
tar -xzf hostname-etc-backup.tar.gz -C /

# Verify files
ls -la /etc/

# Restart services if needed
systemctl restart pveproxy pvedaemon

Container Backup and Restore

Restore containers from Proxmox backups:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/container-restore-from-backup.sh)"
Features:
  • Lists available backup files
  • Allows selection of backup to restore
  • Prompts for new container ID
  • Configures storage and resources
  • Starts container after restore

Performance Optimization

CPU Microcode Updates

Install latest CPU microcode for security and stability:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/microcode.sh)

Intel

Installs intel-microcode and updates Intel CPU firmware

AMD

Installs amd64-microcode and updates AMD CPU firmware
Why update microcode:
  • Security vulnerability patches (Spectre, Meltdown, etc.)
  • CPU stability improvements
  • Bug fixes and performance enhancements
  • Thermal management improvements
Verify microcode version:
# Intel
dmesg | grep microcode

# AMD  
dmesg | grep microcode

# Current microcode version
grep microcode /proc/cpuinfo

CPU Scaling Governor

Optimize CPU frequency scaling:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/scaling-governor.sh)"
  • performance: Maximum frequency always (best for compute-heavy loads)
  • powersave: Minimum frequency always (best for power efficiency)
  • ondemand: Dynamic scaling based on CPU load (balanced approach)
  • conservative: Similar to ondemand but more gradual (smooth transitions)
  • schedutil: Scheduler-driven frequency selection (modern default)
When to use each governor:
GovernorUse CasePower UsagePerformance
performanceDatabases, transcoding, VMsHighMaximum
powersaveLow-load servers, home labsMinimumVariable
ondemandGeneral purpose serversModerateGood
conservativeMedia servers, file serversLow-ModerateGood
schedutilModern kernels (5.9+)OptimizedExcellent
Check current governor:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

NIC Offloading Fixes

Resolve network performance issues:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/nic-offloading-fix.sh)"
NIC offloading can cause packet corruption in some virtualization scenarios. Disable if experiencing network issues.
Common symptoms of offloading problems:
  • Packet corruption in VMs/containers
  • Slow network performance
  • Connection drops
  • Checksums errors
What the script disables:
  • TCP segmentation offload (TSO)
  • Generic segmentation offload (GSO)
  • Generic receive offload (GRO)
  • Large receive offload (LRO)
  • RX/TX checksumming

Health Monitoring

Monitor All Instances

Automatically monitor and restart failed instances:
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/monitor-all.sh)"
  • Continuous ping monitoring: Checks instance responsiveness every minute
  • Tag-based filtering: Only monitors instances with mon-restart tag
  • Automatic restart: Restarts instances that fail ping checks
  • Systemd service: Runs as background service
  • Logging: Records all restart events
Setup process:
  1. Run the installation script
  2. Service is installed as systemd unit
  3. Tag instances you want monitored:
# For VMs
qm set <vmid> -tags mon-restart

# For Containers  
pct set <ctid> -tags mon-restart
Manage the monitoring service:
# Check status
systemctl status ping-instances

# View logs
journalctl -u ping-instances -f

# Restart service
systemctl restart ping-instances

# Stop monitoring
systemctl stop ping-instances

# Disable monitoring
systemctl disable ping-instances
Remove monitoring: To stop monitoring specific instances, remove the tag:
qm set <vmid> -tags ""
pct set <ctid> -tags ""

Maintenance Schedules

  • Check systemd journal for errors: journalctl -p err -b
  • Monitor disk usage: df -h
  • Review backup status
  • Check container/VM status in web UI
  • Update containers: update-lxcs.sh
  • Review security updates
  • Check monitoring alerts
  • Verify backup integrity
  • Run FSTRIM (automatic if configured)
  • Clean container caches: clean-lxcs.sh
  • Remove old kernels: kernel-clean.sh
  • Update Proxmox host: apt update && apt dist-upgrade
  • Review and rotate logs
  • Test backup restoration
  • Update microcode if new versions available
  • Check storage pool health
  • Clean orphaned LVM volumes: clean-orphaned-lvm.sh
  • Review and optimize resource allocation
  • Test disaster recovery procedures
  • Update documentation
  • Review and update network configuration
  • Perform security audit
  • Plan and execute major version upgrades
  • Review hardware health and consider replacements
  • Audit user access and permissions
  • Review and update security policies
  • Archive old backups to long-term storage

Automation with Cron

Setup Automated Maintenance

Create a custom maintenance script:
#!/usr/bin/env bash
# /usr/local/bin/maintenance.sh

LOGFILE="/var/log/proxmox-maintenance.log"

echo "[$(date)] Starting maintenance" >> "$LOGFILE"

# Update containers
echo "[$(date)] Updating containers" >> "$LOGFILE"
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/update-lxcs.sh)" >> "$LOGFILE" 2>&1

# Clean containers
echo "[$(date)] Cleaning containers" >> "$LOGFILE"
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/tools/pve/clean-lxcs.sh)" >> "$LOGFILE" 2>&1

# Backup host config
echo "[$(date)] Backing up host configuration" >> "$LOGFILE"
tar -czf /root/host-backup-$(date +%Y%m%d).tar.gz /etc/pve /etc/network >> "$LOGFILE" 2>&1

echo "[$(date)] Maintenance complete" >> "$LOGFILE"
Make it executable:
chmod +x /usr/local/bin/maintenance.sh
Schedule with cron:
# Edit crontab
crontab -e

# Add weekly maintenance (Sundays at 3 AM)
0 3 * * 0 /usr/local/bin/maintenance.sh

# Add monthly cleanup (1st of month at 2 AM)
0 2 1 * * /usr/local/bin/cleanup.sh

Best Practices

Before Maintenance

  • Create backups
  • Schedule during low-usage periods
  • Notify users of planned maintenance
  • Test in non-production first

During Maintenance

  • Monitor logs in real-time
  • Keep rollback plan ready
  • Document any issues
  • Take before/after snapshots

After Maintenance

  • Verify all services running
  • Check monitoring dashboards
  • Review logs for errors
  • Update maintenance documentation

Emergency Response

  • Keep backup restoration tested
  • Document rollback procedures
  • Maintain emergency contact list
  • Have offline documentation available
Regular maintenance prevents emergencies. Establish and follow a consistent maintenance schedule to keep your Proxmox environment healthy and reliable.

Build docs developers (and LLMs) love