Page 1 of 2
Command syntax to create a snapshot
Posted: 7. Oct 2015, 22:52
by kaplan71
Hello --
I have installed the 5.0.6 release on one of our Windows 2012 servers. A virtual machine that was originally running under Vmware server 2.0.2 has been successfully imported, and it is now running on the system.
I want to create a snapshot using the VBoxManage command, and subsequently set up a scheduled task to run the command once a week.
What would be the correct syntax to use to create the snapshot, and also specify the destination drive and folder for the newly created file?
Thanks.
Re: Command syntax to create a snapshot
Posted: 7. Oct 2015, 22:57
by Martin
What do you want to create the snapshot for?
A snapshot "freezes" the main disk file and then all new writes get redirected to the snapshot file.
Why do you want to write this collection of changed blocks of the disk file to a seperate directory, when they aren't useful at all without the main disk file?
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 14:10
by scottgus1
Snapshots go in the same folder as the rest of the guest files. I don't think there is a way to get them to go to a different folder. The command line for snapshots is:
Code: Select all
VBoxManage snapshot {uuid or "vmname"} [i]command[/i]
command is one or other different things you can do. Type "Vboxmanage snapshot" at a command window to see the commands allowed. See section 8.16 in the manual for more info. (On Windows hosts, the command window needs to be in the folder where Virtualbox is installed and Vboxmanage.exe exists to run Vboxmanage, or call out the entire disk & path to vboxmxnage.exe, or put the path to Vboxmanage.exe on your system's PATH environment variable.)
A snapshot is not a backup. See section 1.10 in the manual. As Martin said, it is a point-in-time marker that stops writing your new and changed data to the original disk file and starts writing to a new disk file. As your weekly snapshot script runs, you'll get a new disk to write to every week, but Virtualbox will have to go through all of the existing disks to find the data your OS boots from and uses.
Look through the forum for a while and you'll see a lot of posts where some user did something seemingly normal with what they thought a snapshot was and their guest is dead. Snapshots make a guest delicate, and your script will every week add another layer of delicate-ness.
If you were planning to use snapshots as a backup, a real backup is either done using in-the-guest software while the guest is running, or shutting down the guest and using this tutorial "Moving a VM"
viewtopic.php?f=35&t=55003 and re-interpreting it as "Backing Up a VM".
A suggestion, if you really wanted to use snapshots they way Virtualbox uses them: Only use them for experimental purposes, on data and guests you would not mind losing. Snapshotted guests can be backed up using the same tutorial as above, and don't do anything with the files Virtualbox makes for the guest.
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 15:19
by kaplan71
Hello --
Thank-you for your replies. As to inquiries concerning the desire to have snapshots, I can provide the following explanation: Our server room suffered a catastrophic loss to our equipment due to burst pipe. One of the servers lost hosted a mission critical virtual machine. A new server was built at an alternate location with the intended purpose of acting as a host system for the virtual machine. The virtual machine snapshot was restored from tape backup, and was thus available for general use by the department. This snapshot had been generated using the Vmware Server tools.
Our backup and disaster recovery plan includes a backup of the files and directories within the virtual machine as well as a weekly snapshot of the virtual machine. This creates a two-prong method of recovery, which was shown to have been successful in light of recent events.
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 15:26
by scottgus1
OK, I see. You're using the same terminology for the VMware Server tools as Virtualbox uses for the Snapshot routine. Sounds like you're really talking about two different things.
The VMware snapshot sounds like a disk image taken while the guest is running. Virtualbox doesn't have anything specially designed to do that. To do a live hot backup while Virtualbox is running the guest, you'll need Acronis or Macrium or Ghost-style software in the guest to take the backup and transfer the data via a networked folder outside the guest.
Virtualbox snapshots are an entirely different beast and will not help you with such a "restore an image" backup.
BTW, kudos on a good backup routine and getting your server up and running again! Many folks who take backups don't figure out how to restore. Or they don't test their backups to see if they can restore. And then when they need to restore they really start crying....
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 15:38
by kaplan71
Hello --
Thank-you for alerting to the difference between Vmware and Virtualbox snapshots. As such, I don't think the VBoxManage approach is what will work here.
I did further investigating, and in addition to your suggestions, I saw that Windows Shadow Copy is another possible option.
What are your thoughts on that utility?
Thanks.
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 15:49
by scottgus1
I have not run a Windows 2012 server yet, although I'm planning to migrate our SBS2003 guest to 2012 soon.
So I can't say how well Windows Shadow Copy will do.
Best way is to google it and test it and see what happens. Note that in Virtualbox at least, the host CPU type does appear in the guest, but all other hardware is Virtualbox-generated. The hardware-generalization of using virtualization should fairly eliminate the "restoring to different metal" problem, and if a new host has a different but capable CPU, hopefully that won't cause problems in restoring successfully. I have bounced guests, even the SBS2003, to other hosts with different CPUs and had no problems running them. Have to make sure the VT-x capabilities of the new host are good. Just another test to run.
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 15:58
by loukingjr
FWIW, From VMWare's siteā¦
Using the Snapshot
The snapshot feature is most useful when you want to preserve the state of the virtual machine so you can return to the same state repeatedly.
To simply save the current state of your virtual machine, then pick up work later with the virtual machine in the same state it was when you stopped, suspend the virtual machine. For details, see Using Suspend and Resume.
You can take a snapshot of a virtual machine at any time and revert to that snapshot at any time.
You can take a snapshot while a virtual machine is powered on, powered off or suspended. A snapshot preserves the virtual machine just as it was when you took the snapshot - the state of the data on all the virtual machine's disks and whether the virtual machine was powered on, powered off or suspended.
Note: If you are using a legacy virtual machine - a virtual machine created under VMware Workstation 3 and not upgraded to use the new VMware Workstation 4 virtual hardware - you must power off the virtual machine before taking a snapshot. For information on upgrading the virtual hardware, see Upgrading VMware Workstation.
When you revert to a snapshot, you discard all changes made to the virtual machine since you took the snapshot.
Sounds very similar to the VirtualBox Snapshots.
Re: Command syntax to create a snapshot
Posted: 8. Oct 2015, 16:03
by scottgus1
Could be that OP isn't calling VMware's system by the right name, either. His usage and restore event he described sounds to me like some live disk imaging VMware may provide.
Re: Command syntax to create a snapshot
Posted: 9. Oct 2015, 09:38
by socratis
loukingjr wrote:Sounds very similar to the VirtualBox Snapshots.
Just for completion... I am not familiar with VMWare, or the way it does its snapshots. But from the description above, I didn't get any indication that they are doing differencing snapshots. They may very well be doing a "full live clone" if you will... I don't know...
Re: Command syntax to create a snapshot
Posted: 9. Oct 2015, 11:56
by Martin
VMware snapshots work the same as in Virtualbox: The primary disk file is freezed and writes are redirected to a snapshot file.
Most backup solutions for VMware are using snapshots to get access to the primary disk file, so the snapshot method is used, but the result is not "a snapshot".
Re: Command syntax to create a snapshot
Posted: 9. Oct 2015, 12:54
by socratis
Thanks for the clarification Martin...
Re: Command syntax to create a snapshot
Posted: 9. Oct 2015, 13:25
by scottgus1
Someone - I don't remember who - once suggested a "live" backup in Virtualbox by creating a snapshot while the guest is running (possibly with a guest pause just before the snapshot is taken). Doing so would stop writing to the main disk and thus allow file-copy of the main disk to occur while the snapshot receives the continued operation of the guest. After the file-copy of the main disk is complete, then the snapshot disk is merged back into the main disk while the guest is still running. Assuming the file-copy doesn't take a long time compared to data being altered in the guest at the time, the snapshot wouldn't take too long to merge back in.
Unless I'm overcomplicating things, I believe that because the guest OS is unaware that the backup is taking place, when one restores the copied disk, it would be as if the plug had been pulled on a running PC, the hard drive was removed and then imaged. The OS would appear to have crashed, data and databases may be half-written, and the running OS is tuned to the processor being used. Seems to me there could be some problems restoring.
In-the-guest software can be gotten for reasonable price or free that will do shadow copies of open files & configure the running databases properly. Those backups would be more reliable, in my opinion.
Now if Virtualbox could include in its Guest Additions a file-shadow-copy and database-configure system, then the snapshot-backup routine might be a really viable in-house solution...
Re: Command syntax to create a snapshot
Posted: 9. Oct 2015, 13:53
by loukingjr
scottgus1 wrote:Someone - I don't remember who - once suggested a "live" backup in Virtualbox by creating a snapshot while the guest is running (possibly with a guest pause just before the snapshot is taken). Doing so would stop writing to the main disk and thus allow file-copy of the main disk to occur while the snapshot receives the continued operation of the guest. After the file-copy of the main disk is complete, then the snapshot disk is merged back into the main disk while the guest is still running.
Sorry, You've lost me. The only times I've ever taken a snapshot is while a guest was running. I know you can take one while the guest is shutdown but you can certainly take one while the guest is "live".
Re: Command syntax to create a snapshot
Posted: 9. Oct 2015, 13:57
by scottgus1
Yes, the suggested live-backup method was to take the snapshot while the guest is running. If the guest is shut down, then the normal "Moving an VM" tutorial could be re-interpreted and used for backup.