Proxmox Backup and Restore: Best Practices for LXC and VMs

Introduction

Proxmox Virtual Environment (PVE) is a powerful open-source platform for managing virtual machines (VMs) and Linux Containers (LXC). One of its essential features is the ability to back up and restore VMs and containers easily. In this guide, we’ll walk you through setting up backups in Proxmox, best practices for backups, and how to restore your VMs or containers when needed.

By the end of this tutorial, you’ll have a reliable backup and restore process in place for your Proxmox environment.


Step 1: Understanding Backup Storage Options

Before setting up backups, it’s important to choose where your backups will be stored. Proxmox supports multiple storage options:

  • Local Storage: Saves backups to a local disk or directory (e.g. /var/lib/vz or a mounted disk).

  • Network Storage: Uses NFS, CIFS (Samba), or iSCSI to store backups on a remote machine.

  • Proxmox Backup Server (PBS): A dedicated solution designed for efficient backups with deduplication.

  • External USB Drive: Useful for offline backups.

For best results, use network storage or PBS for centralized management and easy recovery.


Step 2: Configuring Backup Storage

  1. Log into Proxmox Web Interface

    • Open a web browser and navigate to https://your-proxmox-ip:8006

    • Log in with your credentials.

  2. Add Backup Storage (Optional, if not already set up)

    • Go to Datacenter > Storage > Add

    • Select storage type (NFS, CIFS, Proxmox Backup Server, etc.)

    • Configure the required settings and click Add


Step 3: Setting Up Backups in Proxmox

  1. Navigate to the Backup Section

    • In the web interface, go to Datacenter > Backup

    • Click Add to create a new backup job.

  2. Configure the Backup Job

    • Select Storage: Choose where the backup will be saved.

    • Schedule: Set an automated backup schedule (e.g. daily at midnight).

    • Selection Mode: Choose specific VMs, LXCs, or all.

    • Backup Mode:

      • Stop Mode: Shuts down the VM/LXC briefly to take a full backup.

      • Snapshot Mode: Takes a live backup without downtime.

      • Suspend Mode: Pauses the VM for the duration of the backup.

    • Click Create to save the job.

  3. Run a Manual Backup (Optional for Testing)

    • Select a VM/LXC in the Datacenter > Backup section.

    • Click Backup now to start the process.


Step 4: Restoring a Backup

  1. Locate the Backup

    • Navigate to Storage where backups are stored.

    • Click on the Backups tab.

  2. Restore the Backup

    • Select the backup file and click Restore.

    • Choose the target node and storage.

    • Click Start to restore the VM/LXC.

  3. Verify the Restored VM/LXC

    • Start the restored instance and check if it functions correctly.

    • Update network settings if the restored machine is on a different subnet.


Best Practices for Proxmox Backups

Automate backups: Use scheduled backups to ensure regular snapshots.

Use Proxmox Backup Server (PBS) for efficient, deduplicated backups.

Store backups offsite: Use network storage or cloud solutions for disaster recovery.

Test restores regularly: Verify that backups can be restored properly.

Monitor backup storage space: Ensure enough space is available for backups.

Conclusion

Setting up backups in Proxmox is crucial for protecting your virtual environment. By following this guide, you now have a reliable backup and restore solution in place. Make sure to test your backups periodically to ensure they are working as expected.