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

Re: [Xen-users] how do I increase a LVM based xen domU?



Rudi Ahlers wrote:
>
> On Thu, Sep 18, 2008 at 8:53 AM, Fajar A. Nugraha <fajar@xxxxxxxxx
> <mailto:fajar@xxxxxxxxx>> wrote:
>
>
>     Best practices would be :
>     1) LVM on dom0 -> maps to xvda on domU -> LVM on domU, using xvda
>     as PV
>     (which is what Redhat does by default if you install RHEL5 PV)
>     2) LVM on dom0 -> maps to (xv/s/h)da1 on domU, and mounted directly
>     without additional partitioning or LVM on domU.
>
>     It might be easier to move to  (1) or (2)
>     and move the data.
>

> Ok, so when I create a domU VPS, and I start the installation (in this
> case it's CentOS 5.2), how should I partition it?
>

If you install it using anaconda (which is what you get if you use
virt-manager) the default partitioning scheme is to use LVM on domU.
This is (1), which AFAIK is what RH recommends. It will enable easy disk
addition (you dan do xm block-attach online without having to restart
domU).

Personally, I don't like this approach because it's harder (although
possible) to mount domU's fs in dom0 (you have two LVM layers to deal with).

Layout(2) is somewhat more complicated because it requires either :
- you modify an existing install, or
- you have a template OS tarball, or
- you're using a distro that can install to a directory from command
line (i.e. something like debootstrap for debian/ubuntu)

Note that once you have a template tarball, installing (2) is VERY easy.

> And is there any way to copy the existing data on this domU to a newly
> created one? 
>
>
Copying the data is the same as you'd do on a normal linux install :
rsync, tar, dd, etc.

I just realized that your xvda doesn't contain a swap partition. Is this
intentional?
Assuming you want to copy this existing install and modify it to (2),
these steps might work.

The following assumes :
- you're using PV domU, not HVM
- your current domU is called "server"
- your dom0 VG is called "System"
- you only have a filesystem ("/") on domU

On dom0:
- create a new LV (10GB or whatever) on dom0
lvcreate -L 10G -n wiseguy2 System
- attach the block device as xvdb1 (or whatever partition currently
unused on domU)
xm block-attach server phy:/dev/System/wiseguy2 xvdb1 w

On domU (make sure you doublecheck everything you type):
- do "fdisk -l". You should see a new disk /dev/xvdb1
- mkfs.ext3 /dev/xvdb1
- mkdir /mnt/tmp1; mount /dev/xvdb1 /mnt/tmp1
- mkdir /mnt/tmp2; mount --bind / /mnt/tmp2
- cd /mnt/tmp1
- ( cd /mnt/tmp2 && tar cvf - . ) | tar xvf -
- cd /mnt/tmp1/boot
- ( cd /boot && tar cvf - . ) | tar xvf -
- edit /mnt/tmp1/etc/fstab, remove the line for /boot, edit the line for
"/" to use "/dev/xvda1" instead of the original "/dev/xvda2"
- edit /mnt/tmp1/boot/grub/menu.lst, adjust the boot entry to look
something like this

default=0
timeout=5
title New-Centos
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18-92.1.10.el5xen ro root=/dev/xvda1
    initrd /boot/initrd-2.6.18-92.1.10.el5xen.img

At this point you have xvdb1 which contains the original xvda1 (/boot)
and xvda2 (/) merged. Next :
- shutdown domU (it's much easier this way)
- create a new xen config file with disk line which looks something like
this

disk = [ 'phy:/dev/System/wiseguy2,xvda1,w' ]
bootloader="/usr/bin/pygrub"

Note that it says "xvda1", and not xvda. The xvdb1 that you created
earlier will be mounted as xvda1 on the new domU.

- start the new domU. It should work. If it boots succesfully, you might
want to consider creating a tarball of the fs inside
/dev/System/wiseguy2 for future installs.

Regards,

Fajar

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.