How to Recover a Deleted VM in Proxmox [Different Methods]
If you’ve accidentally deleted a VM in Proxmox, don’t panic! There are several ways to recover lost VMs.
Where deleted VMs go in Proxmox
Proxmox Virtual Environment (Proxmox VE) is a powerful open-source platform for virtualization, allowing users to manage virtual machines (VMs) and containers efficiently. However, accidents happen—sometimes, VMs get deleted due to user errors, system crashes, or storage issues.
When a VM is deleted, its disk files may still exist in Proxmox storage, unless they were explicitly deleted. These files are typically located in:
- LVM-Thin or ZFS pools (for advanced storage setups)
- Local directory storage (/var/lib/lxc/ or /var/lib/vz/)
- Backup locations if scheduled backups were enabled
How to recover a deleted VM in Proxmox
The easiest way to restore a deleted VM is through a backup. First, you can check if you have backups stored in:
- Proxmox Backup Server (PBS)
- Local or remote backup directories (e.g., /var/lib/vz/dump/)
- External NAS or cloud storage
Restoring from Proxmox Backup Server (PBS)
1. Open the Proxmox Web UI.
2. Navigate to Datacenter > Storage > Backup.
3. Locate the latest VM backup.
4. Select Restore and choose the target node.
5. Click Start and wait for the restoration to complete.
Recovering a VM from Manual Backups
If you have manual backups, you can restore them using:
- Proxmox CLI (qmrestore)
- Proxmox Web UI (via Restore option)
To restore using the CLI:
qmrestore /var/lib/vz/dump/backup-file.vma.gz 100
(Replace 100 with your VM ID)
Restoring a deleted VM from Proxmox storage
Even if the VM is deleted, its disk files might still be available.
1. Check Proxmox storage for leftover disk images using:
ls /var/lib/vz/images/
ls /dev/pve/ # For LVM-based storage
zfs list # For ZFS-based storage
2. If you find the VM disk image, mount it to another VM to check for data integrity:
mkdir /mnt/vm-disk
mount /dev/pve/vm-100-disk-0 /mnt/vm-disk
Recovering a VM from Proxmox logs
1. Check logs for VM traces:
grep "delete VM" /var/log/syslog
grep "qm create" /var/log/pve/tasks/
These logs can help you manually rebuild a VM.
Recreating the VM and attaching disks
If disk files are intact but the VM configuration is lost, manually recreate the VM:
1. Create a new VM in Proxmox.
2. Detach any default disks.
3. Attach the recovered disk manually
qm rescan
qm set 100 --scsi0 /dev/pve/vm-100-disk-0
Seamlessly protect your VMs with AOMEI Cyber Backup
While recovering a deleted VM in Proxmox is possible, it's not always guaranteed. The best way to avoid downtime and data loss is to implement a robust backup solution. To protect your VMs efficiently, AOMEI Cyber Backup comes in—a professional, centralized backup solution, supporting automatic scheduled backups and fast recovery.
- Free VMware & Hyper-V VMs protection.
- Agentless and automatic backup virtual machines.
- Fast VM recovery with minimal downtime.
FAQ about Proxmox restoring VMs
Q: Can I recover a deleted VM in Proxmox without a backup?
A: Yes, you can try recovering the VM disk from LVM-Thin, ZFS snapshots, or use data recovery tools.
Q: What if my backup is stored on an external device and Proxmox can't access it?
A: First, check the connection of the external device to the Proxmox server. Ensure that the device is powered on and properly recognized by the system. Also, verify the permissions of the backup files on the external device. You may need to mount the device with the correct permissions so that Proxmox can access the backup.
Q: I'm getting an "invalid backup file" error during the restore process. What should I do?
A: This error could indicate that the backup file is corrupted. Try to use a different backup if available. If not, you may need to re-create the backup from a previous working state. Also, check the integrity of the storage where the backup is stored; disk errors could lead to corrupted backup files.
Q: I restored a VM, but some of the data seems to be missing. How can I fix this?
A: First, verify that you restored the correct backup. If so, check if the backup was incomplete. Try restoring from a different backup if available. Also, check for any file system errors within the guest operating system of the VM, as these could cause data to appear missing.
Conclusion
Recovering a deleted VM in Proxmox is possible using backups, storage snapshots, or recovery tools. The best approach depends on your storage setup and backup policies. To avoid future issues, always implement a strong backup strategy and use snapshots for quick recovery.