Dennison Williams
2007-Dec-23 02:16 UTC
[Fedora-xen] Accessing data on a xen guest disk image
I asked this question in the fedora forums (http://forums.fedoraforum.org/showthread.php?t=176102), but no one seemed to have a answer. I have installed and worked with a few different xen guests via the instructions at FedoraXenQuickstartFC6 (http://fedoraproject.org/wiki/FedoraXenQuickstartFC6). In doing this I installed the guests on a LVM volume and would like to access the guest disk image. There is documentation on howto do this in the above wiki (http://fedoraproject.org/wiki/FedoraXenQuickstartFC6#head-9c5408e750e8184aece3efe822be0ef6dd1871cd). The problem I have is that my dom0 has the same logical and physical volume names for its root device as my domU (ie. VolGroup00, LogVol01). Does anyone know how to get around this name space collision so that I can mount my guest disk? Sincerely, Dennison Williams
Mark Nielsen
2007-Dec-23 02:41 UTC
Re: [Fedora-xen] Accessing data on a xen guest disk image
I name my VMs with VolGrp/LogVol, then I have 1 test/rescue VM that I create using VolGroup/LogVol. Just having that 1 VM with a different naming convention allows me to present any other VMs disks to my test/rescue VM and mount them for repairs, recoveries, etc. Mark Dennison Williams wrote:> I asked this question in the fedora forums > (http://forums.fedoraforum.org/showthread.php?t=176102), but no one > seemed to have a answer. > > I have installed and worked with a few different xen guests via the > instructions at FedoraXenQuickstartFC6 > (http://fedoraproject.org/wiki/FedoraXenQuickstartFC6). In doing this I > installed the guests on a LVM volume and would like to access the guest > disk image. There is documentation on howto do this in the above wiki > (http://fedoraproject.org/wiki/FedoraXenQuickstartFC6#head-9c5408e750e8184aece3efe822be0ef6dd1871cd). > The problem I have is that my dom0 has the same logical and physical > volume names for its root device as my domU (ie. VolGroup00, LogVol01). > Does anyone know how to get around this name space collision so that I > can mount my guest disk? > > Sincerely, > Dennison Williams > > -- > Fedora-xen mailing list > Fedora-xen@redhat.com > https://www.redhat.com/mailman/listinfo/fedora-xen >
Dennison Williams
2007-Dec-23 02:45 UTC
Re: [Fedora-xen] Accessing data on a xen guest disk image
Mark Nielsen wrote:> I name my VMs with VolGrp/LogVol, then I have 1 test/rescue VM that I > create using VolGroup/LogVol. Just having that 1 VM with a different > naming convention allows me to present any other VMs disks to my > test/rescue VM and mount them for repairs, recoveries, etc.I don''t really understand what you are saying here. What do you mean when you say "I have 1 test/rescue VM that I create using VolGroup/LogVol". Can you be a bit more explicit? cc''ing the fedora-xen mailing list so that others in the same boat can benefit from your advice.
Mark Nielsen
2007-Dec-23 18:21 UTC
Re: [Fedora-xen] Accessing data on a xen guest disk image
Let me ask this first: what is it exactly that you are trying to do? If you are trying to mount a guest disk on dom0, why? The times I''ve needed to access a VMs disk has been when something terrible has happened to the VM and I''ve needed to mount the VMs disk so I can recover information of try to fsck it. I do this by having a stand-by VM that uses a different naming convention that my other VMs use. This way I can use my test/rescue VM to mount up the other VMs disks and fsck them, or recover data from them. Dennison Williams wrote:> Mark Nielsen wrote: > >> I name my VMs with VolGrp/LogVol, then I have 1 test/rescue VM that I >> create using VolGroup/LogVol. Just having that 1 VM with a different >> naming convention allows me to present any other VMs disks to my >> test/rescue VM and mount them for repairs, recoveries, etc. >> > > I don''t really understand what you are saying here. What do you mean > when you say "I have 1 test/rescue VM that I create using > VolGroup/LogVol". Can you be a bit more explicit? > > cc''ing the fedora-xen mailing list so that others in the same boat can > benefit from your advice. >
Dennison Williams
2007-Dec-23 22:18 UTC
Re: [Fedora-xen] Accessing data on a xen guest disk image
Mark Nielsen wrote:> Let me ask this first: what is it exactly that you are trying to do? If > you are trying to mount a guest disk on dom0, why?I am trying to recover the data located on my guest disk. This guest disk is a logical volume in dom0. The guest disk and the dom0 disk are managed by LVM each with the same naming convention (VolGroup00/LogVol0[0-1]).> > The times I''ve needed to access a VMs disk has been when something > terrible has happened to the VM and I''ve needed to mount the VMs disk so > I can recover information of try to fsck it. I do this by having a > stand-by VM that uses a different naming convention that my other VMs > use. This way I can use my test/rescue VM to mount up the other VMs > disks and fsck them, or recover data from them.I am unclear about how I could access a LV on dom0 from a domU VM. Can you explain how this would be done?
Mark Nielsen
2007-Dec-23 22:41 UTC
Re: [Fedora-xen] Accessing data on a xen guest disk image
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! Happy Holidays! Dennison Williams wrote:> Mark Nielsen wrote: > >> Let me ask this first: what is it exactly that you are trying to do? If >> you are trying to mount a guest disk on dom0, why? >> > > I am trying to recover the data located on my guest disk. This guest > disk is a logical volume in dom0. The guest disk and the dom0 disk are > managed by LVM each with the same naming convention > (VolGroup00/LogVol0[0-1]). > > >> The times I''ve needed to access a VMs disk has been when something >> terrible has happened to the VM and I''ve needed to mount the VMs disk so >> I can recover information of try to fsck it. I do this by having a >> stand-by VM that uses a different naming convention that my other VMs >> use. This way I can use my test/rescue VM to mount up the other VMs >> disks and fsck them, or recover data from them. >> > > I am unclear about how I could access a LV on dom0 from a domU VM. Can > you explain how this would be done? > >
Dennison Williams
2007-Dec-29 20:29 UTC
Re: [Fedora-xen] Accessing data on a xen guest disk image
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!