How to backup a virtual machine in Proxmox?
As before, to run a backup of a virtual machine in Proxmox there are 2 methods, using a web browser and using the command line. In proxmox, there are 3 virtual machine states that we can choose when the backup process starts:
- Snapshot: The VM is backed up in a running state, there is no downtime and this is the default mode - Suspend: VM is backed up in suspend/resume mode - Stop: VM is shut down first and then backed up and the results are the most consistent
And proxmox provide 3 compression methods that can be used in Proxmox:
- .zst: Zstandard (zstd) compression, intermediately but medium and this is the default compression on proxmox - .gz or .tgz: gzip compression, slow but small file result - .lzo: lzo compression, fast but big file result
In the web browser method, click on the virtual machine that will be backed up then click then click Backup and click the Backup now button as shown below:
After that, there will be a backup pop-up like in the image below:
You can choose as you wish and then click the Backup button if you finish, there will be a display like the below image:
If the backup process is complete, which is marked with the words TASK OK, then click the cross at the top right of the pop-up. To see the results of the virtual machine backup, click local and then click Backups as shown below:
In the command line method, we select which virtual machine we will choose to backup by typing the command:
Then we determine whether we backup the VM under what conditions, whether in a snapshot, stop, or suspend state, but by default, Proxmox will use snapshot mode so we can skip this part. But if we want the VM to be backed up in a stop state, then turn off the VM by:
qm shutdown ID
or if you want the VM to be backed up in a suspended state, then type the command below:
qm suspend ID
After that, type the command below to back up the VM:
and all the backup files either using a web browser or the command line are stored in the /var/lib/vz/dump/ folder.
Proxmox also has a feature where we can schedule backups of one or more VMs. Click Datacenter then click Backup and click the Add button as shown in the image below:
Then there will be a pop-up like the below image:
Click the virtual machine ID to be backed up, choose a backup time, and if all the choices are what we want, click the Create button. And the backup process should run according to what we have specified and the results of the backup will be in the /var/lib/vz/dump/ folder.