Backup/restore .vdi volume?

Discussions about using Windows guests in VirtualBox.
Post Reply
pacpac
Posts: 3
Joined: 11. Aug 2011, 15:03
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows Server 2008 R2

Backup/restore .vdi volume?

Post by pacpac »

Hi, I am running the latest version of VirtualBox on a Windows 7 PC (64-bit). Windows 7 and other programs are running from a SSD RAID (C drive) and data is stored on a separate SSD drive (D drive) installed on the same PC. Using VirtualBox I have installed Windows Server 2008 R2 with Exchange Server 2010. This set-up is only to serve 10-12 e-mail accounts (no web site hosting). I have created a 40GB .vdi file, which resides on the D drive. I have tested, and I can copy to .vdi file to another location whilst VirtualBox is running with that volume, i.e. the .vdi file.

I need to have in place a backup strategy for the Exchange data. So, can I just regularly back up the .vdi file (with Windows and Exchange server installed) to an external drive and should either Windows 7 crash, VirtualBox or any of the programs installed on the .vdi drive crash, I can just reinstall VirtualBox and pick up the .vdi file to use in the new VirtualBox installation and I have my Windows and Exchange server with all data intact up and running?

Thanks.
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: Backup/restore .vdi volume?

Post by Sasquatch »

If you are going to make a backup of a VM, it's best to shut it down. That way, all changes are kept in the VDI and the VM will start properly. If you were to make a backup of the VM whilst it's running, you can have issues with file locking, caching of old files and other issues you rather avoid. Restoring such a backup can also give you some problems, because it can appear that you simply pulled the plug and you will get an unclean shutdown message.

Something you also have to consider, is that since you have Exchange, you also have an AD set up. If this system synchronises with any other server, restoring a backup is the worst thing you can do, because the sync will not work any more. Also consider the email messages that you will loose between the backup and current date. Due to this, it's out of the question to use snapshots.

What's best to do, is have a regular backup schedule or make a single backup and do the rest from within the VM. You can make a backup of your AD and Exchange databases which you can restore to a new installation. Consult the Microsoft website and best practise information to learn how to back up your Exchange server properly, especially when it's a VM.
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.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Backup/restore .vdi volume?

Post by vbox4me2 »

pacpac wrote:I have tested, and I can copy to .vdi file to another location whilst VirtualBox is running with that volume, i.e. the .vdi file.
This is where sas is right, "a copy" can be done easily but often misses changes properly while the VM is running, a better and (by me) properly tested way is to use VSS with a tool like shadowcopy, I've been using it for over a year and have had the pleasure to restore several VM's without loosing data. The only chevat is to check that all services have started after restore.
pacpac
Posts: 3
Joined: 11. Aug 2011, 15:03
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows Server 2008 R2

Re: Backup/restore .vdi volume?

Post by pacpac »

Thanks.

Would this be 2 viable alternatives:

1) Do a "proper" copy of the .vdi file using a backup software capable of shadowcopy, then restore the image?
2) Do a clone of the .vdi file, then use Windows Server inbuilt backup service to backup the server data, then restore the cloned .vdi and restore data from Windows server backup version?

If both are viable, which one is most reliable?

Thanks.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Backup/restore .vdi volume?

Post by vbox4me2 »

Windows build in backup already uses VSS so you could use this as well, personally I prefer shadowcopy because it can be used fully by commandline where you can restrict it to using only 1 cpu and adjust it to below normal cpu use and send the backup anywhere without using much resources.

Restoring is a simple matter of deleting or renaming the vdi and copying the backup back. In case the crashed VM still holds data that is not in the backup you can easily mount the crashed VDI(VM) as additional disk inside the restored VM to pull of data.
scp
Posts: 106
Joined: 14. Feb 2010, 22:12
Primary OS: Ubuntu 12.04
VBox Version: OSE self-compiled
Guest OSses: Windows XP, 2003, 7, 8.1

Re: Backup/restore .vdi volume?

Post by scp »

Using the built-in backup of Windows Server 2008 R2 by calling "wbadmin" might be a good solution because the resulting backup files are .vhd files which can be directly used by VirtualBox.
There is only one point to consider: Each partition goes into a separate .vhd, so the original drive layout will not be kept.

I already tried to boot from a backup .vhd of Windows 7, which worked perfect without modifications.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Backup/restore .vdi volume?

Post by vbox4me2 »

From inside a Guest yes, not from a Host as the VHD contains a VDI, an image inside an image won't boot for VBox.
scp
Posts: 106
Joined: 14. Feb 2010, 22:12
Primary OS: Ubuntu 12.04
VBox Version: OSE self-compiled
Guest OSses: Windows XP, 2003, 7, 8.1

Re: Backup/restore .vdi volume?

Post by scp »

Yes, I would run backup inside the Guest VM to a network share.
Additionally the monthly backup can be done by creating snapshots or shutting down the VM to get a full copy.
Post Reply