Re: mounting images created using dd that contain two partitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Ok, this is what I did in the exact same situation (solution below  
gotten from the xen list).

I use it religiously.

Lucky I'm on both forums.


**********************************************

First make sure your guest isn't running unless you want to trash its  
file systems.

losetup -f /var/lib/xen/images/foo.img
losetup -a
# Make a note of which device corresponds to /var/lib/images/foo.img,
# 'll call it /dev/loopN but it's probably /dev/loop0
kpartx -va /dev/loopN

You'll get two new entries in /dev/mapper now: /dev/mapper/loopNp1  
and /dev/mapper/loopNp2.   loopNp1 is /boot (asume you have got a  
standard layout).   loopNp2 is a volume group.   You can just mount
/dev/loopNp1 to poke around the /boot file system.

Now

vgscan

This is where you might come unstuck.   The default volume group for  
Red Hat and similar is "VolGroup00".  If your dom0 is using LVM and so  
is the guest then you'll have do VolGroup00's and that's bad.   The  
best thing to do now is to boot a rescue image in a different domU and  
rename the guest's volume group.  You'll need to undo the kpartx and  
losetup (see below first) and when you've all finished then you'll  
need to either fix up the guest's /boot/initrd*.img, /etc/fstab and / 
boot/grub/grub.conf to hold the new name or you'll have to rename it  
back again in the rescue guest.

Anyway, assuming you don't get a clash:

vgchange -ay VolGroup00

The guest's file systems are now in /dev/VolGroup00 and you can mount  
them as normal.

To undo everything:

1.  umount any file systyems you mounted
2.  vgchange -an VolGroup00
3.  kpartx -d /dev/loopN
4. losetup -d /dev/loopN

And next time you build a system, change the name of its volume group  
so you don't wind up with two systems with the same volume group  
name!   And I wish Red Hat had listened to me years ago when I said  
that "VolGroup00" was a really poor idea.


**********************************************


On Sep 26, 2009, at 8:11 PM, Devraj Mukherjee wrote:

> Hi aurf,
>
> On Sun, Sep 27, 2009 at 1:09 PM,  <aurfalien@xxxxxxxxx> wrote:
>> Is your local host using LVMs and if so, is your volume group
>> something like VolGroup00?
>>
>
> Yes it uses LVM and has VolGroup00
>
>> Is your image file also of a VolGroup00?
>>
>> - aurf
>
> Yes this is true as well.
>
> -- 
> "The secret impresses no-one, the trick you use it for is everything"
> - Alfred Borden (The Prestiege)
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux