Dear Sirs,
I have 2 questions for you. 1. Can I make snapshots of the virtual machine automatically and how? 2. Which files and folders, except of hard drive should be backed up, when using third party software?
Regards,
Alexander
auto backup of virtual machine state
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: auto backup of virtual machine state
Not with any VirtualBox feature.alexelsevier wrote: 1. Can I make snapshots of the virtual machine automatically and how?
I'm not sure what "when using third party software" means, but to back up a VM you back up the entire VM folder, i.e. the folder containing the .vbox file with all it's contents.alexelsevier wrote: 2. Which files and folders, except of hard drive should be backed up, when using third party software?
Since the two are mentioned in virtually the same breath, I sense a confusion that snapshots are backups. Snapshots are not in any way related to backups, quite the opposite in fact, i.e. the indiscriminate use of snapshots makes data loss more likely. Just search the forums if you want confirmation. Experienced users tend to avoid snapshots, relying on simple folder structures and proper backups.
-
- Posts: 30
- Joined: 11. Jun 2018, 11:43
- Primary OS: Linux other
- VBox Version: PUEL
- Guest OSses: Windows 10, Kali, Fedora/RHEL
Re: auto backup of virtual machine state
You can start something like this via cron/scheduler:
Linux:
vboxmanage snapshot <vm_name> take backup_$(date +%Y_%m_%d_%H_%M) --live
Windows (PowerShell):
vboxmanage snapshot <vm_name> take backup_$(Get-Date -Format yyyy_MM_dd_HH_mm) --live
Linux:
vboxmanage snapshot <vm_name> take backup_$(date +%Y_%m_%d_%H_%M) --live
Windows (PowerShell):
vboxmanage snapshot <vm_name> take backup_$(Get-Date -Format yyyy_MM_dd_HH_mm) --live
Hosts: Arch Linux, Windows 10;
Guests: Windows 10, Kali, Fedora/RHEL.
Guests: Windows 10, Kali, Fedora/RHEL.
-
- Posts: 4
- Joined: 27. Apr 2020, 18:47
Re: auto backup of virtual machine state
Writing third party software, I meant backup software of another developers. Thanks for your info. I have one question. My virtual hard drive is in other folder. Should I backup it also?
Regards,
Alexander
Regards,
Alexander
-
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Mostly XP
Re: auto backup of virtual machine state
Naturally, but no VM file should be outside the VM folder if you want an easy life. If some VM files are too big for your hard drive then move the entire VM folder to another drive, don't scatter VM files like confetti over your PC.alexelsevier wrote:I have one question. My virtual hard drive is in other folder. Should I backup it also?
Howto: Move a VM.
-
- Posts: 4
- Joined: 27. Apr 2020, 18:47
Re: auto backup of virtual machine state
Thank you for answer, please write me, why it is undesirable to locate the virtual drives in different folders and partitions of physical hard drive.
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: auto backup of virtual machine state
A copy of the shut-down (not save-stated) guest folder with all files therein, as well as the guest disk files if they are not in the guest folder, serves as a complete backup of the activated guest. You can FC file-compare the backup to confirm the copy. If the original is lost, move a copy of the backup back to the original location and the guest will be ready again. The copy can be used on a different host PC too, just by registering the guest's .vbox file.
Note that if the original guest had all the guest disk files in the guest folder, the guest is completely usable on any capable host and host OS.
If the disk files are outside the guest folder then the .vbox file has absolute paths to the disk files and these paths must be either reproduced on the new host or the .vbox file must be modified. Absolute paths mean:
Windows: diskletter:\path\to\drivefile.vdi
Linux: /mountpoint/path/to/drivefile.vdi
Mac: /users/path/to/drivefile.vdi (I think)
Solaris: haven't/the/foggiest/idea/:lol:
These would require editing to use the guest on a different OS-family host, or the same OS-family host where the 'driveletter' or 'mountpoint' did not exist.
A relative path is:
drivefile.vdi (works on any of the above)
Virtualbox 6 has the ability to move a drive file and an entire guest folder wherever you want it to be:
Move the drive file into the guest folder with the .vbox file, using Virtual Media Manager's Move command.
Move the whole guest to a different disk by right-clicking the guest in the guest list and choose Move.
Move your guest to the disk your guest's virtual drive is on, then move the drive file into the guest folder.
Note that if the original guest had all the guest disk files in the guest folder, the guest is completely usable on any capable host and host OS.
If the disk files are outside the guest folder then the .vbox file has absolute paths to the disk files and these paths must be either reproduced on the new host or the .vbox file must be modified. Absolute paths mean:
Windows: diskletter:\path\to\drivefile.vdi
Linux: /mountpoint/path/to/drivefile.vdi
Mac: /users/path/to/drivefile.vdi (I think)
Solaris: haven't/the/foggiest/idea/:lol:
These would require editing to use the guest on a different OS-family host, or the same OS-family host where the 'driveletter' or 'mountpoint' did not exist.
A relative path is:
drivefile.vdi (works on any of the above)
Virtualbox 6 has the ability to move a drive file and an entire guest folder wherever you want it to be:
Move the drive file into the guest folder with the .vbox file, using Virtual Media Manager's Move command.
Move the whole guest to a different disk by right-clicking the guest in the guest list and choose Move.
Move your guest to the disk your guest's virtual drive is on, then move the drive file into the guest folder.
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: auto backup of virtual machine state
If you want to take a backup while the guest is running, use compatible 3rd-party software inside the guest. Use a real shared folder and a network (not a Guest Additions Shared Folder) to get the backup files out of the guest. The 3rd-party software should be compatible with all the software & databases you are running on the guest. It is not in the scope of the Virtualbox forum to support 3rd-party software in a guest.
Running cron-based or task-scheduler-based schemes from the host OS will cause a supposed 'backup' of the guest OS in a 'just-pulled-the-power-plug' crash-consistent state, which may result in data loss.
Running cron-based or task-scheduler-based schemes from the host OS will cause a supposed 'backup' of the guest OS in a 'just-pulled-the-power-plug' crash-consistent state, which may result in data loss.
-
- Posts: 2
- Joined: 6. Jan 2023, 01:18
Re: auto backup of virtual machine state
I know I am replying three years later, but this might help other people.
I found this code on GitHub that might help:
https://github.com/niro1987/VirtualBox-Backup
I found this code on GitHub that might help:
https://github.com/niro1987/VirtualBox-Backup
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: PUEL
- Guest OSses: Windows, Linux
Re: auto backup of virtual machine state
Thanks for showing us that link, RoadIT. From this on that website:
Since the VM is being shut down anyway, might as well just do a normal folder-copy backup and be sure of the backup. And the "to reduce downtime, a snapshot is created" aspect reminds me strongly of the "use a snapshot to back up a running VM" so-called 'backup' method that leaves the 'backed-up' VM in a power-plug-pull state mentioned above, with all the possible problems that can come from power failure in a running OS.
If the automation system skipped the snapshot and just took the hit of increased downtime to do a file-compared folder copy, then I'd be ok with it. If one doesn't want the downtime, the 3rd-party-software-inside-the-VM method above is the best way.
A snapshot is used during the backup process. Snapshots complicate the VM and can set up situations that break the VM, especially that app's Keep function, which can leave such a house of cards' worth of snapshots that Keep should not have been programmed.In order to succesfully create a backup, the VM needs to be in a stable (not changing) state. To reduce downtime, a snapshot is created and the VM is restarted (if it was running in the first place).
Since the VM is being shut down anyway, might as well just do a normal folder-copy backup and be sure of the backup. And the "to reduce downtime, a snapshot is created" aspect reminds me strongly of the "use a snapshot to back up a running VM" so-called 'backup' method that leaves the 'backed-up' VM in a power-plug-pull state mentioned above, with all the possible problems that can come from power failure in a running OS.
If the automation system skipped the snapshot and just took the hit of increased downtime to do a file-compared folder copy, then I'd be ok with it. If one doesn't want the downtime, the 3rd-party-software-inside-the-VM method above is the best way.