Automatic daily snapshot script solution

This is for discussing general topics about how to use VirtualBox.
Post Reply
pre2si
Posts: 3
Joined: 20. Sep 2018, 18:41

Automatic daily snapshot script solution

Post by pre2si »

Hi, some time ago I was looking for a solution to this problem ... create a daily incremental backup (via snapshot).
I created a script (bat) that works I share with you ...

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup01" --name "AutomaticBackupOLD"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup02" --name "AutomaticBackup01"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup03" --name "AutomaticBackup02"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup04" --name "AutomaticBackup03"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup05" --name "AutomaticBackup04"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} take "AutomaticBackup05"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} delete "AutomaticBackupOLD"
through a game of creation and renaming, backups always remain 5 ... of the previous 5 days (for example start the script every night) :wink:
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Automatic daily snapshot script solution

Post by mpack »

Those are not backups, those are snapshots.

A snapshot is not a backup in any sense. Don't believe me? Then try deleting the base VDI and then see how easily you can recover data. I suggest that you make a real backup before trying this.
socratis
Site Moderator
Posts: 27330
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: Automatic daily snapshot script solution

Post by socratis »

pre2si wrote:through a game of creation and renaming
Outside VirtualBox? And this thing works?

And just out of curiosity, why do you want to take an automatic daily snapshot? What's your goal?
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: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Automatic daily snapshot script solution

Post by mpack »

He says what his goal is, i.e. to "create an incremental daily backup". Hence my response above.
socratis
Site Moderator
Posts: 27330
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: Automatic daily snapshot script solution

Post by socratis »

"Not strong enough dear Watson, not strong enough..."
;)
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.
pre2si
Posts: 3
Joined: 20. Sep 2018, 18:41

Re: Automatic daily snapshot script solution

Post by pre2si »

mpack wrote:Those are not backups, those are snapshots.

A snapshot is not a backup in any sense. Don't believe me? Then try deleting the base VDI and then see how easily you can recover data. I suggest that you make a real backup before trying this.
I know ... I just needed to create automatic daily snapshot (the script works perfectly, I've been testing it for months). I use it on virtual machines with small web services (wordpress redmine etc ..) If something happens I can go back.
I find it very useful (it is my opinion of course) ... I have only reported if it can be useful to someone
Megamike
Posts: 1
Joined: 26. Nov 2018, 16:42

Re: Automatic daily snapshot script solution

Post by Megamike »

pre2si wrote:Hi, some time ago I was looking for a solution to this problem ... create a daily incremental backup (via snapshot).
I created a script (bat) that works I share with you ...

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup01" --name "AutomaticBackupOLD"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup02" --name "AutomaticBackup01"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup03" --name "AutomaticBackup02"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup04" --name "AutomaticBackup03"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup05" --name "AutomaticBackup04"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} take "AutomaticBackup05"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} delete "AutomaticBackupOLD"
through a game of creation and renaming, backups always remain 5 ... of the previous 5 days (for example start the script every night) :wink:
can you please be more detailed of how to make it? i'm looking everywhere for automatic snapshots but i can't make up how to actually create the bat file. thank you so much!
pre2si
Posts: 3
Joined: 20. Sep 2018, 18:41

Re: Automatic daily snapshot script solution

Post by pre2si »

Create a .bat script containing this code. For example I run the .bat via windows scheduled operation. This script is used to create automatic snapshot points (5). This script does not create backups!
It works perfectly without problems. I also use it on hyper-v machines (adapting the code via powershell).
Last edited by socratis on 4. Jul 2019, 09:17, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
s1L3nCe
Posts: 15
Joined: 14. Apr 2015, 19:24

Re: Automatic daily snapshot script solution

Post by s1L3nCe »

pre2si wrote: 20. Sep 2018, 18:58 Hi, some time ago I was looking for a solution to this problem ... create a daily incremental backup (via snapshot).
I created a script (bat) that works I share with you ...

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup01" --name "AutomaticBackupOLD"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup02" --name "AutomaticBackup01"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup03" --name "AutomaticBackup02"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup04" --name "AutomaticBackup03"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} edit "AutomaticBackup05" --name "AutomaticBackup04"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} take "AutomaticBackup05"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" snapshot {machine_id} delete "AutomaticBackupOLD"
through a game of creation and renaming, backups always remain 5 ... of the previous 5 days (for example start the script every night) :wink:
Great finding! This is so useful!
Post Reply