Page 1 of 1

[solved] Howto update a immutable vdi

Posted: 25. Oct 2009, 16:01
by carsten.spiess
Hello all,

what's the way to update a immutable vdI (virtualbox 3.0.8 )?

I have a VM for my guests for internet access where
i want to update the guest additions from 2.1.4 to 3.0.8

My first attempt (which was not working) was to
1. set the vdi's state to normal (vboxmanage modifyhd immutable.vdi --type normal)
2. start the VM
3. install the updates
4. shutdown the VM
5. set the vdi's state to immutable again (vboxmanage modifyhd immutable.vdi --type immutable)
6. start the VM again
Now the VM has the state before installing the updates :shock:
Is this a bug or did i made a mistake?

The second (working) attempt:
1. clone the vdi and make it normal (vboxmanage clonehd immutable.vdi temp.vdi --type normal)
2. register temp.vdi
2. attach temp.vdi to the VM
3. start the VM
3. install the updates
4. shutdown the VM
5. detach temp.vdi from the VM
6. unregister immutable.vdi and temp.vdi
7. delete immutable.vdi
8. rename temp.vdi to immutable.vdi.
9. register immutable.vdi
10. set the vdi's state to immutable (vboxmanage modifyhd immutable.vdi --type immutable)
11. attach immutable.vdi to the VM
12. start the VM again
Now it has the updates installed and is immutable again :D .
But the detaching, attaching and registering stuff is is complex and clonehd takes a long time.
Is there a better solution :?:
Thanks for your help, regards
Carsten

Re: Howto update a immutable vdi

Posted: 25. Oct 2009, 16:10
by Sasquatch
A better solution? Yes. Unregister the immutable VDI and register it the normal way. Update the VDI to what you want, then unregister it and register it as immutable. No need for a clone.

Re: Howto update a immutable vdi

Posted: 25. Oct 2009, 17:49
by carsten.spiess
Sasquatch wrote:A better solution? Yes. Unregister the immutable VDI and register it the normal way. Update the VDI to what you want, then unregister it and register it as immutable. No need for a clone.
I tried that also, but it didn't work. Maybe i have to delete the snapshot manually.
I think i need at least a new uuid for the vdi.

Re: Howto update a immutable vdi

Posted: 26. Oct 2009, 00:57
by MarkCranness
carsten.spiess wrote:Maybe i have to delete the snapshot manually.
The 'snapshot' is the key to this.

When you originally attached the immutable disk to the VM, an empty differencing disk was created, it was actually that differencing hard disk that was attached. If you use Virtual Media Manager, you can see that: Immutable.vdi will be displayed as "Not Attached", but it has a differencing disk under it, which is attached to your VM.

Changing Immutable.vdi to Normal then had no effect, because any changes go into the differencing disk anyway, regardless of what type Immutable.vdi is, and the differencing disk is discarded and recreated each time you start the VM.

A correct process might be:
  • Detach the VDI from the VM
  • (Edit: required) Delete the now unused differencing disk (use Virtual Media Manager)
  • Set the VDI's state to normal (VBoxManage modifyhd immutable.vdi --type normal)
  • Attach it to the VM
  • Start VM, Install updates, Shutdown VM
  • Detach the VDI from the VM
  • Set the VDI's state to immutable again
  • Attach to VM

Re: Howto update a immutable vdi

Posted: 31. Oct 2009, 16:15
by carsten.spiess
MarkCranness wrote: A correct process might be:...
Thank you Mark, this works fine :D.