VMware vSphere

 View Only
Expand all | Collapse all

Converting from a raw image created with dd to an ESX3 VM?

  • 1.  Converting from a raw image created with dd to an ESX3 VM?

    Posted Aug 28, 2007 07:22 PM

    I've tried using qemu-img to convert form raw to vmdk, but it won't write past the 2gb mark.

    In the past, I've had to use dd within a VM to write a raw file out to a virtual disk.

    I was wondering if there was an easy way to convert raw disk images into a usable form for virtual machines?

    Thanks,

    -- Dave



  • 2.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Aug 28, 2007 10:33 PM

    Yes - use a windows-host - mount the dd-image with vdk.exe - it will detect the geometry-data - then edit this sample

    http://sanbarrow.com/vmdk/disktypes.html#monolithicFlat

    if it is a disk-image with MBR

    or edit this sample

    http://sanbarrow.com/vmdk/disktypes.html#partitionedDevice

    if it is a partition-image - you need to add an MBR in this case

    Google has more in depth howtos - also Petr explained it once - some hundred years a go

    Once yoy got that - import via converter or vmkfstools.

    For a one time procedure - forget all this and restore the dd-image directly into a ESX-disk - while booting into a helper VM (Knoppix-LiveCD ...)



  • 3.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 04, 2007 01:20 PM

    Yeah, I've done the dd direct to mounted disk in VM method before...

    I'm just looking for something faster, that I can automate.

    I messed with vdk on Friday, but I ran into an issue I can't remember at the moment...

    I'll futz with it in a few and get back to you if I have issues.

    Thanks,

    -- Dave



  • 4.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 04, 2007 08:02 PM

    Nope, nothing worked.

    The dd image is of a linux SCSI disk and none of the tools I've tried using seem to like looking at linux partitions, or messing with SCSI disks.

    I managed to get info on it with vdk, but nothing that would help me calculate the C/H/S properly so that I could convert the image to VMFS for ESX3.

    The sanbarrow page you linked me for "monolithicFlat" doesn't work, as "FLAT" is not a compatible format for ESX3.

    I tried loading the disk in vmware converter to push it to ESX3 and converter replied back that the disk was not a valid VMware disk.

    -- Dave



  • 5.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 04, 2007 08:48 PM

    >>> The sanbarrow page you linked me for "monolithicFlat" doesn't work, as "FLAT" is not a compatible format for ESX3.

    Never said it would be - also read - you may be able to make it ESX-readable

    http://sanbarrow.com/vmdk/monolithicFlat-with-WS-and-ESX.html



  • 6.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 02:34 PM

    I tried the disk as VMFS as well...that's actually the first thing I tried.

    I'm still concerned that my # of cylinders is off, and I'm not sure how to accurately get a correct #.

    I was hoping that VDK would give me all of that info so that I cold build a proper .vmdk descriptor file, but it only gave me partition sizes (in MB) that the image contained.

    Is there a better way to pull C/H/S info from the image?

    Thanks,

    -- Dave



  • 7.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 03:02 PM

    Update:

    I just did a ls-l on the original dd image, pulled the disk size in bytes and threw that # into "vmkfstools -c"

    That created a descriptor and a disk file the exact same size as the original dd image.

    I tried using that descriptor and pointed it at the dd image (renamed to blah-flat.vmdk) and still had no luck :smileysad:

    I'm running it through vmkfstools -i right now to clone it to another virtual disk, but the image is 200gb in size and will take a while, even at SAN speeds, to convert over.

    I'll see if it works then, but I'm not hopeful.

    Thanks,

    -- Dave



  • 8.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 05:40 PM

    The convert finished, but VMware still doesn't recognize the disk :smileysad:

    I guess booting a new VM with knoppix and doing a straight dd into a virtual disk is my only other option...

    -- Dave



  • 9.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 05:52 PM

    There are 2 steps needed:

    1. Imaging your raw disk into a VM's virtual disk.

    2. Making the disk bootable. You'll need to update the SCSI driver and remove any hardware that wouldn't work in a VM and would interfere with normal boot-up. This can be done by booting off an installation CD in rescue mode.



  • 10.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 06:11 PM

    @ pangchen

    OP wants to avoid this road.

    He wants to convert the dd-image directly into a vmdk - without needing to restore it with booting Knoppix.

    If the dd-image is a full-disk image and uncompressed this is possible - it is just badly documented.

    Petr once described it ...



  • 11.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 06:30 PM

    Correct.

    I'm going to try again with a few other dd images that I have lying around...maybe something smaller this time.

    Experimenting with a 200gig image takes a long time...

    I'm going to do it with a 20 gig disk this time.

    -- Dave



  • 12.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 07:13 PM

    Make sure you create full-disk images - not just partition images



  • 13.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 07:38 PM

    @ continuum

    So then we assume that the dd image is of a disk with the necessary SCSI controllers for a VM already?



  • 14.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 07:50 PM

    Dave never mentioned this - so I assume he knows what he is doing and has a way to handle this.

    Pangchen - I know that this is not the recommended way - but it looks like Dave is an advanced user and knows what he is doing.

    Whats wrong with finding the knowhow for this ?

    I know that it is possible, Petr once described it and there are even programs that automate the dd-image to monolithicFlat procedure.

    Once he has the monolithicFlat he can rewrite it to be used by ESX directly. I have done so a couple of times.

    You may look at LiveView:

    http://liveview.sourceforge.net/

    They use Java and vmrun from WS 6 to convert dd-images to vmdks.

    Message was edited by:

    continuum



  • 15.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 09:51 PM

    Dave never mentioned this - so I assume he knows what

    he is doing and has a way to handle this.

    Pangchen - I know that this is not the recommended

    way - but it looks like Dave is an advanced user and

    knows what he is doing.

    Whats wrong with finding the knowhow for this ?

    Oh I'm not saying there is anything wrong with this approach. Just wanted to make sure all the potential problems were being considered. Yes, it would be great for this approach to be tested and then documented for others to try and use.



  • 16.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 05, 2007 10:03 PM

    Would you mind and ask Petr how to create the monolithicFlat descriptor ?

    If he explains this again Dave and me could run some tests and then document the procedure



  • 17.  RE: Converting from a raw image created with dd to an ESX3 VM?

    Posted Sep 07, 2007 02:21 PM

    The dd images I am working with are all redhat/fedora and already have scsi support. I wanted to make this easy and didn't want to worry about "gotchya's" like that.

    As for doing this windows side, I have a full p2v license, so I can just use that for driver injection. That should handle most images I come across.

    I downloaded and installed LiveView last week, and I had an issue with it, but I can't remember what it is at the moment. I'll give it another go and report back.

    Thanks,

    -- Dave