Jump to content











Photo
- - - - -

vhd2img command line tool


  • Please log in to reply
8 replies to this topic

#1 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 19 December 2011 - 08:34 PM

Hi Gents,

A while ago I had to code a vhd to image function for my software CloneDisk.
I followed these specs from MS : http://www.microsoft...ang=en&id=23850 .

Here attached (yet another) a quick & dirty command line tool to convert a fixed or dynamic VHD to a raw image.
Zip file includes source file to help developp other tools around VHD format.

Code needs to be cleanup, debuuged, documented, etc but.. it works and above all I wanted to share with others delphi developpers. :)

I have created a dynamic vhd under windows 7, added some files in there, dismounted it and converted it to a raw image file which I could successfully mount with imdisk.

Other options can be added like map used clusters, convert the other way around (img to vhd), resize, fixed to dynamic (and vice & versa), etc...

Regards,
Erwan.

Attached Files


  • Brito likes this

#2 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 19 December 2011 - 10:10 PM

Nice tool. :)

Don't forget however, VHD can be mounted in Win XP with native VHDMount, freely distributed by MS as part of MS Server 2005 SP1. Also, a fixed VHD can be mounted with ImDisk, and dynamic one with ImDisk+Devio.

What might be the other reasons to convert a VHD to IMG format? I think Karyonix also did something along these lines, when developing FiraDisk. :book:

#3 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 19 December 2011 - 10:58 PM

Hi Erwan, please use the download portal to post new tools so that we can keep the forum tidy and organized.

btw: My apologies about the delay handling rawreg, tomorrow I will send you the code.

Thank you.
:cheers:

#4 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 19 December 2011 - 10:59 PM

Indeed, been done befoee and there is little use actually :)

Could be useful it you want to turn a vhd into an image file which you can use from vmware (thru a vmdk).

Also I could quickly add to this tool an img to vhd (both fixed and dynamic) which would already make it a bit more interesting.

As a whole, the idea was to share source code to help understand how dynamic vhd work, very similar to the NTFS volume bitmap table (FSCTL_GET_VOLUME_BITMAP).
  • Brito likes this

#5 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 19 December 2011 - 11:03 PM

Also I could quickly add to this tool an img to vhd (both fixed and dynamic) which would already make it a bit more interesting.

As a whole, the idea was to share source code to help understand how dynamic vhd work, very similar to the NTFS volume bitmap table (FSCTL_GET_VOLUME_BITMAP).

That's a good idea. :thumbsup: Can you post here some pics about the subject?

As to using VHDs in Virtual Machines, current VMWare Workstation etc. supports them without a problem. May be you use very old version?

#6 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 19 December 2011 - 11:21 PM

Hi Erwan, please use the download portal to post new tools so that we can keep the forum tidy and organized.

btw: My apologies about the delay handling rawreg, tomorrow I will send you the code.

Thank you.
:cheers:


Hi Nuno,
Will do!

No pb for the delay : we also have a real life :)

Erwan

#7 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 19 December 2011 - 11:25 PM

That's a good idea. :thumbsup: Can you post here some pics about the subject?

As to using VHDs in Virtual Machines, current VMWare Workstation etc. supports them without a problem. May be you use very old version?


Seems I need to update my vmware tools :)

Another reason to turn a vhd into raw image : iscsi booting.
Not every one will want to use the ms iscsi target.
Just thinking out loud!

#8 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 19 December 2011 - 11:27 PM

Thank you very much.

Christmas time is crazy, can't hardly wait for January to start.. :lol:

I will announce your new tool in the front page of our weekly newsletter tomorrow. :)

#9 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 30 December 2011 - 01:23 PM

file uploaded there : http://reboot.pro/fi...le/116-vhd2img/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users