Page 1 of 1

Autoreset

PostPosted: 4. Jun 2010, 01:58
by dsummer
Hello All,

I have a virtual machine with an immutable disk that I want to reset on every boot. Host OS is Ubuntu 10.04 64bit. The problem is the differencing disk does not reset on each boot. I ran

VBoxManage openmedium disk /opt/local/virtualbox/Disk3.vdi --type immutable
VBoxManage storageattach XP --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /opt/local/virtualbox/Disk3.vdi

Then, the command

VBoxManage showhdinfo 3c7cec25-c0bc-41c7-9156-8df996079866

gives the output

Oracle VM VirtualBox Command Line Management Interface Version 3.2.2
(C) 2005-2010 Oracle Corporation
All rights reserved.

UUID: 3c7cec25-c0bc-41c7-9156-8df996079866
Accessible: yes
Description:
Logical size: 0 MBytes
Current size on disk: 0 MBytes
Type: normal (differencing)
Storage format: VDI
In use by VMs: XP (UUID: c48d8595-ecdc-4741-6bbc-e3f20685df06)
Location: /opt/local/virtualbox/{3c7cec25-c0bc-41c7-9156-8df996079866}.vdi
Auto-Reset: off

My understanding is that the default behavior is for differencing disks to have autoreset on by default.

I've tried
VBoxManage modifyhd 3c7cec25-c0bc-41c7-9156-8df996079866 --autoreset on
VBoxManage modifyhd --autoreset on 3c7cec25-c0bc-41c7-9156-8df996079866

Yet neither of them change the autoreset bahavior. I have also tried to create a snapshot immediately after attaching the disk to the VM, and marking the new differencing disk's autoreset to on, but showhdinfo always reports that it is off.

Please advise on what I am doing wrong.

Thanks,
Doug

Re: Autoreset

PostPosted: 4. Jun 2010, 02:17
by Perryg
Humm maybe this is what you are looking for.

VBoxManage modifyhd <uuid>|<filename>
    [--type normal|writethrough|immutable]
    [--autoreset on|off]
    [--compact]

Re: Autoreset

PostPosted: 4. Jun 2010, 05:18
by tawalusa
I believe this is a regression in VirtualBox 3.2.0 and 3.2.2. I'm experiencing the same difficulties with OSX 10.5 host and Windows XP and Windows 2000 guests. The Win2K guest was configured properly and automatically resetting months ago. Now with version 3.2.0 and 3.2.2 the differencing disk is not discarded on restart.

I just set up the Windows XP disk as immutable to test, and no matter what I do, I can't get the:

vboxmanage modifyhd --autoreset on {uuid}

to accomplish anything.

I believe this is the same issue discussed in tickets #2772 and #6832.

I just reverted to Virtualbox 3.1.8 and the behavior has returned to normal for both virtual machines.

Re: Autoreset

PostPosted: 4. Jun 2010, 14:41
by dsummer
Thanks for the reply. This regression is quite annoying for me. I need to have the immutable disk functionality with autoreset on for my application. I checked the VirtualBox.xml file, and the autoreset parameter is correctly changed by VBoxManage modifyhd --autoreset on/off. VBoxManage showhdinfo, however, always shows that it is off.

I tried another approach based on the references you provided. However, I seem to have run into another issue. I attach the primary disk image as normal, but made the file read-only. Then I created a snapshot with

Code: Select all   Expand viewCollapse view
VBoxManage snapshot XP take currentstate

booted the VM, and all was well. After shutting down, I tried

Code: Select all   Expand viewCollapse view
VBoxManage snapshot XP delete currentstate


and get

Code: Select all   Expand viewCollapse view
Oracle VM VirtualBox Command Line Management Interface Version 3.2.2
(C) 2005-2010 Oracle Corporation
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...FAILED
Error: snapshot operation failed. Error message: Could not merge the hard disk '/opt/local/virtualbox/{7b89be34-c72d-4a4b-aa6a-7752453c022a}.vdi' to '/opt/local/virtualbox/XPDisk3.vdi' (VERR_ACCESS_DENIED)


