2010年5月6日

How to backup/restore my VDIs - Hands-On

his 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

沒有留言:

發佈留言