- RBAC in Kubernetes - Fri, Dec 8 2023
- Kubernetes CoreDNS - Mon, Dec 4 2023
- Update container images with Copa - Mon, Nov 27 2023
Proxmox snapshot vs. backup
People often start treating snapshots and backups as alternatives to each other. While both sound similar at first, they work differently and are used in different use cases.
The following table covers some differences between snapshots and backups:
Snapshots | Backups |
A snapshot is an image of a VM at a specific point in time. | A backup is a fully independent copy of an entire VM or individual files. |
A snapshot is stored alongside the original VM disk. | A backup can be stored on a local server or remote storage. |
Snapshot creation is very fast. | Backup creation is a time-consuming process. |
The rollback process is also very fast. | Recovery from backup is also a time-consuming process. |
Snapshots are stored on child disks that are dependent on the source disk. If the source disk is corrupted, the snapshots are useless. | A backup is a copy of original data that is completely independent from the source VM, and it can be kept for the long term. |
A snapshot allows rollback in case of system failure, a failed update, or user error. | A backup ensures data recovery in the event of hardware failure, a failed update, a user error, or a disaster. |
Snapshots are useful for development and testing. | Backups are useful for business continuity and disaster recovery. |
Snapshots can be used in production environments, but they do not guarantee a full restore of the VM if the original virtual disk is corrupted, the original VM is deleted, or the primary storage containing the VM files failed. To recover from such situations, you need to rely on backups. Snapshots work great when you want to test an update, application, or feature that could potentially damage your VM.
Snapshot requirements
To create live snapshots in Proxmox, you need to meet the following requirements:
- All VM disk images must use the QEMU copy-on-write (qcow2) format.
- If you can't use the qcow2 format for the virtual disk (e.g., LXC containers support raw disk format only), the disk image must use storage that supports live snapshots. Detailed information about Proxmox storage and snapshot support is available here.
In a nutshell, the availability of the snapshot feature depends on the virtual disk format or the storage type. If you do not choose the right disk format or storage type, you will not be able to create snapshots. Instead, you will see a message stating, "The current guest configuration does not support taking new snapshots," as shown in the screenshot below:
You can see in the screenshot that the Take Screenshot option is grayed out. To avoid this, make sure you choose the qcow2 format for the virtual disk while provisioning a new VM or use storage that supports live snapshots, such as thin-LVM, ZFS, or Ceph.
Create a snapshot in Proxmox
You can create a snapshot either with the web interface or from the command line.
Create a snapshot using the web interface
To create a snapshot in Proxmox using the web interface, follow these steps:
- Log in to the web-based management interface for your Proxmox VE standalone node or cluster.
- Select the VM or container, and click the Snapshots tab.
- Now click the Take Screenshot button, as shown in the following screenshot:
- In the Create Snapshot dialog box, enter a name and description for the snapshot.
- Select the Include RAM checkbox to include the VM state (memory) in your snapshot. If you've allocated a large amount of memory to your VM, the snapshot creation will take longer, so you could clear the selection of the Include RAM option to speed up the process. You can view the progress in the task viewer, as shown in the screenshot.
Create a snapshot using the command line interface
Alternatively, if you would like to create a snapshot using the CLI, do the following:
- Select the Proxmox node in the server view, and click Shell to open a shell in the web interface.
- Now type the qm list command to view a list of all VMs on the current Proxmox host. The first column shows the VM ID, which is needed to create a snapshot.
- To create a snapshot of a VM using a command, use the following syntax:
qm snapshot [vmid] [snapshot_name] [OPTIONS]
- Where the vmid can be obtained using the qm list command, as shown in the above screenshot, and snapshot_name can be any arbitrary name (only uppercase or lowercase letters, numbers, and underscores are allowed). For options, you can use --description <string> to specify a useful description and --vmstate <boolean> to include RAM.
- In the screenshot above, I used the VM ID 100 to create the snapshot of debian-vm1 with a description and RAM options.
- The snapshot tree will be visible in the web interface, as shown in the screenshot.
- To roll back the VM to a particular state, you just need to select a snapshot, and click the Rollback button.
- Click Yes to confirm the rollback, and your VM will be rolled back to the previous state.
If your snapshot doesn't include the RAM, the VM will automatically go into the stopped state after rollback.
- To delete a snapshot, select it and click the Remove button.
Conclusion
In this post, I explained how to create and restore a snapshot of the Proxmox virtual machine.
Subscribe to 4sysops newsletter!
In my next article, I will explain how to create backups in Proxmox.
Read the latest IT news and community updates!
Join our IT community and read articles without ads!
Do you want to write for 4sysops? We are looking for new authors.
Excellent information! I appreciate the screenshots. Is there a way to automate this? Since it is linux of course there is. I guess the question is, what is the best way to automate snapshot creation and removal? Say, hourly snapshots for 24 hours. Thanks!
Unfortunately, Proxmox do not have any built-in option to automate snapshots. But this open source project could help you:
https://github.com/Corsinvest/cv4pve-autosnap
You can do it easily with Proxmox Back Server, it’s the new backup server solutions , you can install it on proxmox as a VM, and it will backup all your VM in a specific disk.
Try cv4pve-admin https://github.com/Corsinvest/cv4pve-admin
cv4pve-admin looks great but couldn’t get it to work in Docker.
Try now new version
I will give it a try and let you know. thanks