Page 1 of 1

Automatic daily snapshot script solution

Posted: 20. Sep 2018, 18:58
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:

Re: Automatic daily snapshot script solution

Posted: 20. Sep 2018, 19:09
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.

Re: Automatic daily snapshot script solution

Posted: 20. Sep 2018, 19:28
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?

Re: Automatic daily snapshot script solution

Posted: 21. Sep 2018, 11:02
by mpack
He says what his goal is, i.e. to "create an incremental daily backup". Hence my response above.

Re: Automatic daily snapshot script solution

Posted: 21. Sep 2018, 11:57
by socratis
"Not strong enough dear Watson, not strong enough..."
;)

Re: Automatic daily snapshot script solution

Posted: 21. Sep 2018, 13:24
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

Re: Automatic daily snapshot script solution

Posted: 26. Nov 2018, 16:44
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!

Re: Automatic daily snapshot script solution

Posted: 3. Jul 2019, 15:38
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).

Re: Automatic daily snapshot script solution

Posted: 19. Mar 2024, 15:18
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!