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] help convert vmdk to xen

To: christopher andrews <khris4@xxxxxxxxx>
Subject: Re: [Xen-users] help convert vmdk to xen
From: Brian Krusic <brian@xxxxxxxxxx>
Date: Sun, 1 Mar 2009 18:38:37 -0800
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sun, 01 Mar 2009 18:39:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <9e14a1260903011543y364bdf11v4a1bcd783e6f113@xxxxxxxxxxxxxx>
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: <9e14a1260903011543y364bdf11v4a1bcd783e6f113@xxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Hi Christopher,

First, look into qemu-img that converts VMware .vmdk to Xen .img.

I've been through a few iterations and found this to be the best for me.

** I use Centos as my domUs.

Create a Xen domU with the desired settings. If you can, custom layout the partition and do it all in plain old ext3-no LVMs.

I prefer to have just a / partition where both root and /boot live as my days of filling up / and killing the OS are over.

** Update both Xen domU and your VMware guest to the latest packages so they are in sync, just a precaution. Or at least make sure they are in sync.
** Remove any VMware drivers from your VMware guest.

Once you have it all up and running, down it and then mount the disk image on your dom0 under what ever dir u like, something like /foo I guess (I use lomount for this).

Now export /foo and mount that export on the VMware box as /foo.

From your VMware guest, change to /foo and do;

** make sure you are in /foo
1 - mv all etc/sysconfig/network* to network*.o so for example, the file network becomes network.o, the dirs networking and networking- scripts each are renamed with a .o suffix.
2 - mv etc/sysconfig/grub to grub.o.
3 - mv etc/sysconfig/hwconf to hwconf.o
4 - mv etc/sysconfig/kernel to kernel.o
5 - mv etc/modprof.conf to modprobe.conf.o
** see the pattern here

6 - while still living in /foo, do dump -L 0 -f - / | restore -r -u -f -
7 - Once finished, remove the .o suffix, over writing the existing files/dirs.
8 - Adjust hostname, ip to taste and unmount the export.
9 - Now, back on your dom0, unexport /foo and unmount it.
10 - Fire up that domU up, all should be well.

I've done this on about half a dozen boxs and all is well.

** While there are certainly better options and from more qualified ppl on this list as I am very green, this works for me.

** This is basically syncing 2 OS's and then modifying the target back to what makes it a Xen OS.

** I think you went a little too far with separate mounts for /var, / tmp and /home so adjust the above to incorporate those mnt points. I don't want to debate system design as you have a good reason for doing this but my professor emphasized the KISS principle, he was an ex marine.

** If you want to keep with the LVM theme, then read the below thread from a very knowledgeable and helpful comrad in arms on how to mount LVMs;

Brian Krusic wrote:
Forgot, my conf files disk line of interest looks like this;

disk = [ "tap:aio:/var/lib/xen/images/foo.img,xvda,w" ]

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.

jch


- Brian




On Mar 1, 2009, at 3:43 PM, christopher andrews wrote:

I have vmware server 2.0 vmdk that is using lvm within the vmware vmdk. I can i convert it so i can use it with xen, i been trying ever on the web but have found a solution that work.

Here is the vmdk fstab runing centos 5.2
/dev/VolGroup00/LogVol03 / ext3 defaults 1 1 /dev/VolGroup00/LogVol00 /var ext3 defaults 1 2 /dev/VolGroup00/LogVol02 /tmp ext3 defaults 1 2 /dev/VolGroup00/LogVol04 /home ext3 grpquota,suid,dev,usrquota,exec 0 2 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/VolGroup00/LogVol01 swap swap defaults 0 0


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


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

<Prev in Thread] Current Thread [Next in Thread>