Skip to content


disk2vhd and Volume Shadow Copy Service errors

Microsoft has published a utility called disk2vhd.exe that is meant to make it easy to convert a physical Windows system into a virtual disk.

Disk2vhd is a utility that creates VHD (Virtual Hard Disk – Microsoft's Virtual Machine disk format) versions of physical disks for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs). The difference between Disk2vhd and other physical-to-virtual tools is that you can run Disk2vhd on a system that is online. Disk2vhd uses Windows' Volume Snapshot capability, introduced in Windows XP, to create consistent point-in-time snapshots of the volumes you want to include in a conversion.

A customer asked for help tracking down errors when they tried to use the utility. They were unable to get a snapshot started because it immediately posted a non-descriptive error. With a little sleuth work I found that disk2vhd.exe has quite a bit of trouble as a result of its dependency on the Volume Shadow Copy Service (VSS). Here is how I located and resolved the VSS errors.

First, the Event Viewer is essential to unlocking problems on Windows. Open it up and review the Application event lists. Look for a VSS error. Open the Services control (run services.msc) and restart "Volume Shadow Copy" service. You may see something like this:

Ignore that link for more help. It actually is no help. Instead, note Event ID 12302 and go to Microsoft knowledgebase article 907574:

You receive a "Volume Shadow Copy Service" error message and event 5013 or event 12302 is logged when you use the Backup feature in Windows XP or in Windows XP Tablet PC Edition 2005…

This problem occurs because the Location registry entry in the following registry subkey is incorrect or missing:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs
This problem occurs when you uninstall a program that is listed in this registry subkey, but only the location information is removed from the registry subkey.

Follow the instructions for fixing or removing the bad subkeys. That worked on one system.

Another method to find errors is to check VSS operations with vssadmin.

Type "vssadmin list writers" at a command prompt and you may see this:

This brought me to the same Event ID but Microsoft proposed a different solution. Knowledgebase article 940184 covers how to clear and reset a failure in COM and VSS:

This problem may occur if the following registry key is corrupted: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EventSystem\{26c409cc-ae86-11d1-b616-00805fc79216}\Subscriptions

Their solution is a bit lengthy, so here is a quick batch file version that should make it easy.

Copy and paste the following commands into a file named VSSrepair.bat, then run it to execute the commands from 940184:

@echo off
REM
REM http://www.flyingpenguin.com
REM
REM Batch file to repair a Volume Shadow Copy (VSS) installation
REM based on http://support.microsoft.com/kb/940184
REM
echo --- !! WARNING !! WARNING !! WARNING !! WARNING
echo.
echo --- Run this with Administrator privileges only
echo.
echo --- NOT for use with Windows Vista, Windows Server 2008,
echo --- or later versions of Windows. Windows Vista and
echo --- Server 2008 use manifest-based component installation;
echo --- manual registration of components can cause serious failure
echo --- and require Windows reinstall to resolve.
echo.
echo --- !! WARNING !! WARNING !! WARNING !! WARNING
REM
pause
cd /d %windir%\system32
echo.
net stop vss
net stop swprv
regsvr32 ole32.dll
regsvr32 oleaut32.dll
regsvr32 /i eventcls.dll
regsvr32 vss_ps.dll
vssvc /register
regsvr32 /i swprv.dll
regsvr32 es.dll
regsvr32 stdprov.dll
echo --- vssui.dll is only for Windows 2003. Ignore this error on XP
regsvr32 vssui.dll
regsvr32 msxml.dll
regsvr32 msxml3.dll
echo --- msxml4.dll is optional and thus may fail. Ignore this error
regsvr32 msxml4.dll
pause

The knowledge base article then recommends you type "vssadmin list writers" from the command prompt. Success means you will see a list like this one:

Hope that helps save some time. There could be more issues to VSS, but these two methods worked for me.


Updated to add: if you have Visio installed you may have to remove the following registry entry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Visio

Posted in Security.


26 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Anonymous says

    This is pretty cool – I've been looking for something like this. On what versions of windows does this work?

  2. Davi Ottenheimer says

    Microsoft says "Disk2vhd runs Windows XP SP2, Windows Server 2003 SP1, and higher, including x64 systems." It also seems to work on Windows NT4 SP6

  3. Michael Lynch says

    Thanks for posting this, I ran in to the same issue and the solution worked.

  4. Mitchell Earl says

    The batch file fix worked great for me. Thanks for the post.

  5. Jens says

    Thank you, registry part was my problem.

  6. Force says

    The batch file really helped! Thanks a lot!

  7. Alan says

    This fixed my problem, thanks. Changing the commands to "regsvr32 /s" to the command prevents popups. I also added “vssadmin list writers" as the last line in the batch.

  8. tee says

    It work ! thanks

  9. Nilton Pinheiro says

    Great post…it fix my problem!!

  10. woestyn says

    Hi

    I have had too many problems with disk2vhd. Instead I used virtualbox with vm_converter. Very good results. Here is the instruction page for that :

    http://www.pjsquared.com/blog/?p=169

  11. Ronny says

    Thank you very much – the registry key issue causes in error "snapshotting volumes".

  12. sami says

    It didnt worked for me, at least without rebooting.
    After doing that, deleting system volume information in all my HD's
    … the same problem

    I rebooted the computer…. and worked!! :)

  13. Wojtek says

    Worked grate !! THANKS

  14. Anonymous says

    Thanks, worked great!

  15. Ami Adi says

    if u unable to boot the system u create fot vhd snapshot u need to do just 2 steps

    1. create a new virtual machine -> go to virtual machine settings -> go to prosseccor section
    -> under that section go to prosseccor compatibility and check the 2 checkbox's, migrate to physical prosseccor, run an older operating system.

    thats all u need to solve the unable to initialize ID error

    Good Lock

  16. Jim says

    Thank you. Resolved my problem.

  17. Sean C says

    Wow, been wrestling with this issue for sometime and finally found a solution.

    From: http://forum.storagecraft.com/Community/forums/p/266/991.aspx

    To cut a long story short, you might want to look in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs and check if there is a Visio key, delete it and VSS will turn back into workable condition. Amazing, simple and it works!!

  18. Keoni says

    Wonderful guide!!
    I had to remove Visio and recreate the registry entries according to the Microsoft article to get this working. It's been solved I was nearly giving up…
    Great job! Thanks!!

  19. casysadmin says

    Sean C, removing the registry key worked for me. I had Visio running on the XP machine I'm trying to convert to vhd. Thanks.

  20. Anonymous says

    is there a cap on the size this can convert i want to convert my 2003 r2 server with 3 volumes 16MB, 60GB, and 120GB space required

  21. andrewking0207 says

    Thank you very much! Deleting the VIsio key worked for me.

  22. Anonymous says

    great solution! Thanks.

  23. Shannon says

    Bravo !!!!

  24. Gryphon says

    I received the 12302/5013 errors while trying to make a VHD. Investigating revealed there were no catalog keys in the registry. Copying [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\System] from another XP machine did the trick!

  25. Anonymous says

    Hello all, I've also had a problem with disk2vhd; with same vss errrors. It appears that not all windows services were launched. In Windows Start menu enter "msconfig" and select "start with all services". Then reboot and try again disk2vhd. This solved my issue.

Continuing the Discussion

  1. 古いHDDをVirtual PCに « TOM'S DINER デジタル部 linked to this post on July 9, 2011

    [...] 調べると、このアプリはVolume Shdow Copyを使用していて、エラーはその関係らしい。Volume Shdow Copyは、先日のWHSでバックアップができなかった話のときに、きちんと残してあるので、この点は大丈夫のはずだが…。このエラーについてあちこち調べて、かなりそれっぽい情報も見つけて対策をしたが、エラーが出続ける。 nLiteでいろいろ削ってると、こういうときに「何か削っちゃってたのかも?」と思ってしまう。 [...]



Some HTML is OK

or, reply to this post via trackback.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word