What I want to be able to do is to pause a Virtualbox vm, back it up and then restart it. I want to create a cron script to do this.
I believe that these are the commands I need, but I don't know how to back up (the middle bit):
VBoxManage controlvm "Windows Server" savestate while [ `VBoxManage list runningvms | grep "Windows Server" | wc -l` = "1" ] do sleep 2 done #here is the bit I don't know to do... #I need to somehow create a backup of the vm here... I'm sure its not #that difficult, but I don't know where to start or whether what I #would come up with would be the best way #restart using start-stop-daemon... dunno why! This is in my init.d script #and was the only way it worked (as far as I could work it! haha) start-stop-daemon --background --chuid user --make-pidfile --pidfile "$PIDFILE" --start --exec /usr/bin/VBoxHeadless -- --startvm "Windows Server"
If anyone could give me a few lines of code which will backup my vm to a specific place that would be good. I've fallen at the first hurdle tbh, I'm then going to try and tar the backup and rsync it to my NAS. We shall see how easy that bit is after this! :p haha
Thanks for your help guys.