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/
Home Products Support Community News


Re: [Xen-users] Convert CentOS system to Xen image?

On Mi, Apr 02, 2008 at 09:19:53 -0400, James Pifer wrote:
> > Can you run 
> > 
> > file -s /dev/ida/c0d0
> > 
> > on the host where from
> > you have copied the image?
> > 
> # file -s /dev/ida/c0d0
> /dev/ida/c0d0: x86 boot sector
> > Size=4G <- is it ok?
> > You have said that your HDD is 8GB size
> No, actually the used space is a little over 8GB. The LV is about 18GB.

fdisk output shat you have showed before
says, that your image is about 4G.

It means that you haven't copied entire disk.

When you do raw data copying (using cat or dd),
result file will have size of the source disk (18G in your case,
or even more if your disk has greater size; and 18G is LV, but not
the disk, size).

So, it's better, may be, to do not raw copying in your case, 
but files copying.

If you have LVM installed on target system, you may create
new LV, format it and mount.


lvcreate -L 8G -n centos /dev/VG
mkfs.ext3 /dev/VG/centos
mount /dev/VG/centos /mnt/

If you have not, than you regular files:

dd if=/dev/zero of=centos-new.img count=$[8*1024*1024] bs=1k
mkfs.ext3 centos-new.img  # (press y here)
mount -o loop centos-new.img /mnt/

After that
you may start to copy files:

target#   rsync -a --exclude=/sys --exclude=/proc --exclude=/dev source:/ /mnt/

When copying will be finished:

target#  mkdir -p /mnt/{sys,proc,dev}
target#  cp -a /lib/modules/VERSION_OF_THE_PV_KERNEL_HERE /mnt/lib/
target#  cat <<EOF > /mnt/etc/fstab
proc                        /proc               proc    defaults 0       0
/dev/hda1                   /                   ext3    defaults 0       0

After that 

umount /mnt

And create config file for new domain.

This is a PV domain, not an HVM!
So you need new config file.

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

WBR, i.m.chubin

Xen-users mailing list