I have a hyper-v 2008 R2 hyper-v host with some VM's that are dynamic disks. Some of them have grown to the point where our backup is failing because its exceeding the capacity of the tape.
I know the general proper process to compact a VHD is to
1. Defrag the VM
2. zero out empty space with a utility like sdelete or precompact.exe
3. compact within the VM manager edit disk or to use diskpart. (I think diskpart will be faster?)
Since these are live VM's I don't want to bring them down for too long. I was thinking I could take a of copy the VHD's and put them on another machine, Mount the VHD as a drive and perform the steps above. Then I would remove the old VHD on the production server and copy over the compacted VHD.
What Im not sure about, is whether it is ok to run defrag and sdelete on the mounted VHD or whether its preferable to run that within the VM itself?
Lastly does the machine where I mount the VHD's need to be the same OS and have hyper-v installed? For example if I copied the VHD to a windows 7 machine and mounted for these steps would that cause a problem when I restore it back on the server 2008 hyper-v server?