This example is to further elaborate the tutorial provided by TerryE for VirtualBox users. I intend to write this example is because I could not find a clear connection for all the materials (but tons of complains on how bad snapshots in Virtualbox are). This example is drafted with VirtualBox 2.1.4, which may not applicable for earlier or later versions. Remember to try before adopt it!
----------
How do I backup my VDIs? - Hands-On
Scenario:
You have a VM called 'MyVM' with 1 VDI only (MyVM.vdi) that need to run 7x24, and need to backup the full system weekly. As a result, the running VM only have 1 snapshot initially (snapshot name is "Current State")
1. On week 1, perform 'Take Snapshot' action (from the title bar of your running VM, choose 'Take Snapshot'), you will get your first copy of snapshot file (e.g. '{0001....}.vdi'inside 'MyVM\Snapshots' folder.
2. Backup 3 files:
a. MyVM.vdi
b. MyVM\MyVM.xml
c. Virtualbox.xml
3. On week 2, perform 'Take Snapshot' action again, you will get another copy of snapshot file (e.g. {0002....}.vdi'.
4. Backup 3 files:
a. MyVM\Snapshots\{0001....}.vdi
b. MyVM\MyVM.xml
c. Virtualbox.xml
5. On week 3, perform 'Take Snapshot' action again, you will get another copy of snapshot file (e.g. {0003....}.vdi'.
6. Backup 3 files:
a. MyVM\Snapshots\{0002....}.vdi
b. MyVM\MyVM.xml
c. Virtualbox.xml
----------
How do I restore my VDIs? - Hands-On
Scenario:
Your system crashed on week 4, totally messed up, including the Host OS. To restore:
7. Reinstall OS and Virtualbox in the Host
8. Copy the following files from your backup media to the ORIGINAL PATH that backup from:
2a. MyVM.vdi
4a. MyVM\Snapshots\{0001....}.vdi
6a. MyVM\Snapshots\{0002....}.vdi
6b. MyVM\MyVM.xml
6c. Virtualbox.xml
9. Start Virtualbox
10. At this point, you may like to build a new (or skip it if no need), standalone backup image:
a. Perform 'Discard Snapshot' action on snapshot 1 (from the Virtualbox GUI interface, select your VM on the left, then select 'Snapshots' tab on the right, then select 'Snapshot 1' under the tab, and click the 'Discard Snapshot' button which is the one with 'X'). 'Discard' action actually 'merge' the snapshot to its parent.
b. Perform 'Discard Snapshot' action on snapshot 2, after that you will find only 'Current State' exist, and the snapshots VDI {0001....}.vdi and {0002....}.vdi will be removed (its contents will be merged to MyVM.vdi)
11. Start VM
----------
How do I restore my VDIs to another host machine which already got some VMs?
Scenario:
Your system crashed on week 4, even the hardware bolts. Fortunately you have another server which is running some
VMs already. You want to add a VM to this server.
12. Perform step 8
13. Stop all running VM and quit Virtualbox
14. Identify two things from MyVM.xml
14a. MachineEntry UUID (e.g. {0000....})
14b. HardDiskAttachments UUID (e.g. {0001....}, {0002....})
15. Locate the UUID found in step 14 from the BACKUP version of Virtualbox.xml (Step 6c)
15a. MachineEntry (e.g. {0000....})
15b. HardDisks (e.g. {0001....}, {0002....})
16. Add the MachineEntry and HardDisks sessions (15a and 15b) to the CURRENT version of Virtualbox.xml
17. Start Virtualbox and VM
How do I backup/restore my VDIs - Hands-On
-
- Posts: 3
- Joined: 21. May 2009, 05:00
- Primary OS: Linux other
- VBox Version: OSE other
- Guest OSses: Windows
Re: How do I backup/restore my VDIs - Hands-On
It's usefull, thanks for your shared.
-
- Posts: 19
- Joined: 9. Jul 2009, 14:19
- Primary OS: MS Windows 8
- VBox Version: PUEL
- Guest OSses: Debian 7, Windows 8
Re: How do I backup/restore my VDIs - Hands-On
I notice that the file "virtualbox.xml" as described under c in your walk throughs does not exist on my system: Windows 7 64 bit (host), VirtualBox 3.1.4r57640, ubuntu server 9.10 guest. The back-up seems to be working just fine though.
-
- Posts: 12
- Joined: 12. Mar 2010, 00:24
- Primary OS: MS Windows 7
- VBox Version: PUEL
- Guest OSses: Gentoo, FreeBSD, Haiku, Windwos XP, ReactOS, OpenSolaris
Re: How do I backup/restore my VDIs - Hands-On
On my W7 x64 system, VirtualBox.xml is in C:\Users\username\.VirtualBox\. I'm also running 3.1.4 so you should have it.whatdoesitwant wrote:I notice that the file "virtualbox.xml" as described under c in your walk throughs does not exist on my system: Windows 7 64 bit (host), VirtualBox 3.1.4r57640, ubuntu server 9.10 guest. The back-up seems to be working just fine though.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: How do I backup/restore my VDIs - Hands-On
Sorry, but IMHO the use of snapshots in this "howto" procedure is counterproductive. It wastes space and makes it difficult to restore a VM without interfering with other VMs (which would happen if you restored the VirtualBox.xml file "blindly".
With this procedure you are taking physical backups every week, right after capturing a snapshot. But what purpose does the snapshot serve? Better IMHO to have a rolling series of stand alone backups, avoiding the use of snapshots.
With this procedure you are taking physical backups every week, right after capturing a snapshot. But what purpose does the snapshot serve? Better IMHO to have a rolling series of stand alone backups, avoiding the use of snapshots.
-
- Posts: 15
- Joined: 10. Feb 2010, 03:48
- Primary OS: MS Windows XP
- VBox Version: PUEL
- Guest OSses: suse
Re: How do I backup/restore my VDIs - Hands-On
I guess it was not supported well yet.
If you want, u can vote my feature request on own backup format: http://forums.virtualbox.org/viewtopic.php?f=9&t=28199
If you want, u can vote my feature request on own backup format: http://forums.virtualbox.org/viewtopic.php?f=9&t=28199
-
- Posts: 1
- Joined: 16. Sep 2010, 18:15
- Primary OS: Mac OS X Leopard
- VBox Version: PUEL
- Guest OSses: windows XP, Ubuntu 10.4
Re: How do I backup/restore my VDIs - Hands-On
Using Virtualbox 3.2.8 in Mac 10.6 Snow Leopard, I needed to restore from a (Time Machine) backup to undo a software update in my "winxp2" VM that caused a problem. These are the files I copied from the backup, and it worked for me. The virtual machine was actually saved in a "paused" state in this case.
MyHomeDir/Library/VirtualBox/
HardDisks/winxp2.vdi
Machines/VirtualBox.xml
Machines/VirtualBox.xml-prev
Machines/winxp2/winxp2.xml
Machines/winxp2/winxp2.xml-prev
Machines/winxp2/Logs/Vbox.log
Machines/winxp2/Logs/Vbox.log.1
Machines/winxp2/Logs/Vbox.log.2
Machines/winxp2/Logs/Vbox.log.3
Machines/winxp2/Snaphosts/{...}.vdi
Machines/winxp2/Snapshots/{...}.sav
Machines/winxp2/Snaphosts/{...}.vdi
I realize that not all of them were needed, but that set works, in case it helps anyone.
Thanks for your article.
MyHomeDir/Library/VirtualBox/
HardDisks/winxp2.vdi
Machines/VirtualBox.xml
Machines/VirtualBox.xml-prev
Machines/winxp2/winxp2.xml
Machines/winxp2/winxp2.xml-prev
Machines/winxp2/Logs/Vbox.log
Machines/winxp2/Logs/Vbox.log.1
Machines/winxp2/Logs/Vbox.log.2
Machines/winxp2/Logs/Vbox.log.3
Machines/winxp2/Snaphosts/{...}.vdi
Machines/winxp2/Snapshots/{...}.sav
Machines/winxp2/Snaphosts/{...}.vdi
I realize that not all of them were needed, but that set works, in case it helps anyone.
Thanks for your article.
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: How do I backup/restore my VDIs - Hands-On
Bad advice, which I sincerely hope no-one else follows. Your file set does not work in general. You were simply lucky (*) this time that the VirtualBox.xml you restored was still reasonably current, because restoring an outdated one can cause catastrophic damage to the .VirtualBox folder structure, particularly for someone who, like you, makes use of snapshots in their VMs. The restored VirtualBox.xml should be ok for the one VM you were interested in restoring, but there is a great danger that every other VM will be zapped.rharolde wrote:I realize that not all of them were needed, but that set works, in case it helps anyone.
(*) At least I assume you were lucky. It's possible that you just haven't noticed the damage to other VMs yet.