I've got a vm with many snapshots. The vm is stored on a SSD and the snapshots are taking up a lot of space. Is it possible to move these snapshots to another drive (e.g., a HDD on the same host, or a network share on another computer)? Or must they always be in the same VirtualBox VMs/[name of particular vm]/Snapshots folder and on the same partition as the .vbox and .vdi files?
If it matters, Linux host and Windows guest.
Storing snapshots on a different 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: Storing snapshots on a different drive?
Don't move the snapshots, move the entire VM. Howto: Move a VM. There would be no benefit to moving just the snapshots, as that's where all the I/O happens.
Re: Storing snapshots on a different drive?
Moving the entire VM doesn't work for me. But I see now that snapshots contain all the differential info since snapshot was taken, so it actually needs to be accessed to be able to access the VM in its current state. So moving the snapshots 'offline' isn't feasible.
Maybe I need to approach this differently. Here's my situation:
I'm running the VM on a laptop with a 240gb SSD; VirtualBox v5.20. I'd like to preserve various prior versions of the VM so that I can go back to them if necessary, which is why I have a number of snapshots. This would be a relatively rare occurrence, so the 'rollback' process need not be as quick as a one-click reversion to a prior snapshot. Because of the limited space on the 240gb SSD for the host OS, apps and data as well as the guest OS, apps and data, and because I don't frequently access prior versions of the VM, I'd like to move these backups to a network share (a desktop computer with a large HDD) or USB backup drive.
Maybe copying the entire VM folder as you suggested is a good way to accomplish this. For example, my current VM has 8 snapshots, and each of these captured system states builds on the system state represented by the preceding snapshot. So the snapshot 'tree' looks like this (grabbed off the internet; my tree would have only 8 snapshots):

So if I want to preserve my existing snapshots and the ability to rollback to those prior states of the VM, but at the same time move this data off my laptop's SSD, maybe I can copy the entire VM folder (/home/ripstop/VirtualBox VMs/myVM1) to a network share or USB backup drive. Then delete all the snapshots from the /myVM1 folder on the laptop, freeing up a lot of space on the SSD. Of course I can take new snapshots, e.g., snapshot #9 (#9 in my series, but snapshot #1 as far as VirtualBox is concerned), etc., as desired.
If I need to get back to the VM as it existed at, say, snapshot #7, I delete the /myVM1 folder from the laptop. Copy the /myVM1 folder from the network share or USB backup to the laptop's /home/ripstop/VirtualBox VMs folder. Then use Machine > Add to add the copied over VM into VirtualBox. The VM will have the same UUID as it originally did and that won't pose a conflict because the 'current' VM was deleted prior to adding the backup VM. Then restore snapshot #7. Do I have all that correct?
And if I wanted to temporarily go back to snapshot #7, and still keep my current VM: Instead of deleting /myVM1 folder, just go into the folder and rename myVM1.vbox to something else, e.g., myVM1.vbox.latest; rename the folder as well, e.g., myVM1latest. Copy the backup /myVM1 folder from network share to the laptop. Use Machine > Add to add this VM. Create a full clone of this VM, which gives it a new UUID. Remove the copied over backup VM, opting to delete all files. Go to the renamed myVM1latest folder and undo the folder and .vbox name changes. Use Machine > Add to add this VM into VirtualBox. Now I have access to both my current VM and the backup VM (with all its snapshots) as the two VMs have different UUIDs. Of course I may have to reactivate Windows (guest OS) in the restored/cloned VM since it has a different UUID than it did at the time it was created, but that should be the only change since it is running on the same host and hardware as it did when it was created. Do I have all this correct?
Maybe I need to approach this differently. Here's my situation:
I'm running the VM on a laptop with a 240gb SSD; VirtualBox v5.20. I'd like to preserve various prior versions of the VM so that I can go back to them if necessary, which is why I have a number of snapshots. This would be a relatively rare occurrence, so the 'rollback' process need not be as quick as a one-click reversion to a prior snapshot. Because of the limited space on the 240gb SSD for the host OS, apps and data as well as the guest OS, apps and data, and because I don't frequently access prior versions of the VM, I'd like to move these backups to a network share (a desktop computer with a large HDD) or USB backup drive.
Maybe copying the entire VM folder as you suggested is a good way to accomplish this. For example, my current VM has 8 snapshots, and each of these captured system states builds on the system state represented by the preceding snapshot. So the snapshot 'tree' looks like this (grabbed off the internet; my tree would have only 8 snapshots):

