Working With Segmented DD Images

I’ve received a few requests to present a method for creating VMware VMs from segmented images.  This post applies to dd images, as E01s still require the physical mounting method that I presented earlier.  I’ll add that you can use the same approch with a segmented dd image.  However, there are some advantages in going to a VM directly from an image.

We start with same approach as we did with building a VM from a single dd image.  That is, we create a vmdk descriptor file.  However, a little more labor is involved.  As a refresher, here’s a screenshot of the vmdk file that we created for our single dd image.

An editable copy is here.  Remember to change the extension to vmdk.  If we study the above vmdk, we’ll recall that we edited the file to reflect our physical geometry: numbers of sectors, cylinders, heads, and sectors per track.  We left everything else as supplied.  Now, we have a split image.  I’m going to assume that we’re working with 2GB segments.  That seems to be the custom or default with most imagers or examiners.  Even though it’s split, we’ll leave our vmdk type as monolithicFlat.  We start with a split image of 75 segments.

There are two important things to note from the start.  First, we’re dealing with sectors in our vmdk file, while our segments are expressed in bytes.  Next, bytes means number of bytes in the literal sense, and you should determine exactly how many bytes are in each of your segments.  Each, but the last, will be identical in size.  Open the first segment and check.

Here, we have 2,146,435,072 bytes.  That equates to 4,192,256 sectors (2146435072/512).  Our last segment, however, is 1,205,690,368 bytes, or 2,354,864sectors:

Now that we’ve done the math, we simply can substitiute our image segments for the single image file that was in our first vmdk file.

In the interest of space, I cut a bunch of segments from the screenshot.  Just place the vmdk file in the same directory as your image segments.  I’ll bet that there are a few of you who want to JustAskWeg, “Do I really have to type 75 lines in my descriptor file?”  Well, not really.  There are a few shortcuts that I can suggest.  I’m sure that there are others or better approaches, but this works for me.  First, from the command prompt at your image directory, run dir /b >[path to output]images.txt.  You’ll get a text file with contents that looks like this:

Next, copy the list into one field in Excel.  Notice that the format of our list ultimately must look the this:

In Excel, Record A1 is MyImage.001.  In B1, use the following function, but with your own number of sectors instead of 4192256:

=CONCATENATE(“RW 4192256 FLAT”,CHAR(32),CHAR(34),A1,CHAR(34),CHAR(32),0)

Hit enter, and then copy the formula down B1 to the last record in Field A.  Next copy Field B and paste it as a value in Field C.  Watch:

Next, copy Field C into Notepad.  This will remove any special formatting that Excel inserts and which will mess up your vmdk file.  Be sure to edit the size (in sectors) of your last segment.

Then, copy the list from Notepad and paste it into your vmdk file. Thereafter, it should look like the example above.  Lastly, create your VM as though it were being built from a single image.  Take a snapshot, edit the registry, remove the password if required, and sit back in awe of your power!

I want to add a note to express my gratitude to the author of http://sanbarrow.com/, a/k/a Continuum on the VMware Forums.  His web site, as well as his forum posts, comprise the greatest wealth of knowledge about VMware that I have seen.  I’ve learned a lot from our dialog over a number of years.

2 comments

  1. Jean-François says:

    I did something similar sometime ago. It a batch file that will create a VMDK file with split dd files. You can check it out at http://code.google.com/p/jaygeeplayground/source/browse/trunk/dd2vmdk.bat

    Great post by the way.

    Cheers
    JFG

    • jimmyweg says:

      Thanks, Jean-François. I’ll have a look at your file. You obviously had the foresight to see how something like this can make life easier!

Leave a Reply

Your email address will not be published. Required fields are marked *