xen-users
Re: [Xen-users] how do I increase a LVM based xen domU?
On Thu, Sep 18, 2008 at 10:20 AM, Fajar A. Nugraha <fajar@xxxxxxxxx> wrote:
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).
With Virt-install I can at least choose all the packages I need to install, and the installation files are on the server already, so I don't need to waste bandwidth every time I install it.
Would it be better to install the VPS with an ext3 partition instead of LVM? In which case it will have 3 partitions (/boot, / & swap) but that shouldn't be a problem, right? Can an ext3 partition (for the domU) on a LVM (dom0) be resized easily?
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)
Installing CentOS / Fedora Core onto CentOS is easiest with virt-install, for me :) I've tried the debootstrap option before, but have had no luck getting it to work.
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?
Yes, I wanted to add a separate swap partition, but haven't figured that out yet.
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
Do I need to create a configuration file for the wiseguy2 domU manually?
And then, for the following steps, for I need to mount /dev/System/wiseguy2 on say /mnt/wiseguy2 - on dom0, or do I need to boot wiseguy2 domU ?
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
-- Kind Regards Rudi Ahlers
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|
|
|