snapshots of a win10 vm while it's hibernated

wonderbread2

Cadet
Joined
Aug 24, 2019
Messages
5
Is this a bad idea?

I have a windows vm that I want to backup regularly and fr searching the internet it looks like most people are setting up scripts to shutdown, wait and confirm , then snapshot and start their vms


I am very bad with scripts and have little experience but I will start copy pasting stuff if I need to but before I did I thought it might be viable to just have the vm sleep or hibernate before the snapshot then wake it


Will this ruin my day?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702
Taking a snapshot on a disk is like ripping out the power cord on the disks at that moment... the OS will know nothing about it and the state the disks are in at that moment is either a problem or not. Avoiding the cases where it will be a problem is therefore interesting and you have things like asking the operating system and/or applications to quiesce which can prepare things better right before a snapshot to make the snapshot more reliably good. (the feature for VMware snapshots is intended to do this, for example)

If the machine is hibernating (in the state called hibernated... not in the middle of the process of going from normal operation into hibernated), it's not going to be in the middle of writing anything to disk, so the snapshot will reliably produce a result that's the same as the machine expects.
 

wonderbread2

Cadet
Joined
Aug 24, 2019
Messages
5
Thank you for the advise, I tried setting it up like I had thought but problem: Windows 10 cannot hibernate or even sleep inside bhyve VM (option isn't enabled and when I try to enable it with powercfg -h on it says the firmware doesn't support hibernate).

bummer

Sooooo, I need a way to safety suspend or power down the VM and then bring it back up. Powering down is the easy part, having windows turn itself off every night at midnight works fine, snapshots can then be run.


However getting it back on is proving to be harder.
after doing some research and checking my middleware.log file I thought I had the answer in the form of this command that I snaked by checking the log after starting the VMfrom the GUI:
Code:
bhyve -A -H -w -c 4 -m 6000 -s 0:0,hostbridge -s 31,lpc -l com1,/dev/nmdm1A -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -s 29,fbuf,vncserver,tcp=192.168.1.185:6360,w=1024,h=768,password=3365125, -s 30,xhci,tablet -s 4,e1000,tap1,mac=00:a0:98:6b:b9:57 -s 3:0,ahci,cd:/Windows.iso,hd:/dev/zvol/Everything/Win10ReservationHost-cxijaw 1_Win10ReservationHost


however when I run this in putty connected to ssh (or directly as a script with sh ./startvm.sh in shell) it kinda works and starts giving me messages about how it's assigning vCPUs, but the GUI on the web interface shows that it's not running, and I can't connect to the VNC to manage it.


Something is not working right here, any ideas on how I can start the VM from shell so it the GUI recognizes that it's running and I can connect via vnc?
 
Top