It seems that it is trying to merge the differencing disk with the original disk, but is failing because the original disk file is write protected. Since I am discarding the state, why is it trying to merge the changes?

Re: Autoreset

PostPosted: 4. Jun 2010, 16:53
by gsearle
I noticed the same thing. I have a Windows XP VM set up with an immutable disk for temporary storage. This disk rose to 1/2 GB in size before I noticed that it wasn't getting reset.

Re: Autoreset

PostPosted: 4. Jun 2010, 17:57
by tawalusa
@dsummer

If I understand correctly, "currentstate" in the case of your code below is the name you are giving the snapshot rather than a keyword:

Then I created a snapshot with

Code: Select all   Expand viewCollapse view
VBoxManage snapshot XP take currentstate


booted the VM, and all was well. After shutting down, I tried

Code: Select all   Expand viewCollapse view
VBoxManage snapshot XP delete currentstate



In which case I believe your instruction to return to that snapshot would be to "restore" rather than "delete" the referenced snapshot, i.e.

Code: Select all   Expand viewCollapse view
VBoxManage snapshot XP restore currentstate


This is confusing in that the snapshot you saved as "currentstate" is not the dynamic "Current State" of the VM, but rather the original state before runtime modifications that you want to return to.

According to the manual:
The delete operation deletes a snapshot (specified by name or by UUID). This can take a while to finish since the differencing images associated with the snapshot might need to be merged with their child differencing images.


The way I understand the implementation is that the snapshot is a point in history you want to be able to preserve. "Deleting" the snapshot doesn't discard all subsequent changes, but rather deletes your ability to preserve that state by merging it with it's associated images. So you're not actually discarding the data of the snapshot, but rather the reference to that particular point in time. I hope that makes sense, because even my explanation is a little confusing to me.

Perhaps the
VBoxManage discardstate
command is applicable, but I have NOT tried it. It may only work with a VM that has been suspended.
 Edit: Just tried it and confirmed discardstate is only applicable to "saved" or suspended virtual machines. 


It appears to me that this issue was introduced in version 2.1.x, resolved in 2.2.0, and resurfaced with 3.2.x. As you have observed and I can confirm, the VirtualBox software appears to be ignoring the [autoReset="true"] parameter in the VirtualBox.xml file.

So far, my workaround has been to downgrade to VirtualBox 3.1.8.

I hope someone on the forums with more experience than I will notice this thread and update Ticket #6832 accordingly.

Re: Autoreset

PostPosted: 5. Jun 2010, 12:20
by dsummer
Thanks Tawalusa!

Clearly I was thinking of that wrong. Your explanation made perfect sense. I was looking at delete as going backwards in time to the point that I created the snapshot (i.e. deleting the differencing disk). But of course I would want to restore back to the point in time at which I took the snapshot.

Using restore works fine and gives me a way to cope with the broken autoreset functionality. Thanks.

Re: Autoreset

PostPosted: 7. Jun 2010, 17:05
by gsearle
Not resolved for 3.2.2.

Re: Autoreset

PostPosted: 10. Jun 2010, 15:30
by tawalusa
Issue is still present in VirtualBox 3.2.4. I have updated http://www.virtualbox.org/ticket/6832 accordingly. It's my first time contributing to the trouble ticket system, so my submission didn't format quite as expected, but I hope it is still helpful.

Re: Autoreset

PostPosted: 3. Jul 2010, 06:52
by DaveN
I also experienced this problem in VirtualBox 3.2.0, so rolled back to 3.1.8.

Can anyone confirm whether or not it has been fixed in 3.2.6? Judging from the open state of tickets #2772 and #6832 and no mention of this problem in the release notes, I'm guessing it has not been fixed.

Cheers,
DaveN

Re: Autoreset

PostPosted: 25. Jul 2010, 23:10
by krez
Still not fixed in 3.2.6.