You are hereHome › Dennis Faas › How to Fix: Can't Convert Image to VHD: 'The vhd file could not be created or written to'
How to Fix: Can't Convert Image to VHD: 'The vhd file could not be created or written to'
Infopackets Reader Steve P. writes:
" Dear Dennis,
I am trying to convert my Macrium Reflect disk image backup into a virtual machine by using the 'Macrium ImgtoVHD' utility. The problem is that ImgtoVHD aborts every time, telling me 'The vhd file could not be created or written to'. The backup I'm trying to convert is from an old machine which died and I really need to get this working so I can export data from a program. Can you please help? "
I have had this problem before and the solution (in a nutshell) is to create a blank virtual machine, then restore the backup onto the virtual machine. Of course, this process is much easier said then done - as such, I'll explain how to do that below in greater detail and in simple English.
Note: the article below is fairly complex - if you are stuck at any point, you are welcome to contact me for additional support using my remote desktop service, where I can connect to your machine and manage this for you.
How to Fix: Can't Convert Image to VHD: 'The vhd file could not be created or written to'
- The first thing you need to do is install a hypervisor to run your virtual machine.
Oracle VM Virtualbox is free and works great, though I've also used VMWware Workstation (not free) to perform this task. For the purpose of this article I will be explaining the process using Oracle VM Virtualbox.
Note that your CPU must support virtualization in order to run a virtual machine, and the "virtualization" option must be enabled in the BIOS. If you download Oracle VM Virtualbox and you try to create a virtual machine and it gives you an error along these lines, you may need to go into the BIOS and enable virtualization - and only if your CPU supports it.
- The next thing you will need to do is to create a Macrium Reflect
bootable rescue CD in .ISO format. This will allow you to restore the backup
from within a virtual machine, which will then allow you to boot the virtual
machine into Windows or whichever operating system the backup contains.
To do so: download and install Macrium Reflect if you have not done so already, then launch the program. At the very top menu, click "Other Tasks" -> "Create Rescue Media..." Keep clicking "Next" through the wizard until you get to the final page with the title "Burn Rescue Media". At this point you should see an option for "CD / DVD Burner" with a pull down menu - use the pull down menu to select "Create a ISO image file", then click "Finish". It will ask you where to save the file. Save it to your desktop, for example.
- Now it's time to setup and create the virtual machine. Note that the virtual machine's hardware
specifications should match the hardware from which the backup was created. In Steve's case, the original backup came from Windows 7 64-bit machine with 8 GB of RAM and a 500GB hard drive.
To do so: launch VM Virtualbox if you have not already; near the top left of the screen, click the "New" button to create a new virtual machine. Label it "my new VM backup" or such, then select the operating system "Type" and "Version," then specify the "Memory size", then select "Create a virtual disk now", then click the "Create" button near the bottom.
- On the proceeding screen, specify where you want to store your virtual machine hard disk and set its size. In Steve's
case, his backup files were approximately 250GB large (compressed), but the
original hard drive was 500GB. As such, he needed approximately 500GB worth of space to restore the backup. Under the heading "Hard disk file type", use "VHD" if the drive you're restoring is less than 2TB large, and for the heading "Storage on physical hard disk", use the default setting of "Dynamically allocated", then click "Create". This will create the virtual machine template and close the wizard.
- Now that the virtual machine template has been created, you will need to tell it to boot from the Macrium Reflect
rescue CD (ISO file). This will allow you to restore the backup onto the virtual hard disk assigned to the virtual machine. To do so: right click the virtual machine you just created and select "Settings" from the dialogue menu. Navigate to the
"Storage" menu on the left and click it. Under the "Storage tree" heading (in the middle of the window),
click the CD icon to highlight it
(pic), then on the far right, click the CD icon with the down arrow to "Choose virtual optical disc file", then select the Macrium Reflect bootable Rescue ISO file you created earlier in Step #2.
- Now it's time to mount (attach) the backup files to the virtual machine.
This can be rather tricky, because you cannot mount / attach the backup files to the virtual machine if they are stored on the host operating system file system (the C drive) - though there is a workaround, which I will describe below. If the backup files are stored on a separate partition (other than the C drive) you can
create an I/O redirect using the "VBoxManage" command via an administrative command prompt.
If your backup files are on the C drive and you don't have access to another partition, it is possible to create a virtual hard disk file (on the C drive), then move the backup files from the C drive into the .VHD file container. From there, you can attach the .VHD to the virtual machine.
Using this method has two requirements: one is that .VHD must not exceed 2TB in size - this is a limitation of the .VHD file and Virtualbox isn't compatible with .VHDx files (which allow you to exceed 2TB). The other requirement is that you must have twice the amount of disk space available to copy the backup files into the .VHD container. In Steve's case, his backup files were 250 GB, so multiply that by two and he needed 500GB of space to complete this operation. Once the backup files are inside the .VHD container, you can delete the original backup files to reclaim space on your drive. You can then mount the .VHD using "disk management" at any point in the future to access the backup files, if you needed.
To copy your backup files into a .VHD file, do the following (applies to Windows Vista, 7, 8, and 10):
Click Start, then type in "disk management"; wait for "Disk Management" to appear in the list, then click it. The "Disk Management" window will appear; from the top menu, click "Action -> Create VHD" (pic). Enter in the location where you want to store the .VHD file and specify the full size of the disk.
In Steve's case, his backup was 250GB worth of data but his drive was 500GB - as such, we specified 500GB. Where it says "Virtual hard disk size", set it to "Dynamically expanding", then click OK. The disk will be created in Disk Management.
Next, scroll down the Disk Management window and you will see an "Unknown" and "unallocated" disk (pic). Right click over top of it where it says "Unknown" and select "Initialize disk"; on the following screen select MBR (master boot record) and click OK. Once that is done the disk will need to be formatted. To do so: right click where it says "Unallocated" and select "New simple volume", click "Next" a few times, enter in the volume name and drive letter, and click Finish.
At this point, the virtual drive will now be accessible under "My Computer". Copy over your image backup files to the virtual drive. Once that is done, go back to Disk Management and right click the VHD and select "Detach VHD". The .VHD file is now ready to be mounted in VM Virtualbox.
To do so: go back to VM Virtualbox and right click your VM and select "Settings"; click the "Storage" option on the left, then under the heading "Storage tree" left click the "Controller: SATA" (or such) so it's highlighted, then click the blue box with a green plus sign to "Add new storage attachment", then select "Add new hard disk". VM Virtualbox will ask if you want to "Create a new disk" or "Choose an existing disk" - choose the latter, then navigate to where you stored your .VHD file (with the backups) and click "Open". This will attach the .VHD to your virtual machine.
- At this point you are ready to power on the virtual machine. To do so: select your virtual machine on the left hand side of the VM Virtualbox main screen, then click the "Start" button near the top. The Macrium Reflect rescue CD will start to boot; choose the
"Restore" option, then navigate to your image backup files from the attached .VHD, then restore it to the second empty virtual hard disk, which is technically your C drive inside the virtual machine.
- At the end of the process, remove the Macrium Reflect Bootable Rescue ISO file and the .VHD containing the backup files. To do so: power off the virtual machine, right click and select "Settings"; click the "Storage" menu, then right click on the CD and select "remove attachment". Do the same for the .VHD containing your backups. The only thing remaining should be the main .VHD (the C drive) for your virtual machine. Once that is done, start the virtual machine and it should boot into Windows (or whichever operating system you had backed up). Viola! All done - pat yourself on the back.
I hope that helps.
Additional 1-on-1 Support: From Dennis
What I've described is rather technical and requires a bit of effort to get passed "The vhd file could not be created or written to" error message. If what I've written is over your head, or if you're still facing a problem converting your Macrium Reflect image files into a bootable virtual machine, I can assist using my remote desktop support service. Simply contact me briefly describing your message and I'll get back to you as soon as possible.
Got a Computer Question or Problem? Ask Dennis!
I need more computer questions. If you have a computer question -- or even a computer problem that needs fixing - please email me with your question so that I can write more articles like this one. I can't promise I'll respond to all the messages I receive (depending on the volume), but I'll do my best.
About the author: Dennis Faas is the owner and operator of Infopackets.com. With over 30 years of computing experience, Dennis' areas of expertise are a broad range and include PC hardware, Microsoft Windows, Linux, network administration, and virtualization. Dennis holds a Bachelors degree in Computer Science (1999) and has authored 6 books on the topics of MS Windows and PC Security. If you like the advice you received on this page, please up-vote / Like this page and share it with friends. For technical support inquiries, Dennis can be reached via Live chat online this site using the Zopim Chat service (currently located at the bottom left of the screen); optionally, you can contact Dennis through the website contact form.
Infopackets Top Windows 10 FAQs
How to Upgrade from Windows 10 32-bit to 64-bit
How to Fix: Windows 10 Antivirus Missing, Not Compatible
How to Fix: Windows 10 Display Shifted; Screen Fuzzy
How to Upgrade Windows 7, 8 32-bit to Windows 10 64-bit
to Downgrade from Windows 10
- How to Fix: Windows 10 Upgrade Failed Error C1900208
- How to Fix: Windows 10 Upgrade Failed Error 80240020
- Can I Cancel my Windows 10 Reservation and Reserve Later?
- How to Clean Install Windows 10 using Windows 7, 8 License
- Will Windows 10 Install Automatically?
- Windows 10 Upgrade: Do I have to Reinstall Programs?
- Windows 10 Upgrade: Can I choose 32-bit or 64-bit?
- Which Version of Windows 10 Will I Get (Home or Pro)?
- How to Reserve Windows 10 Upgrade (Free)
- How to Fix: CPU Not Compatible with Windows 10 Error
- Windows 10 Upgrade: Can I keep my Old Windows Install?
- How to Cancel Windows 10 Reservation (Properly)
- Download Windows 10 .ISO (DVD) for Clean Install?
- Microsoft: Windows 10 Will Be The Last Version
- Does Windows 10 require the CPU to support PAE?
- Windows 10: Can I Upgrade or do I need a Clean Install?
Click here for more Windows 10 articles.