[Fedora-xen] Accessing data on a xen guest disk image

Dennison Williams evoltech at 2inches.com
Sat Dec 29 20:29:03 UTC 2007


Mark Nielsen wrote:
> Create a new VM using a naming convention different than you do in your
> other guests/VMs/domUs for the logical volumes. Since you are using
> VolGroup/LogVol, I suggest using VolGrp/LogVol... it really doesn't
> matter. You can call it Foo00/Bar00. People seem to overlook the fact
> you can name these anything you want (within reason). You can even name
> it just like you name the logical volume for every other VM you have in
> dom0, but label it something different when you install the domU. The
> label inside dom0 is just for dom0 to track it, you label it again when
> you install the VM so the VM can track it. Basically when you install a
> VM you have a logical volume label nested in another logical volume
> label. In fact, I do this sometimes on purpose. On dom0, I label a disk
> as VolGrp00/LogVol20, then when I install the VM I label it as
> xVolGrp00/LogVol20. Then I set up filters on dom0 (/etc/lvm/lvm.conf) to
> filter out the VM disks from dom0 seeing it. (r|^x|)
> 
> Once you have the new test or recovery or utility (whatever you want to
> call it) VM, then present the disk that you want to recover as the
> recovery VMs second disk. Again, the key is to make sure whatever you
> labelled your root disk inside the VM is different. e.g.
> 
> 
> disk   = ['phy:/dev/VolGrp00/LogVol21,sda,w',
> 'phy:/dev/VolGrp00/LogVol20,sdb,w' ]
> 
> so, LogVol20 is whatever the root disk is of the VM that you are trying
> to recover. LogVol21 is whatever the root disk is for your newly created
> VM that you are going to use for rescue. Again, you can slice off a
> logical volume in dom0 (lvcreate -L10G -n LogVol21 VolGrp00) but when
> you installed the VM, you format/label the disk inside the VM as
> something different (Foo00/Bar00, or VolGroup00/LogVolume00).
> 
> The disk you want to recover shows up as sdb, but you can also mount it
> based on the label of VolGrp00/LogVol20 because the label is there and
> not confused with the root disk of the recovery VM (Foo00/Bar00).
> 
> Then you just simply mount it to /media or /mnt or some other mount
> point you create to get data off it. Or you don't even have to mount it,
> you can just fsck it.
> 
> I've done this several times (more than I really care to remember)
> because of accidentally starting the same VM on 2 different cluster
> nodes. Imagine connecting the same disk to 2 different computers... hehe
> really messes things up good!

I just wanted to follow up on this thread and let everyone know this
technique works like a charm.  If you are installing this "rescue" guest
viz xenguest-install.py and choose a text mode installation, you will
notice that you will not be able to change the name of the Volume Group
in the disk partitioning section, but you will be able to change the the
name of the logical volumes.

Thanks Mark!




More information about the Fedora-xen mailing list