Data Persistence 2nd Drive, Restore Snapshot Primary Drive

This is for discussing general topics about how to use VirtualBox.
Post Reply
Senrabdet
Posts: 3
Joined: 29. Nov 2016, 03:34

Data Persistence 2nd Drive, Restore Snapshot Primary Drive

Post by Senrabdet »

Hi All:

I'm looking to do something which may have been explained but can't find it (apologies if that's true).

I'm working with VirtualBox 5.1.6 with a win7 guest running on win10 host. I'd like to:
- on my win7 guest have my OS and my apps on the primary drive that I can snapshot and restore to "known good"
- have a 2nd VDI drive attached to the VM where I keep data that survives the snapshot restores of the primary drive.

E.g., I change data on my secondary drive. At some point, I restore the primary to a snapshot, but my new data stays on the 2nd drive.

I've tried this. I've set up 2nd drive as a VDI write through, though after looking at various posts it's not clear that either write-through or immutable are what I need.

Currently, when I do the restore to a snapshot, the 2nd drive loses any new data as well.

Suggestions appreciated. Thanks.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Data Persistence 2nd Drive, Restore Snapshot Primary Drive

Post by socratis »

Senrabdet wrote:it's not clear that either write-through or immutable are what I need.
From the manual, Ch. 1.10.1 "Taking, restoring and deleting snapshots", I don't think it could be clearer:
Note: Restoring a snapshot will affect the virtual hard drives that are connected to your VM, as the entire state of the virtual hard drive will be reverted as well. This means also that all files that have been created since the snapshot and all other file changes will be lost. In order to prevent such data loss while still making use of the snapshot feature, it is possible to add a second hard drive in “write-through” mode using the VBoxManage interface and use it to store your data. As write-through hard drives are not included in snapshots, they remain unaltered when a machine is reverted. See chapter 5.4, Special image write modes, page 85 for details.
which basically means you create a new HD and you attach it to the VM, and then with the VM shut down completely, from the Command Prompt you should enter the command:
  • VBoxManage modifymedium <VDIPath_or_UUID> --type writethrough
Senrabdet wrote:Currently, when I do the restore to a snapshot, the 2nd drive loses any new data as well.
You haven't created a write-though drive then. I just tried it and it works as advertised.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Senrabdet
Posts: 3
Joined: 29. Nov 2016, 03:34

Re: Data Persistence 2nd Drive, Restore Snapshot Primary Drive

Post by Senrabdet »

Thanks, that's helpful (not sure how drive is not write through), will create another drive, try again and post.
Senrabdet
Posts: 3
Joined: 29. Nov 2016, 03:34

Re: Data Persistence 2nd Drive, Restore Snapshot Primary Drive

Post by Senrabdet »

Thanks again for the help, that did it. I think (per some other posts), my mistake was when in a sequence of steps I changed the drive type into a write through (after creating it, starting to experiment, than using media manager to change its type when it had already been used...so I changed it later than was necessary). This time per your suggestion, I created it, attached, changed type per the command you suggested, then started the VM, used disk manager to open and format etc. So my guess is it was a matter of sequencing, doing steps in the right order. Thanks again so much for the help, had me stumped.
Post Reply