Should I shutdown a virtual machine before copying it to an external drive. We are looking to copy all the contents of our storage device to an external drive since we are going to be adding more drives to it. Many of the files are the virtual machine and VHD files for our Hyper-V server. Would there be any issue in copying these files while the Virtual Servers are still running?
Copying Virtual Machine While Running
hyper-vwindows-server-2008
Related Solutions
From a performance standpoint only, xcopy or robocopy will give you similar results. I ran through a couple of tests on a Windows Vista 64-bit SP2 box to do some comparisons. All copies were performed between a internal 7200 RPM Sata II disk and an external USB 2.0 drive or on the same internal drive itself where indicated. No special setup was done (make up your own mind if that invalidates/validates the test), only to input the command into a batch file to execute. PowerShell was used to capture the start and stop times. After a couple of passes here are the averages from the tools I played with:
File: 732,909,568 bytes (698 MB), 1 ISO file copied to different directory on the same internal disk.
copy 6 secs (ex. copy G:\folder1\* G:\folder2\)
xcopy 6 secs (ex. xcopy G:\folder1 G:\folder2 /I /E /Y /R)
robocopy 6 secs (ex. robocopy G:\folder1\ G:\folder2 /E /NP)
teracopy 28 secs (ex. TeraCopy.exe Copy G:\folder1\ G:\folder2\)
fastcopy 19 secs (ex. fastcopy.exe /auto_close G:\folder1 /to=G:\folder2)
File: 732,909,568 bytes (698 MB), 1 ISO file copied to external USB disk.
copy 36 secs (ex. copy G:\folder1\* I:\folder2\)
xcopy 35 secs (ex. xcopy G:\folder1 I:\folder2 /I /E /Y /R)
robocopy 36 secs (ex. robocopy G:\folder1\ I:\folder2 /E /NP)
teracopy 36 secs (ex. TeraCopy.exe Copy G:\folder1\ I:\folder2\)
fastcopy 38 secs (ex. fastcopy.exe /auto_close G:\folder1 /to=I:\folder2)
Files: 45,039,616bytes (42.9MB) 5 random files copied to external usb disk
copy 6 secs (ex. copy G:\folder1\* I:\folder2\)
xcopy 5 secs (ex. xcopy G:\folder1 I:\folder2 /I /E /Y /R)
robocopy 6 secs (ex. robocopy G:\folder1\ I:\folder2 /E /NP)
teracopy 12 secs (ex. TeraCopy.exe Copy G:\folder1\ I:\folder2\)
fastcopy 6 secs (ex. fastcopy.exe /auto_close G:\folder1 /to=I:\folder2)
Files/directoies: 1,087,180,800 bytes (1.01 GB), 27 files/8 directories copied to external USB disk.
copy *Not included in test
xcopy 57 secs (ex. xcopy G:\folder1 I:\folder2 /I /E /Y /R)
robocopy 58 secs (ex. robocopy G:\folder1\ I:\folder2 /E /NP)
teracopy 56 secs (ex. TeraCopy.exe Copy G:\folder1\ I:\folder2\)
fastcopy 60 secs (ex. fastcopy.exe /auto_close G:\folder1 /to=I:\folder2)
This is by no means an exhaustive test, but just throwing a quick real world scenario at some of the more popular tools in this genre shows that your pretty safe sticking with either xcopy or Robocopy (from a performance standpoint only). Also the Robocopy option /NP
(No Progress) saves you 0 time. That doesn't mean you cannot benefit from using something other than xcopy however. Robocopy is a great example (from Wikipedia):
Robocopy is notable for capabilities above and beyond the built-in Windows copy and
xcopy commands, including the following:
- Ability to tolerate network outages and resume copying where it previously left off (incomplete files are noted with a date stamp corresponding to 1980-01-01 and contain a recovery record so Robocopy knows from where to continue).
- Ability to correctly copy attributes, owner information, alternate data streams, auditing information, and timestamps by default, without the need for numerous often forgotten command line switches.
- Ability to correctly copy NTFS ACLs, (when /COPYALL provided), and to assert the Windows NT "backup right" (/B) so an administrator may copy an entire directory, including files denied readability to the administrator.
- Persistence by default, with a programmable number of automatic retries if a file cannot be opened.
- A "mirror" mode, which keeps trees in sync by optionally deleting files out of the destination that are no longer present in the source.
- Ability to copy large numbers of files that would otherwise crash the built-in XCOPY utility.
- A progress indicator on the command line that updates continuously.
- Ability to copy long file and folder names exceeding 256 characters — up to a theoretical 32,000 characters — without errors.
One thing you can do if you want to use robocopy with volume shadow copies is use the VShadow tool from MS (http://msdn.microsoft.com/en-us/library/bb530725.aspx)
I've outlined a brief approach below, you'd want to create a batch script to automate this process but it isn't too difficult.
You can create a shadow copy using the vshadow tool. Following this, using the -el flag (with vshadow again) you can expose the shadow copy under a drive letter (like x:). Following this you can use robocopy to create backups from the mounted shadow copy drive.
I've outlined a rough script below, note this hasn't been tested. It takes a shadow copy of C: and mounts it as X:
setlocal
IF NOT "%CALLBACK%" == "" GOTO :VS_CALLBACK
set CALLBACK=%~dpnx0
vshadow.exe -p -script=TempScript.cmd -exec=%CALLBACK% C:
:VS_CALLBACK
setlocal
call TempScript.cmd
vshadow.exe -el=%SHADOW_ID_1%,X:
del /f TempScript.cmd
robocopy X:\ \\backup\server
Obviously the robocopy command needs to be customised to suit whatever you're doing (copy VHD's from some location etc). Hopefully this is helpful!
Best Answer
No. SImple like that. You can not do that while the virtual servers are running.
That is a Server 2012 / Hyper-V v3 feature.
So, it is not a question of "should you shut down", but "how do you want to do that without"?
Only chance now is stuff like "replication on the partition level" that can be done transparently, then broken again. But a file copy is out.