Testing a new boot configuration
This approach is useful for testing all sorts of changes in boot setup without actually risking a real reboot. Whether you're about to remove a hard disk, just want to test RAID with disk failures, have installed a new boot loader or just changed the configuration; this can help provide reassurance that your remote server will come back when you actually restart the physical machine.
The process uses qemu, its disk snapshot feature and VNC console along with SSH port forwarding.
First ensure you have a VNC client on your local machine (I'll assume a Ubuntu Linux desktop here and assume you already have SSH installed):
desktop$ apt-get install xtightvncviewer # other VNC clients also work
Connect to your remote server and forward the vnc port you'll be using (this example uses VNC ":1", ie the second VNC port):
desktop$ ssh <your server> -L 5901:localhost:5901
Now on the remote server, install the qemu software needed:
server$ apt-get install qemu
Then boot up your machine inside itself using qemu (this example boots with just the second hard disk from the actual machine, in this case to check that it works without the normal boot drive):
server$ sudo qemu -hdb /dev/sdb -snapshot -boot c -vnc :1
Thanks to the qemu -snapshot
option nothing that happens inside the qemu virtual machine will be written out to the real disks and your physical machine will be completely unaffected.
Now from another terminal on your desktop, connect your VNC client to watch the results (connecting to VNC ":1" on localhost, which we earlier forwarded to the remote server):
desktop$ vncviewer :1
Watch you machine boot and check everything is happy. Then close the VNC viewer and Ctrl-C the qemu process you started in the server SSH session.