6

Is it a way to create a VHD virtual drive image from files in existing folder? I know that it can be done programmatically via .NET framework API, but maybe it's already exists a tool that can be run like

create my.vhd c:\my

4 Answers 4

7

Try to copy your folder to a USB stick for example, then use Disk2Vhd from Sysinternals.

3
  • This is ok, but for automated builds i will need to create additional partition :). Maybe it's something exists like folder2vhd? ^_^
    – grigoryvp
    Commented Oct 15, 2009 at 13:47
  • Maybe the nice guys from Sysinternals will extend Disk2Vhd with those function in a further release. May you suggest this feature on their site.<br> In the meantime your idea with an additional partition sounds good to me.
    – Phil Swiss
    Commented Oct 15, 2009 at 18:52
  • why copy? use subst from good old dos to map a folder to a drive!
    – djdomi
    Commented Jun 29, 2021 at 20:00
10

This article explains how to do this.

in short for windows 7/2008: go to computer management, click disk management, right click disk management, click create VHD, enter location. Select the disk, right click, initialize with MBR, right click "unallocated" string, click new simple volume, etc, map the drive letter.

Then copy your files and folder to the drive letter, once done, right click the disk (on the left side) and select detach VHD.

3
  • I guess that was mgorven that gave the answer of mounting the vhd in disk manager. didn't know one could do that so I learned something AND I fixed my problem!
    – user150698
    Commented Dec 22, 2012 at 18:21
  • Note: For right clicking on the disk to initialize it you actually have to click on the left hand side where it says Disk 1 Basic 512MB and not the bar on the right. it may not be immediately obvious that this area is clickable.
    – Simon
    Commented May 12, 2017 at 4:21
  • Ha - and don't make the stupid mistake I did by confusing MB (the default selected value) with GB
    – Simon
    Commented May 12, 2017 at 4:31
1

In Windows 2012 R2/ Win 8.1 or 10 you can create empty VHD, mount it and copy data :

  • Start computer Management or open empty MMC console
  • Select Disk Management or Add Disk Management snap-in
  • Right click on Disk Management and choose Create VHD, enter location, size, type
  • Now you can Mount this VHD to your system, assign a drive letter
  • Copy data to your VHD and then detach VHD in Disk Management

that`s All !

0
  1. Share the folder you want to create the drive from so that now it is a network folder (Right click on folder and choose share)

  2. Create a network drive from the folder you have shared with the button "Create Network Drive" at the top of the "My Computer" window (Win7)

1
  • 2
    That doesn't sound like a VHD. Commented Sep 15, 2015 at 21:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .