Automatic daily snapshot script solution

This is for discussing general topics about how to use VirtualBox.

Automatic daily snapshot script solution

Postby pre2si » 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   Expand viewCollapse view
"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:
pre2si
 
Posts: 3
Joined: 20. Sep 2018, 18:41

Re: Automatic daily snapshot script solution

Postby mpack » 20. Sep 2018, 19:09

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.
mpack
Site Moderator
 
Posts: 29561
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Automatic daily snapshot script solution

Postby socratis » 20. Sep 2018, 19:28

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?
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 24684
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Automatic daily snapshot script solution

Postby mpack » 21. Sep 2018, 11:02

He says what his goal is, i.e. to "create an incremental daily backup". Hence my response above.
mpack
Site Moderator
 
Posts: 29561
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Automatic daily snapshot script solution

Postby socratis » 21. Sep 2018, 11:57

"Not strong enough dear Watson, not strong enough..."
;)
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 24684
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Automatic daily snapshot script solution

Postby pre2si » 21. Sep 2018, 13:24

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
pre2si
 
Posts: 3
Joined: 20. Sep 2018, 18:41

Re: Automatic daily snapshot script solution

Postby Megamike » 26. Nov 2018, 16:44

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   Expand viewCollapse view
"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!
Megamike
 
Posts: 1
Joined: 26. Nov 2018, 16:42

Re: Automatic daily snapshot script solution

Postby pre2si » 3. Jul 2019, 15:38

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.
pre2si
 
Posts: 3
Joined: 20. Sep 2018, 18:41


Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 11 guests