WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

[Xen-users] Recovering from VM file system corruption (in a LV inside a

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-users] Recovering from VM file system corruption (in a LV inside a LV)
From: Kyle Lexmond <kyl191@xxxxxxxxx>
Date: Sun, 14 Nov 2010 18:13:20 +0800
Delivery-date: Mon, 15 Nov 2010 05:55:53 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:received :mime-version:received:from:date:message-id:subject:to:content-type; bh=7D8L1+2nMbg0cwCmgojrwQB3VdU2uLPvOo4PMQf3bhc=; b=wBiJUMCBtUQ+foMJsGrhGvl4tRcrO+XgztQxhQ6cLADrCKk+S1WpD7ujHOjZVXlbUW CfymPPv55wOXUzaQ9JHue7lj3tk1LNhbB120T4REbhS0hXnHnwK/FxjBK4SggpFdG5F3 GRAtjNU6bjDDul74CHtqDaEo/u8Nc9xyyQ+/4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=S5h4DSKJUdeJ5BduFNyFCauelaK/eOCo3B/zc9npERcyKYn5YxHTH2Cjr52XeYrK4p 2hAby/vsNhJ0S8LVAjWHhOIfTtjofr0HVSUyeImahI5k8Gv9aD4gscDcN9eGWx9sfs8r bQMwAFrfvu4MYYxS478bTmmF9GyBa9ECQTyrY=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Hi list,
Recently one of my VMs crashed, and couldn't reboot due to filesystem
corruption. It's a Fedora 13 host, and I installed a Fedora 13 VM
using virt-install, which by default creates an LVM for the root
partition. Now, the partition that was corrupted was the root
partition, so I couldn't boot into the VM and recover it, like I would
if /home was corrupted.

Because I searched to mostly no avail how to recover a partition in a
logical volume in a VM which itself is in a logical volume on the VM
host, which the LV partitioned into /boot and the remaining space used
for LVM, I'm posting the steps here, hopefully so someone in a similar
situation can be helped.

Step 1: Run kpartx -a /path/to/logical/volume
For me, this was kpartx -a /dev/domU/helium. This created two block
devices in /dev/mapper - domU-helium1 and domU-helium2. helium1 was my
/boot, helium2 was used for LVM.

Step 2: Run vgscan.
This will give you a list of the volume groups on your system,
hopefully including the volume group from your domU.

Step 3: Run vgchange -a y volume_group_from_VM
This will activate the logical volumes in the VG. Block devices should
appear in /dev/mapper. For me, what appeared was vg_helium-lv_root.
>From there, it's a simple fsck /dev/mapper/vg_helium-lv_root. Wait for
it to finish before you clean up after yourself.

Step 4: To clean up, you have to deactivate the LVs before destroying
the block devices that kpartx created. To do this, run vgchange -a n
volume_group_from_VM .

Step 5: Finally, run kpartx -d /path/to/logical/volume

Hopefully this helps someone - Googling "Recover file system xen
image" and variants thereof mainly turned up references to kpartx, not
the necessary LVM stuff. The most helpful link was
http://support.citrix.com/article/CTX117791, but it seems overly
complicated and has XenServer specific tools mentioned.

I'll see if I can update the xen wiki too...

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-users] Recovering from VM file system corruption (in a LV inside a LV), Kyle Lexmond <=