Accidently deleted KVM VM on LVM. Any advice ?

Hi.

We accidently deleted a wrong VM on LVM...

Immediatly after, we ran vgcfgrestore -l VolGroup00 and : vgcfgrestore -vvf /etc/lvm/archive/VolGroup00_00052.vg VolGroup00 lvscan lvchange -tv -ay /dev/VolGroup00/xxx_company_net_img mount -a

The LVM Volume appears again, is active, but when trying to mount or to check filesystem, we get : losetup failed : loop: can't get info on device /dev/VolGroup00/xxx_company_net_img: Inappropriate ioctl for device

Any ideas how to recover the filesystem ?

Status: 
Closed (fixed)

Comments

I don't think there is any way, sorry .. maybe some LVM experts would know, but I doubt it.

Restored from backup. Lost some emails but nothing critical.

Feature wish : would it be possible to implement double confirmation when deleting VD or VM's, like typing Yes, or some other other possibility ?

I feel really dumb about that.... but it could maybe avoid such problem for ither users.

Thanks anyway.

Cool, glad you managed to get it back! I don't know if double-confirmation makes sense, since there is already a confirmation page for VM or disk deletion.

Well, experience shows it's easy to misread a statement and to click before "oops".

Having coded myself some client database UI, and after some requests to undelete records from the clients, I saw that a double confirmation forces people to concentrate more and reflect twice before actions that could potentially lead to data loss.

Also, as when we transfer a Virtual Domain from a server to another, it could sometimes be usefull to have a checkbox like "donot delete tha associated iage disk" when deleting or moving a VM from a server to another.

Doing so leaves a "backup" in place, in case something goes wrong.

Having more experience with libvirt, it works like that : when we delete a VM in libvirt, we have to manually delete the image disk. It's a supplementary task, but in our case, it would have been big chance...

Anyway it's up to you I understand it's a matter of opinion.

Excuse me to come up again about that incident, but is it possible to have a little bit more information on the way the filesystem is created on the LVM volumes for the KVM virtual machines ?

I realized that it's not possible, even if the VM is down (I tried with a test VM), to mount the LVM volume via standard commands or via webmin's "Hardare / LVM" management features, to access it's filesystem.

Is the ext2 or est3 filesystem inside an image file inside a LVM logical volume ? Is it encrypted ? Is it standard to KVM, or is it particular to the way Cloumin manages VMs ?

Again, thank you for your patience and excellent customer service.

For KVM virtual disks, they are in whole-disk format which includes a partition table. Inside each partition is a standard ext2 or ext3 filesystem. However, you need some trickery to mount those filesystems on the host, as the normal mount -o loop command will not work..

Cloudmin knows how to do this though, and has API commands that can access files within a down KVM instance's filesystem. See :

http://www.virtualmin.com/documentation/cloudmin/devel/cli

and

http://www.virtualmin.com/documentation/cloudmin/devel/cli/cloudmin_file...

Thanks.

What I found is mainly that :

stat-file - Displays information about a file on a managed system. transfer-file - Transfer a file between two systems upload-file - Uploads a file to one or more systems upload-multiple-files - Uploads multiple files to a directory on one or more systems.

But i did not find how to mount the filesystem to be able to navigate in it without attributing it to a VM.

Is it possible ?

Currently there is no command to mount a filesystem, as those other commands mount and un-mount as needed. I chose not to leave a filesystem mounted as this would cause starting the VM to fail, and could break backups..

That said, an API command to mount the filesystem isn't too unreasonable for experienced users. I will look into adding this for Cloudmin 5.1.

Cloudmin 5.1 will add mount-system and umount-system API commands to make access to a VM's filesystem easier..

Thanks a lot ! That's some good news.

Automatically closed -- issue fixed for 2 weeks with no activity.