I have a VirtualBox VM with Ubuntu installed on normal VDI, and I added another write-through VDI so that I could keep my code intact when I switch between different system snapshots which I use for testing.
According to this answer, any changes I make to the write-through disk are supposed to persist between snapshots. However, it doesn't seem to work - the changes I make to the write-through drive get rolled back as if it was a normal drive.
Here's how I've been testing it so far:
- Attached the drive to the VM in VirtualBox. VirtualBox reports the drive type to be wrote-through.
- Booted the VM and mounted the drive in
/home/dev
. If I open this folder's properties, I get free space reported for the write-through drive, so I safely assume it was indeed mounted correctly where I wanted it. - Created a test file on the write-through drive and made a snapshot.
- Created another file alongside the first and made another snapshot.
- Reverted VM back to snapshot created in step 3. The second file I put on the write-through drive is now gone, as if it was a normal drive instead of a write-through one. Refreshing or re-opening the folder didn't help.
I also tried executing sync
command after creating the files, in case the changes were staying cached and weren't actually written to the disk, but it didn't really change anything.
I read somewhere that there could be problems with write-through disks if there were shared folders attached to the VM, which I do have (two of them in fact). I tried disconnecting those and testing again, but it still wouldn't work.
Did I miss some important step while setting up the second drive? Or do I simply fail to understand how write-through drives are supposed to work and I was doing it wrong all along?