Snapshots on RAM disk?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
jonha
Posts: 33
Joined: 31. Jul 2015, 19:09

Snapshots on RAM disk?

Post by jonha »

Win7/64-bit host, various guests

Most of my VMs are for testing purposes, so they have one or two main .VDIs (which almost never change) and snapshots which change often. I have plenty of RAM and a 2GB RAM disk. Can I point the Snapshots directories (via Junctions or Symbolic Links) to a RAM disk directory I've upfront peopled with the snapshot files or will disaster strike?

(Obviously I have to copy the snapshots back if I want to save them.)
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Snapshots on RAM disk?

Post by scottgus1 »

If you can get the symbolic link thing working, you're probably going to run into a problem with expansion of the snapshot file. It receives all the new data being put on the guest's disk. So say the original vdi in your guest takes up 20GB on your hard disk. Once you make a snapshot, the original vdi will stop growing, and the snapshot file will start growing. Say you then install 10GB of programs and data on your guest. The snapshot file will now contain the 10 GB of data, not the original vdi. Also, any data on the original vdi that the guest OS thinks it needs to change will go into the snapshot instead. The snapshot can grow to the final size the original drive was going to grow to. Probably going to need a bigger ram drive... :D Not to mention the extended shutdown time your host will need to copy the ramdrive's contents onto the host hard drive before powering off, unless you manually re-configure the whole shebang before shutting down.

Snapshots are also delicate. The forums are replete with folks footling about in the Snapshots folder, then they come to the forum asking Why won't my guest boot up?

If I needed super-fast disk access, I'd have a second vdi that contained the data I need to process and put that on the ramdrive. I have had secondary vdi's on a ramdrive for lickity-split-fast save times.

If I really wanted to try having the snapshot vdi on the ramdrive I'd experiment on a guest I did not mind if I hosed. Once I decide to trust my data in such an arrangement I'd be sure to take really regular backups, not only of the guest itself but also of the data in the guest using in-guest live-backup software.
jonha
Posts: 33
Joined: 31. Jul 2015, 19:09

Re: Snapshots on RAM disk?

Post by jonha »

scottgus1 wrote:If you can get the symbolic lick thing working, you're probably going to run a problem with expansion of the snapshot file. It receives all the new data being put on the guest's disk. So say the original vdi in your guest takes up 20GB on your hard disk. Once you make a snapshot, the original vdi will stop growing, and the snapshot file will start growing. Say you then install 10GB of programs and data on your guest. The snapshot file will now contain the 10 GB of data, not the original vdi. Also, any data on the original vdi that the guest OS thinks it needs to change will go into the snapshot instead. The snapshot can grow to the final size the original drive was going to grow to. Probably going to need a bigger ram drive... :D Not to mention the extended shutdown time your host will need to copy the ramdrive's contents onto the host hard drive before powering off, unless you manually re-configure the whole shebang before shutting down.
Well, my use of snapshots means that they never grow beyond a couple hundred MB. (I am testing small bits of self-written or open-source software in the VMs; I'm not installing tens of GB worth of third-party software.) In most cases I would not even need to copy any changed snapshots back.
scottgus1 wrote:If I really wanted to try having the snapshot vdi on the ramdrive I'd experiment on a guest I did not mind if I hosed.
I could do that... I will do that. I have plenty backups of my VMs so the worst that can happen is that I have to copy back one of those. I just wanted to know whether there's an obvious NO-NO with that idea.
 Edit: Well, I just tried and it seems to work. I could run a VM with its Snapshots directory pointing to a RAM disk directory with the original Snapshot files copied into it. After closing the VM I again copied the original Snapshot files to the RAM disk and restarted the VM. This also worked.
If I wanted to save the changed snapshots I would of course have to copy them back to the Snapshots.sav (that's the directory with the original Snapshot files). So this seems to be feasible. 
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Any and all
Contact:

Re: Snapshots on RAM disk?

Post by michaln »

jonha wrote:Can I point the Snapshots directories (via Junctions or Symbolic Links) to a RAM disk directory I've upfront peopled with the snapshot files or will disaster strike?
There should be no problem... VirtualBox accesses files like any other application and doesn't care if the drives are local disks, removable media, network shares, or RAM disks.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Snapshots on RAM disk?

Post by scottgus1 »

Would be interesting to se how it works out!
never grow beyond a couple hundred MB.
Just a thought to keep in mind: I'm fairly sure the snapshot thinks it can grow to the original size of the guest's vdi. If the original vdi was set to more than 2GB in size, then you could get growth beyond the ramdrive's available size at some point. The guest, I think, gets hard crashes when the host runs out of storage space while trying to write to the guest drive.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Snapshots on RAM disk?

Post by mpack »

Well, the guest shouldn't crash, the VM should just be suspended until the disk space issue is fixed.

I'm not really sure I see the point however: if the snapshot is that small then it'll surely be in the disk cache anyway - i.e. already in RAM without all that faffing around with RAMdisks and snapshot copying.
jonha
Posts: 33
Joined: 31. Jul 2015, 19:09

Re: Snapshots on RAM disk?

Post by jonha »

scottgus1 wrote:Just a thought to keep in mind: I'm fairly sure the snapshot thinks it can grow to the original size of the guest's vdi. If the original vdi was set to more than 2GB in size, then you could get growth beyond the ramdrive's available size at some point. The guest, I think, gets hard crashes when the host runs out of storage space while trying to write to the guest drive.
Well, if the RAM disk fills up, that's no different to VBox as if the original HD would fill up. Or so I think.
mpack wrote:I'm not really sure I see the point however: if the snapshot is that small then it'll surely be in the disk cache anyway - i.e. already in RAM without all that faffing around with RAMdisks and snapshot copying.
I am not overly concerned with the snapshot *reading* performance. It is faster writes I am after.

Anyway, I did some more testing and it all seems to work "as expected". It also *feels* faster, but that may be psychology. I should, at some point, do some real benchmarking.

Thx for the input.
Post Reply