Link to home
Start Free TrialLog in
Avatar of bmcollis
bmcollis

asked on

Copy OS in a VHD to another VHD

I have an VHD that contains the OS for an SQL server.
Something is wrong at the disk level that the VHD file sits on,as my backups have been failing and I can't do a simple file copy of the VHD (yes the server is stopped)
I have tried creating a new VHD and selecting to copy the contents of the physical disk - this failed.
I tried to "Export" the Guest this filed.

So clearly there is something in the file/disk that is preventing the basic copying of the file.

The OS in the VHD works, i.e. I can turn on the Guest and it runs, therefore what ever is causing the issue is not effecting the actual OS files within the VHD.

I would like to know if there is a way I can copy the contents of this OS (windows Server 2008-R2) OS to another VHD.
  Have seen articles using Robocopy, but get the impression it won't do OS drives completely.

Ideally I would like to do it with the OS shutdown - i.e. open the VHD, copy contents to another VHD including boot records etc, clsoe the VHD.
Then I can jsut attached the new VHD to the guest and it should boot.

Any idea would be appreciated.

Brian
ASKER CERTIFIED SOLUTION
Avatar of kevinhsieh
kevinhsieh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
run a chkdsk on the volume that the vhdx resides this is host file system error
Avatar of bmcollis
bmcollis

ASKER

Hi David,
I have run chkdsk on it, and it found an issue, which I believe killed a VHD that was sitting on the the bad part of the disk.  Once I get the data off I will try again.

kevinhsieh
I have see reference to Clonezilla in other posts, but never used it.
So I would create a new Guest VM and attached the OS and an empty vhd.  Then for the boot source I would point to the iso - Please confirm because I thing that is very do able.


Thanks guys for your input.  Appreciate it on a Friday evening.

Brian
To use Clonezilla you can create a new VM or just use the existing one.

I have never encountered a corrupted VHD.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If it is a file lock issue use Hobocopy instead of Robocopy. It can copy files that are in use
https://github.com/candera/hobocopy
Thanks guys for the suggestion of clonezilla and he best way to do it.

David, I like your idea, unfortunately did not see it until I had tried just attaching the blank VHD to the actual  VM.

End result - it did not work for me - although the OS would run, it was to corrupt to actually clone off.

Luckily I did find a backup from Feb, which I used as a basis to get things running again.

Very much appreciated the ideas and help.

Brian