Hi,
We are trying to have a backup of the VM. Please help me how can we take the backup using a batch file getting the path of the VM.
Thanks
VM Machines Path on Windows 10
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: VM Machines Path on Windows 10
A full copy of the completely-shut-down (not save-stated) VM folder with all files therein, as well as the VM's disk files if they are not in the VM's folder, serves as a complete backup of the VM. 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 VM will be ready again. The copy can be used on a different host PC too, just by registering the VM's .vbox file.
A script can cause a VM shutdown by running:
vboxmanage controlvm "VM Name" acpipowerbutton
If the OS in the VM is configured to automatically shut down when its "power button" is pushed, then the VM will shut down nicely.
After sending 'acpipowerbutton' the script then goes into a loop, reading the output of:
vboxmanage showvminfo "VM Name"
checking for the text:
Once that text is found, the VM is ready for copying. Use the host OS Script commands to copy the VM folder. If any disk files are outside the folder, have commands to copy them too.
FC the folder & files for integrity.
Then restart the VM if desired by running:
vboxmanage startvm "VM Name"
A script can cause a VM shutdown by running:
vboxmanage controlvm "VM Name" acpipowerbutton
If the OS in the VM is configured to automatically shut down when its "power button" is pushed, then the VM will shut down nicely.
After sending 'acpipowerbutton' the script then goes into a loop, reading the output of:
vboxmanage showvminfo "VM Name"
checking for the text:
State: powered off
(yes there's that many spaces in the text)Once that text is found, the VM is ready for copying. Use the host OS Script commands to copy the VM folder. If any disk files are outside the folder, have commands to copy them too.
FC the folder & files for integrity.
Then restart the VM if desired by running:
vboxmanage startvm "VM Name"
-
- Site Moderator
- Posts: 20945
- Joined: 30. Dec 2009, 20:14
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows, Linux
Re: VM Machines Path on Windows 10
BTW:
Any 'backup' process you may come across that claims to work using snapshots actually leaves the copy in a state as if the VM were powered off without a proper shut-down, same as if the power plug were pulled. Unfinished data writes, half-files, dirty databases. Don't rely on a process that uses snapshots as a backup.
Exporting and cloning aren't recommended for backing up a VM. Either process changes some guest settings, and a change in the guest means there's no way to confirm the backup. The Moving/Backing Up a VM method allows a simple FC file compare for backup confirmation and is compatible with encrypted guests. Additionally, Export tries to match the older OVA format and is intended for using a guest under another hypervisor besides Virtualbox. The OVA format is not compatible with encrypted guests: guests must be decrypted to export.
Any 'backup' process you may come across that claims to work using snapshots actually leaves the copy in a state as if the VM were powered off without a proper shut-down, same as if the power plug were pulled. Unfinished data writes, half-files, dirty databases. Don't rely on a process that uses snapshots as a backup.
Exporting and cloning aren't recommended for backing up a VM. Either process changes some guest settings, and a change in the guest means there's no way to confirm the backup. The Moving/Backing Up a VM method allows a simple FC file compare for backup confirmation and is compatible with encrypted guests. Additionally, Export tries to match the older OVA format and is intended for using a guest under another hypervisor besides Virtualbox. The OVA format is not compatible with encrypted guests: guests must be decrypted to export.