[SOLVED] Removed a VM and its virtual disk

mdo

Renowned Member
Dec 5, 2010
50
9
73
New Zealand
Made a big mistake...

We had a VMID 100 some time ago. We then stopped ("retired") that VM and allocated its virtual disk to a new VMID 200 (newer OS version, the virtual disk of the former VM 100 was basically the "data" now allocated to the new OS version). That virtual disk sits in a local storage on that PVE node.

That was running for some time and the disk under VMID 100 was changed to be "unused" (and the "unused" disk was even manually removed from the 100.conf file, edited manually). We then finally removed the VMID 100 - and now PVE does not know anything about that virtual disk any longer :-(.

VMID 200 is currently running and using that virtual disk which has disappeared but that might not even last until the next restart of VMID 200 I suspect.

The virtual disk contents is still there and in use with the running VMID 200 but PVE does not know about it any longer. Is there any way to recover that virtual disk (please :mad:)

Thanks
Michael
 
PVE assumes that the VMID in the disks name matches the VM using it. The proper way to avoid the deletion would have been to rename the disk image to contain the new VMID.

Since the VM is still running you should have the chance to recover the data.

On what kind of storage is the disk running?

The general idea would be to add another disk to the VM (can be done live) and migrate the data to that new disk before you shut down the VM. If the VM is running Linux I would unmount all file systems on the disk to avoid writes during the migration and then use dd to make a 1 to one copy.

If possible, create the new disk on another storage than the now deleted one was on.
 
Hi Aaron

thanks a lot for clarification and advice. Did exactly as advised (although used rsync rather dd because feeling more comfortable with it) and can report back that the VM is running on its new disk now and data looks to be good.
Will definitely rename disk image next time (yes, we have other VMs with similar situation so I will have to follow that next time).

Thanks again :)
 
Good to hear :)

Regarding the current VMs with the same situation. Next time you can shut them down, rename the image and change it accordingly in the config file directly and you should not notice any difference.

Could you please mark the thread as solved?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!