The first thing you should do after installing a Proxmox server is to decide how to backup your proxmox containers and virtual machines and where to save those backups safely. Keeping the backups in the same system isn't a real backup strategy and it is NOT SAFE. In this step by step guide, we will see how to backup Proxmox containers and virtual machines to an external USB drive via Proxmox web UI. We will also see how to overwrite an existing container or VM and how to restore the deleted container and VM from the backup.
If you run Proxmox on production, you must know how to backup the Proxmox containers/VMs periodically in order to avoid data loss. Fortunately, Proxmox web dashboard makes the job even easier and quicker.
Table of Contents
1. Create Backup Directory In USB Drive
Plugin the USB external drive to your Proxmox host system. Make sure the drive has sufficient free space for storing the Proxmox Containers and VMs.
For the demonstration purpose, I have created a directory called "Proxmox_Backup" in my external USB drive. My USB drive is mounted under /media/ostechnix/
directory.
2. Create New Proxmox Storage For Backups
Open Proxmox web UI and navigate to Datacenter -> Storage. Click "Add" button and choose "Directory" from the drop-down menu.
Give a meaningful name for the new storage directory in the "ID" column. In the "Directory" column, enter the actual path of the backup directory that you created in the external usb drive in Step 1. Next choose "VZDump backup file" among other file types from the "Content" drop-down box.
Here, I gave the Proxmox storage name as "Proxmox_Backup" and my backup directory location is "/media/ostechnix/SK_Ostechnix1/Proxmox_Backup/". I have selected "Disk Image", and "VZDump backup file" file types to backup. You can choose all other file types, such as ISO image, container templates, containers and snippets etc.
Once selected the content types to backup, click Add.
You will now see the new storage is listed under the Storage section.
You will also see some new sub directories are created under "Proxmox_Backup" directory in your external drive.
I have chosen only two file types to backup (i.e. Disk image and VZDump backup file), hence two directories are created. If you choose other file types, more directories will be created.
3. Backup Proxmox Containers And Virtual Machines
First, you need to create a backup job and define the containers and VMs that you want to backup.
Go to Datacenter -> Backup and click "Add" button.
In the General section, you need to configure the following parameters.
- Proxmox node - Choose "All" if you want to backup all containers and vms from all Proxmox nodes in the datacenter. You can also choose individual proxmox node from the drop down box.
- Storage directory - This should be automatically selected for you. If there are multiple storage directories, you need to choose one from the list. In my case, the storage directory is Proxmox_Backup.
- Schedule time - Select the day and time for the backups to start. I selected "Everyday 2:30, 22:30". So backups will start everyday at 2:30 am and 10:30 pm.
- Selection mode - In box, you can choose to include, exclude vms from the backup. I am going to backup everything, so I selected "All".
- Compression - Choose the compression level for your backups. I will go with the default which is ZSTD (fast and good).
- Mode - Choose "Snapshot".
To backup all Containers/VMs in the Proxmox node, choose "All" from Selection mode.
To backup only certain Containers/VMs, select "Include selected VMs" and choose the containers/VMs from the list.
In the Retention section, choose the number of backups you want to keep. You have the following options. Choose that suits your requirements.
- Keep all backups
- keep last "N" backups
- Keep daily, hourly, weekly, monthly, and yearly "N" backups.
After defining the retention period, click "Create" button.
You will now see the backup job under the "Backups" section.
As you see in the above screenshot, I have configured the backup job for all containers and VMs.
If you've chosen to backup a particular container or VM, you will see the IDs of the selected container/VM under the Selection tab.
That's it. Similarly, you can define as many as backups jobs at different interval. The backups will automatically start at the scheduled time.
If you don't want to wait for the schedule time, you can manually run the backup at any time as shown in the following section.
3.1. Run Backups Manually
Select a backup job and click "Run now" button to create backup of your containers and VMs immediately.
Click "Yes" to start the backup task. You will see the backup progress in the "Tasks" section at the bottom of the Proxmox web UI. Just double click on it to view the verbose output.
3.2. View Backups
Once the backup is completed, you can view the list of available backups under Proxmox Storage -> Backups tab.
You can also view the backups in the storage directory of your external drive as well.
Open the USB drive and navigate to Proxmox storage directory -> dump.
4. Backup A Single Container Or Virtual Machine On Demand
Sometimes, you want to backup the container or VM after making some changes in them. For instance, you might have set up a web server on a VM and want to backup it.
Let us say, you want to backup FreeBSD VM. To do so, open Proxmox Web UI and navigate to your Proxmox host -> FreeBSD VM -> Backup -> Backup now.
Make sure you have chosen the correct destination Storage drive, Mode and Compression method for the backup, and finally click "Backup" to continue.
Upon successful backup, the following message will displayed in the task viewer wizard.
Close the task viewer and you will see the new backup under the Backup section.
You can also view it under the Backups tab of your main Proxmox storage as well.
5. Restore Proxmox Containers And VMs
Restoring Proxmox containers or VMs is quite easy!
Just click on the container or VM that you want to restore and click Backup tab and choose the backup and click "Restore" button.
Here, we are going to restore the container from the backup drive (i.e. external drive) to the local disk, right? Yes. So you must choose "local" from the Storage column.
Please be mindful that the above action will overwrite the container.
You can even delete the container or VM and restore it from the backup.
For instance, let us delete the Almalinux container. Click on the Almalinux container and click More -> Delete.
Enter the container ID and check the Purge and Destroy check boxes to permanently delete the container including its virtual disk.
We completely wiped the container. Now go to Proxmox Storage (i.e. Proxmox_Backup) -> Backups. You will see the list of available backups. Choose container backup from the list. In our case, it is Almalinux container. And click "Restore" button.
Make sure you have chosen the "local" Storage and hit the "Restore" button to restore the deleted container from the backup.
Now, the deleted container is restored back. You can start using the container.
Conclusion
To summarize, we discussed how to backup a container or virtual machine to an external drive via Proxmox web dashboard. We also learned how to restore the Proxmox containers and VMs from the backup.
As you can see, this is a simple and an efficient Proxmox backup solution that anyone can quickly setup in minutes.
3 comments
Hi!
Great stuff!
How can I remove that USB or Disk in a safe way?
I don’t like have it connected all the time. I would like to remove it and store it in a safe place between backup’s.
Just unmount it using the following command.
umount [mount-point-name]
Thank’s!