Skip to main content

VirtualBox Corrupts My VMware VMDK Files!

I hate it when I’m stupid.virtualbox-logo-1

I started blogging again, and wrote about how I am now using Windows Live Writer as my blog editor. Problem is, that I use Mac computers exclusively, so I needed to run WLW under VMware Fusion (inside a Windows Virtual Machine).

That works pretty well, for the most part, but VMware Fusion does not do copy/paste of images between the virtual machines (yet). And, since I like to include an image with every post, it’s kind of a pain to save the image to a file under Mac OS X only to turn right around and load the image into Windows Live Writer. For me, the writing process is enhanced when friction is removed from the process.

So, I thought, naively, that perhaps the free VirtualBox tool might have this capability. Download the product and install it on my Mac OS X Leopard Server and give it a go. The VirtualBox site says that you can use your existing VMware VMDK (Hard disk image) files with VirtualBox. There is evena video showing you that it works great. The VirtualBox User manual says:

Starting with version 1.4, VirtualBox also supports the popular and open VMDK container format that is now supported by a large number of virtualization products. This means you can import your existing VMDK files by way of the Virtual Disk Manager just like existing VDI images; see chapter 3.5, The Virtual Disk Manager, page 34. While VirtualBox fully supports using VMDK files in most situations, the more advanced features of virtual hard disks are presently not supported.

After trying, and failing, to import my VMDK files into VirtualBox, I found, much to my dismay, that my VMDK files were trashed by the VirtualBox import and no longer readable by VMware Fusion. The term "import" usually implies that it is non-destructive. Nope.

I blamed the Fusion failure on the Apple Security Update that I had just installed. Silly me.

After quite a few hours of reading VirtualBox code and poking around with the VMware VMDK on-disk formats, I was able to "patch" my VMDK files into something that Fusion would once again read. Take a look at the VMware Community Forum article for detailed history.

In the corrupted VMDK that was mucked with by VirtualBox, mine looked like the following:

# Disk DescriptorFile

# Extent description
RW 41963828 SPARSE "AmyOffice-000001.vmdk"

# The Disk Data Base

ddb.toolsVersion = "7362"
ddb.virtualHWVersion = "6"

And, it was padded by NULL characters. I extracted it from the VMDK using "dd":

# dd if=AmyOffice-000001.vmdk bs=512 skip=1 count=2 > out

I didn’t like the look of the entries: Note that there is no equals sign between the cylinders/heads/sectors section at the bottom and the values. That did not sit well with me at all. Nor did I like the value of the cylinders was 0 and the heads/sectors did not match the binary values in the first data structure after the MAGIC KMDV in the VMDK file.


Comparing this text header info with a very old backup of my VMDK file, it appeared that I could drastically simplify this section.

So, I did.

I edited the "out" file, and made the following changes:

  • Changed the CID to 613506eb
  • Deleted everything after this line (but keep it in): ddb.toolsVersion = "7362"
  • Extended the NULL padding at the end to get the file back up to 1024 bytes exactly.

Then, I patched the VMDK with the following command:

# dd conv=notrunc if=out of=AmyOffice-000001.vmdk bs=512 oseek=1 count=2

Don’t forget the "conv=notrunc", or your VMDK file will be truncated (which I did, and had to copy over from backup again, sigh).

And, guess what? The VMware Virtual Machine booted up with no problem!

I promptly uninstalled VirtualBox. You get what you pay for sometimes.

Now, if I could just get Time Machine to efficiently backup my 30GB Windows VM…

Tags: VirtualBox, VMware Fusion, VMware, Fusion, Virtualization, Open Source, Brian Berliner,brianberliner


  1. Wow, impressive save.

    No software is perfect (not even Mac OS X, grin). But I've had my share of badness for not making a working copy.

    Also, if you weren't able to save the VMDK, perhaps data could've been salvaged by using one of VMWare's disk mount tools.

    Thanks for the post; again, impressive save.


Post a Comment

Popular posts from this blog

Bill Coleman Joins 3tera Advisory Board

I think this move surprised a number of people, since Bill recently wrapped up Cassatt Corproation, getting the technology and people  acquired by Computer Associates . However, I was not surprised at all. The announcement, via  3tera Welcomes Bill Coleman : You may or may not have seen the recent press realease.  Bill Coleman, IT/Silicon Valley luminary, Founder and CEO of BEA Systems, has joined 3Tera’s Advisory Board. Yes, this alone is a great testimonial to what we have accomplished in our field.  Getting dignitaries such as Bill does not come easy.  But here’s the best part - this has a lot more than just marquee value and I doubt that Bill would have joined us if that was the case.  Bill, especially since his most recent stint as Founder and CEO of Cassatt Systems, is an extremely knowledgeable visionary in the area of utility and Cloud Computing; and, data center automation. So, Bill will be extremely valuable, reviewing and tweaking both our business plans and techno

Big In Japan Open Sources Their Ruby On Rails Tools

The kind folks over at Big In Japan have graciously decided to Open Source the code they used to build their demo web sites . It's all Ruby on Rails code, and it's being released with a GPL license. The code trees being made available include: elfURL ~ URL Shortner FeedVault ~ OPML file storage FrankenFeed ~ RSS feed merger InstantFeed ~ RSS feeds via email QwikPing ~ Ping Server SocialMail ~ RSS via email Very cool. I just love the Open Source community . I have actually been writing some code of late, and it's great to have some reference code to check out. Not sure if I'm going to go with Ruby on Rails yet, however. And, for the record. I have no idea if this is big in Japan. Tags: Open Source , GPL , Ruby On Rails , Big In Japan , Brian Berliner , brianberliner

CA Acquires 3Tera – It’s About Time!

I started tracking 3Tera in August 2005. They made some amazing progress with their AppLogic release in the next 12 months and things were really starting to look good, so I wrote my first article about them in September 2006 . A couple weeks later, ReadWriteWeb called them out as well . Time passed. 3Tera was early. The market was maturing. Keep pounding away at it… Meanwhile, Cassatt Corporation, the company I co-founded in April 2003 with Bill Coleman and Dave McAlister, sold its technology assets and people to Computer Associates in June 2009 . The Cassatt team was all over scalable “cloud” computing architectures and the management thereof. CA’s acquisition, combined with some of their other aggressive moves in this space (the similar acquisitions of NetQoS, Oblicore, Orchestria, Platinum Technology, and Netreon) made it clear that CA saw some white-space for them to expand into cloud management in a big way. Next, I reported how Bill Coleman joined up with 3Tera as