Host: XP
Guest: Win2K
The Win2K OS has some important stuff I want to routinely backup with as little effort as possible, which for me is backing up the entire VDI and support files. The machine running this is a dedicated machine, setup strictly to run VB. There is a lot of work at rebuilding the OS to get things where I need them to be, unfortunately.
On the host, I want to run a batch file that will issue "VBoxManage controlvm myVM acpipowerbutton" to shut down the system safely, wait until the OS is shut down safely, then proceed to do maintenance, such as copy the VDI and support files to another computer on the network, then start the OS up again with "VBoxManage startvm myVM"
The first part is where I get stuck, so to speak. With my initial tests, once the command is sent to the VM, I'm returned to the command prompt, but the OS still lives (Although it is being powered down). Is there something I can use that will cause the batch file to wait until the OS is down and "turned off"?
Wait for shutdown
-
fixedwheel
- Volunteer
- Posts: 1699
- Joined: 13. Sep 2008, 02:18
Re: Wait for shutdown
Pontiac wrote:Is there something I can use that will cause the batch file to wait until the OS is down and "turned off"?
but the guest OS is still "running", like it would be suspended on real hardware.virtualbox manual section 8.7. VBoxManage controlvm wrote:VBoxManage controlvm <vm> savestate will save the current state of the VM to disk and then stop the VM. (This is equivalent to selecting the "Close" item in the "VM" menu of the GUI or pressing the window's close button, and then selecting "Save the machine state" in the dialog.)
After this, the VM's state will be "Saved". From there, it can be started again; see Section 8.6, “VBoxManage startvm”.
hmm... i dont know where the state is saved, if you need more than the vdi for backup copy edit: it is written in the VDI tutorial from TerryE backup copy the "savestate" VDI seems sufficient
Thanks for the hint, but this is a couple of degrees off what I would feel comfortable running for the backups.
Its true that the machine would be put into a suspended state, and VBox did create a file, and I did find where where it does create said file for this new paused state. This new state file does get cleaned up once I restart the VM.
I'm hesitant to use this for the simple reason is that the system is more abruptly thrown into suspended mode, so if there is a particular network transaction going on, and the VM is put into this state, data loss could occur as not many applications know how to deal with this kind of disconnect. I also saw that the network was dropped, then re-established once I restarted the VM. This could cause unforseen problems. Theoretically, if I were to go with this process, and eventually the hard drive this VM lives on does die, I essentially wouldn't get a "Clean boot", and I don't know if I'd be able to bring the machine back up.
What did I witness with your suggestion is that the VM is indeed put into a paused state, and (at least in Linux) the VBoxManage does pause the batch file (Assuming its done the same on the XP Host machine) until the VM is terminated. But the data integrity is whats got me scared. Its kind of between just yanking the power cable out of your computer, and pulling the network cable out. By far, just yanking on the power cable could cause more damage than yanking the network cable, as a lot of OTHER things could be waiting to write to the HDD. Yanking the network cable just drops communications, but, the software is still running in the background and will still be shut down properly. This just feels different. I also wonder what happens with time, as one of the DBs needs somewhat accurate time.
Very tough call, but if nothing else works, this just may be the way to do it. :/
Its true that the machine would be put into a suspended state, and VBox did create a file, and I did find where where it does create said file for this new paused state. This new state file does get cleaned up once I restart the VM.
I'm hesitant to use this for the simple reason is that the system is more abruptly thrown into suspended mode, so if there is a particular network transaction going on, and the VM is put into this state, data loss could occur as not many applications know how to deal with this kind of disconnect. I also saw that the network was dropped, then re-established once I restarted the VM. This could cause unforseen problems. Theoretically, if I were to go with this process, and eventually the hard drive this VM lives on does die, I essentially wouldn't get a "Clean boot", and I don't know if I'd be able to bring the machine back up.
What did I witness with your suggestion is that the VM is indeed put into a paused state, and (at least in Linux) the VBoxManage does pause the batch file (Assuming its done the same on the XP Host machine) until the VM is terminated. But the data integrity is whats got me scared. Its kind of between just yanking the power cable out of your computer, and pulling the network cable out. By far, just yanking on the power cable could cause more damage than yanking the network cable, as a lot of OTHER things could be waiting to write to the HDD. Yanking the network cable just drops communications, but, the software is still running in the background and will still be shut down properly. This just feels different. I also wonder what happens with time, as one of the DBs needs somewhat accurate time.
Very tough call, but if nothing else works, this just may be the way to do it. :/
-
fixedwheel
- Volunteer
- Posts: 1699
- Joined: 13. Sep 2008, 02:18
and in real life, if your network is disturbed then your application produces data loss?Pontiac wrote:I'm hesitant to use this for the simple reason is that the system is more abruptly thrown into suspended mode, so if there is a particular network transaction going on, and the VM is put into this state, data loss could occur as not many applications know how to deal with this kind of disconnect. I also saw that the network was dropped, then re-established once I restarted the VM. This could cause unforseen problems.
-
Sasquatch
- Volunteer
- Posts: 17798
- Joined: 17. Mar 2008, 13:41
- Primary OS: Debian other
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, Windows 7, Linux
- Location: /dev/random
You can use tasklist to filter the VB service and if it's still running, let the batch sleep for a few seconds and check again. Once the process is no longer found, you can shutdown the Host.The first part is where I get stuck, so to speak. With my initial tests, once the command is sent to the VM, I'm returned to the command prompt, but the OS still lives (Although it is being powered down). Is there something I can use that will cause the batch file to wait until the OS is down and "turned off"?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org
Retired from this Forum since OSSO introduction.