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

Re: [Xen-users] Mounting Xen LVM Guests

To: "Fajar A. Nugraha" <fajar@xxxxxxxxx>
Subject: Re: [Xen-users] Mounting Xen LVM Guests
From: Eredicatorx <eredicatorx@xxxxxxxxxxxxxxx>
Date: Thu, 08 Jan 2009 12:26:12 +0900
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 07 Jan 2009 19:27:13 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <496477D7.3040406@xxxxxxxxx>
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>
References: <1915834324.411231316784019.JavaMail.root@web01> <496477D7.3040406@xxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)
Fajar A. Nugraha wrote:
Okay. From your post, I gather that /dev/xen-system/test01.max is LV on
dom0 used for domU's disk.
I don't see you using kpartx.

If fdisk -l says

#     Device Boot      Start         End      Blocks   Id  System
#test01.max1   *          63      208844      104391   83  Linux
#test01.max2          208845    20964824    10377990   8e  Linux LVM

Then running "kpartx -av /dev/xen-system/test01.max" should create
/dev/mapper/test01.max1 and /dev/mapper/test01.max2 (or something similar).

/dev/mapper/test01.max1 -> domU's /boot
/dev/mapper/test01.max2 -> domU's PV

You can mount /dev/mapper/test01.max1 to get domU's /boot, but to get
domU's "/" you need to do more. After you get /dev/mapper/test01.max2,
try running pvscan and vgscan again and pray that you get a new VG. That
would be domU's VG.

IMHO, the steps above are painful. So I'd suggest that you reinstall
using only one partition (/) WITHOUT LVM, WITHOUT SWAP. If you don't
have enough memory and absolutely need swap, use another LV on dom0 for
that (in other words, domU will have two disks : one for /, one for
swap). This way, you don't need vgscan (and don't have to worry about
conflicting VG names) anymore. You simply need fdisk and kpartx (for
both the working domU and the new domU).

There is another method which uses dom0's LV directly as domU's fs.
Assuming you have succesfully mount a working domU, you can do something
like this :

- create two new LV's on dom0 : /dev/xen-system/test03root and
/dev/xen-system/test03swap
- mkfs.ext3 /dev/xen-system/test03root
- mkswap /dev/xen-system/test03swap
- mount /dev/xen-system/test03root somewhere
- copy all files from the working domU (including /boot) with either
rsync -av, cp -av, or tar (I like tar better)
- adjust new domU's config file to look like this

memory = "2000"
disk = [
       'phy:/dev/xen-system/test03root,xvda1,w',
       'phy:/dev/xen-system/test03swap,xvda2,w',
       ]

Note the difference : it's xvda1 and xvda2, NOT xvda and xvdb.
you can use either hda1/2, sda1/2, or xvda1/2. xvda is probably best on
Centos.

- edit new domU's fstab to use xvda1 as "/" and xvda2 as swap
- unmount new domU's fs
- startup new domU
- create an archive (tar.gz or something) of the original domU. That
way, subsequent domU's only need to extract from that archive.

This way you don't need fdisk, kpartx, or pv/vgscan to create another domU.

Fajar, Fabian, Mark,

Thanks for your advice on this I am going to spend the day trying to tackle this inbetween what ever fires break out and will let you know how it goes later.

E./


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