Home Proxmox How To Backup Proxmox Containers And Virtual Machines To USB Drive

How To Backup Proxmox Containers And Virtual Machines To USB Drive

Backup And Restore Containers And Virtual Machines Via Proxmox Web UI

By sk
428 views

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.

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.

Proxmox Backup Directory
Proxmox Backup 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.

Create New Proxmox Storage Directory
Create New Proxmox Storage Directory

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.

Add Storage Directory Name, Path And Content Types To Backup
Add Storage Directory Name, Path And Content Types To Backup

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.

View Proxmox Storages
View Proxmox Storages

You will also see some new sub directories are created under "Proxmox_Backup" directory in your external drive.

Proxmox Storage Directories In External USB Drive
Proxmox Storage Directories In External USB 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.

Create Backup Job
Create Backup Job

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.20 and 22.20". 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.

Configure Backup Job For All Containers/VMs
Configure Backup Job For All Containers/VMs

To backup only certain Containers/VMs, select "Include selected VMs" and choose the containers/VMs from the list.

Configure Backup Job For Selected Containers And VMs
Configure Backup Job For Selected Containers And VMs

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.
Configure Backup Retention Period
Configure Backup Retention Period

After defining the retention period, click "Create" button.

You will now see the backup job under the "Backups" section.

View Backup Jobs
View Backup Jobs

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.

Backup Only The Selected Containers And VMs
Backup Only The Selected Containers And VMs

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.

Run Proxmox Backup
Run Proxmox Backup

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.

Backup Progress
Backup Progress

3.2. View Backups

Once the backup is completed, you can view the list of available backups under Proxmox Storage -> Backups tab.

View Backups
View Backups

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.

View Backups In USB Drive
View Backups In USB Drive

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.

Backup A Proxmox Virtual Machine On Demand
Backup A Proxmox Virtual Machine On Demand

Make sure you have chosen the correct destination Storage drive, Mode and Compression method for the backup, and finally click "Backup" to continue.

Backup Proxmox VM
Backup Proxmox VM

Upon successful backup, the following message will displayed in the task viewer wizard.

Backup Task Completed
Backup Task Completed

Close the task viewer and you will see the new backup under the Backup section.

FreeBSD VM Backup
FreeBSD VM Backup

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.

Restore Proxmox Container
Restore Proxmox Container

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.

Restore Container
Restore Container

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.

Delete Proxmox Container
Delete Proxmox Container

Enter the container ID and check the Purge and Destroy check boxes to permanently delete the container including its virtual disk.

Confirm Container Deletion
Confirm Container Deletion

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.

Restore Deleted Container
Restore Deleted Container

Make sure you have chosen the "local" Storage and hit the "Restore" button to to restore the deleted container from the backup.

Restore Container From Backup
Restore Container From 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.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More