Score:0

Proxmox recover data from formatted vm disk

cn flag

We had a Windows VM in our proxmox server with one accounting program and suddenly, it crashed at night.

When we connected to check what's wrong and we noticed a blue screen with the Windows error 0xc0000225 so we tried a few things but never formatted the drive. I tried to do a list partition but they are missing.

Is there any way to recover data from the vm disk image? I tried recovering windows but now is missing.

Score:0
cn flag

First, make a copy of the disk. Use dd for that.

dd if=/var/lib/libvirt/images/guest1.img of=/var/lib/libvirt/images/guest1_copy.img

After you made a copy, try to mount the disk on the proxmox host. Before the actual mounting, one needs information about the partition layout. Use kpartx to display the partition table. (Note, that kpartx may need to get installed before.)

kpartx -l /var/lib/libvirt/images/guest1_copy.img

and then map the partitions

kpartx -a /var/lib/libvirt/images/guest1_copy.img

After that, check if the mapping worked.

ls /dev/mapper/loop*

Every partition should be available as loop device. If that worked, the disk can be mounted - fs driver presence assumed - with the normal mount command. For example

mount /dev/mapper/loop0p2 /mnt -o loop,ro

if the desired partition is partition 2.

See here for more information.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.