How to backup (and restore) virtual machines?

This is for discussing general topics about how to use VirtualBox.
Post Reply
PerfectReign
Posts: 13
Joined: 27. Aug 2008, 21:17
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7, XP, Vista, Moblin, 2003, 2008

How to backup (and restore) virtual machines?

Post by PerfectReign »

I had a recent instance where I wanted to restore a Virtual Machine (Windows XP) that I'd created in VB 2.x on openSUSE to my current laptop running Ubuntu 9.04. I copied the .vdi file over from my backup hard drive, created the machine in VirtualBox (I'm on 3.0.4 currently), attached the .vdi to the machine and tried to boot.

Nada.

I searched and found that - basically the Windows hardware libraries would not load.

I went ahead and created a new VirtualMachine (XP) on my laptop and simply installed Windows XP from an old CD I have lying around. (This is to be used to do some programming in some older VB 6.0 programs that I am still supporting.)

Now that I have my XP machine up and running I want to back it up. Searching the intraweb, I see that simply copying the .vdi file doesn't work. I did see a thread here about backing up and a few other results which suggested either clonevdi or clonehd.

In either case, I get a nasty message that it can't register the hard disk.

Ideas?

kai@r2d2:~/.VirtualBox/HardDisks$ VBoxManage clonehd ./WindowsXP.vdi ~/WinXP_Backup.vdi
VirtualBox Command Line Management Interface Version 3.0.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

ERROR: Cannot register the hard disk '/home/kai/.VirtualBox/HardDisks/WindowsXP.vdi' with UUID {b974d9f6-a020-483e-8b75-2dd0f7337ce8} because a hard disk '/home/kai/.VirtualBox/HardDisks/WindowsXP.vdi' with UUID {b974d9f6-a020-483e-8b75-2dd0f7337ce8} already exists in the media registry ('/home/kai/.VirtualBox/VirtualBox.xml')
Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
Context: "OpenHardDisk(Bstr(szFilenameAbs), AccessMode_ReadWrite, false, Bstr(""), false, Bstr(""), srcDisk.asOutParam())" at line 624 of file VBoxManageDisk.cpp
kai@r2d2:~/.VirtualBox/HardDisks$




http://tuxtraining.com/2008/10/18/how-t ... achine-vdi

http://www.derekhildreth.com/blog/how-t ... chine-vdi/



http://forums.virtualbox.org/viewtopic. ... 07&p=94934
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: How to backup (and restore) virtual machines?

Post by Sasquatch »

If you clone a hard drive, you don't have to specify the location of the original. That's why you get an error, it wants to register the source VDI first, but that's already done.

Now, for your error of the restoring backup, did you create the exact same settings as the original VM the VDI came from? Without that, Windows will barf at you and can fail to boot properly. So, if you backup a VDI, it might be wise to include a text file with the settings of that VDI (include the MAC addresses of the NIC(s) too).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
PerfectReign
Posts: 13
Joined: 27. Aug 2008, 21:17
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 7, XP, Vista, Moblin, 2003, 2008

Re: How to backup (and restore) virtual machines?

Post by PerfectReign »

Excellent idea on the text file.

Oddly enough, I simply copied THIS WindowsXP VM over to a Windows Vista machine (my laptop runs Ubuntu 9.04) and fired up VB. It worked just fine, with the exception of a networking issue that is related to our Active Directory.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to backup (and restore) virtual machines?

Post by mpack »

PerfectReign wrote:Now that I have my XP machine up and running I want to back it up. Searching the intraweb, I see that simply copying the .vdi file doesn't work.
On the contrary, a simple copy is exactly what you should use to make a backup, or to restore from the backup, or when moving a virtual hard disk to a different host. The only time a simple copy is wrong is if you want to copy a virtual HD and then register both at the same time, on the same host PC. That won't work because each hard disk has an internal signature called a UUID, and VBox application on the host doesn't like to see two virtual hard disks with the same UUID.
PerfectReign wrote:I did see a thread here about backing up and a few other results which suggested either clonevdi or clonehd.
Those commands are synonyms. "clonevdi" was the name of the original command. The command was changed to "clonehd" after the developers updated the feature to support cloning other virtual drive types (vhd, vmdk etc). The original command name is retained for compatibility.
Post Reply