Keeping only 4 last snapshots of a scheduled basis snapshot chain

This is for discussing general topics about how to use VirtualBox.
Post Reply
devPRO
Posts: 1
Joined: 3. Oct 2019, 13:22

Keeping only 4 last snapshots of a scheduled basis snapshot chain

Post by devPRO »

Hello,

I have created a scheduled routine to create a weekly snapshot of a VM(Using Task Scheduler and VBoxManage).

Over time a long snapshot chain is being kept.

I want to save the last 4 snapshots (a month) every time, what would be the command for that? (this can also be a PowerShell Script)

Your help is highly appreciated,
Rotem
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: Keeping only 4 last snapshots of a scheduled basis snapshot chain

Post by socratis »

devPRO wrote:I have created a scheduled routine to create a weekly snapshot of a VM
Since the Snapshot feature is a user-initiated one, I suggest you create a scheduled routine to merge older snapshots.

Remember that 1) Snapshots are *not* backups, 2) Snapshots work at the disk-sector level, not at the file level, 3) a backup isn't a backup until a successful restore has been attempted.
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.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Keeping only 4 last snapshots of a scheduled basis snapshot chain

Post by mpack »

devPRO wrote:Hello,
I have created a scheduled routine to create a weekly snapshot of a VM(Using Task Scheduler and VBoxManage).

Over time a long snapshot chain is being kept.
Why? You do realize that a well placed shot of corruption, at the second snapshot let's say, would lose you the entire snapshot chain? Snapshots are not backups, in fact they increase the probability of losing data. Backups are backups.
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: Keeping only 4 last snapshots of a scheduled basis snapshot chain

Post by socratis »

Actually mpack's post reminded me that I should have pointed you to the "Snapshot basics" post. Make sure you read it thoroughly and understand why:
socratis wrote:1) Snapshots are *not* backups
mpack wrote:Snapshots are not backups ... Backups are backups.
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.
Post Reply