So if I want to preserve my existing snapshots and the ability to rollback to those prior states of the VM, but at the same time move this data off my laptop's SSD, maybe I can copy the entire VM folder (/home/ripstop/VirtualBox VMs/myVM1) to a network share or USB backup drive. Then delete all the snapshots from the /myVM1 folder on the laptop, freeing up a lot of space on the SSD. Of course I can take new snapshots, e.g., snapshot #9 (#9 in my series, but snapshot #1 as far as VirtualBox is concerned), etc., as desired.
If I need to get back to the VM as it existed at, say, snapshot #7, I delete the /myVM1 folder from the laptop. Copy the /myVM1 folder from the network share or USB backup to the laptop's /home/ripstop/VirtualBox VMs folder. Then use Machine > Add to add the copied over VM into VirtualBox. The VM will have the same UUID as it originally did and that won't pose a conflict because the 'current' VM was deleted prior to adding the backup VM. Then restore snapshot #7. Do I have all that correct?
And if I wanted to temporarily go back to snapshot #7, and still keep my current VM: Instead of deleting /myVM1 folder, just go into the folder and rename myVM1.vbox to something else, e.g., myVM1.vbox.latest; rename the folder as well, e.g., myVM1latest. Copy the backup /myVM1 folder from network share to the laptop. Use Machine > Add to add this VM. Create a full clone of this VM, which gives it a new UUID. Remove the copied over backup VM, opting to delete all files. Go to the renamed myVM1latest folder and undo the folder and .vbox name changes. Use Machine > Add to add this VM into VirtualBox. Now I have access to both my current VM and the backup VM (with all its snapshots) as the two VMs have different UUIDs. Of course I may have to reactivate Windows (guest OS) in the restored/cloned VM since it has a different UUID than it did at the time it was created, but that should be the only change since it is running on the same host and hardware as it did when it was created. Do I have all this correct?
-
Martin
- Volunteer
- Posts: 2562
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: Storing snapshots on a different drive?
The easiest way would be to forget snapshots and just shutdown your guest and copy the complete guest folder to your offline storage location for each state of the guest you want to save.
Re: Storing snapshots on a different drive?
Easiest, but also storage intensive if looking to backup a number of states of the vm. A copy of the guest folder with embedded snapshots can be more space efficient, especially if the various states of the vm aren't hugely different from one another, which is why I'm asking about the methods described above and if they would work as intended.Martin wrote:The easiest way would be to forget snapshots and just shutdown your guest and copy the complete guest folder to your offline storage location for each state of the guest you want to save.
-
Perryg
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: Storing snapshots on a different drive?
The real problem is you can not change the snapshot folder after the fact or the guest will loose them. If you had set that to begin with then nothing bad probably would have happened. ( See the General Advanced section of the guest settings ).
But it has to be said that the house of cards that are created by using snapshots are fragile. You *MUST* have complete, frequent, and good backups to avoid loosing everything. So the way I see it there really is not space savings, but that may just be me.
But it has to be said that the house of cards that are created by using snapshots are fragile. You *MUST* have complete, frequent, and good backups to avoid loosing everything. So the way I see it there really is not space savings, but that may just be me.
-
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: Storing snapshots on a different drive?
No, snapshots are never space efficient. They are arguably time efficient, and that's all.ripstop wrote:A copy of the guest folder with embedded snapshots can be more space efficient
A proper backup is located on a secondary drive, with 0 bytes taken on the system drive. You can't get more space efficient than 0 bytes.
Besides which, snapshots are a difference (patch) list, not a backup. Sounds like you don't have any backups, so if you get a glitch on this host then it's bye bye VM.