How to implement differencing disk

Discussions related to using VirtualBox on Windows hosts.
Post Reply
trogjels
Posts: 2
Joined: 27. May 2009, 21:43
Primary OS: MS Windows Vista
VBox Version: OSE other
Guest OSses: Windows

How to implement differencing disk

Post by trogjels »

Hello.

I want to build some base disk's, like Windows 2003 and Windows 2008.
I want to use those as base disk for every new server.

These base disk shall not be written to.
I have read about immutable disk - But i can't get it to work.
Everytime I start the virtual server is reverted back.

How do I get this to work ?
Saff
Posts: 7
Joined: 8. Jul 2009, 17:13
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu & Others

Re: How to implement differencing disk

Post by Saff »

I'm not sure what you're asking here.

By the sounds of it what you want is to create a number of immutable base disks onto each of which is installed a certain OS. I think you're then trying to create a number of machines that each use the installs you've created (i.e. the base disks) but that write to their own disks (a differencing disk).

I can't quite work out from your question where you're going wrong so here are all the steps I would use:

1) Create a new VM with the base disk set up as you want it.Lets say for the sake of example that you've created a machine called "MyWindowsInstall" and got it how you want the base.
2) Power down the machine in the VM.
3) Open a terminal/command promt and type the following:

Code: Select all

VBoxManage modifyvm MyWindowsInstall --hda none
VBoxManage closemedium disk MyWindowsInstall.vdi
VBoxManage openmedium disk MyWindowsInstall.vdi --type immutable
VBoxManage createvm --name WindowsBox1 --ostype WindowsXP --register
VBoxManage modifyvm WindowsBox1 --hda MyWindowsInstall.vdi
4) Lookup the uuid of the hard disk associated with the new "WindowsBox1" VM. It should look something like 4c0e493f-9298-45a2-827b-541b897c4cde. One method of doing this is to type:

Code: Select all

VBoxManage showvminfo WindowsBox1
into the terminal/command prompt. You should get a whole load of info including a line that looks like:

Code: Select all

Primary master:  /home/me/.VirtualBox/HardDisks/WindowsBox1.vdi (UUID: 4c0e493f-9298-45a2-827b-541b897c4cde)
5) Using the uuid you've found in place of my example one, type the following into the terminal/command prompt:

Code: Select all

VBoxManage modifyhd 4c0e493f-9298-45a2-827b-541b897c4cde --autoreset off
What steps 3 and 5 do:
3) Removes the hard disk from your original Windows vm so it can be modified then closes the disk and reopens it as an immutable disk. Creates a new VM and then tells it to create a new differencing disk based on the drive from the original VM.
5) Turns autoreset off for the new differencing disk. Autoreset is on for these disks by default and means that when you power off the VM all disk state is lost. Turning it off allows your data to persist.

You can undoubtedly do much of this through the GUI - it may be easier now you know roughly what you're looking for?
Post Reply