Thursday 30 August 2007

vmware server

The ability of VMware Server to run virtual machines
"behind-the-scenes" is a great boon. This means you no longer have to
have the GUI screen open on your desktop, taking up valuable screen
real-estate. It also means that you can switch your virtual machines to another
machine that is constantly up and have your virtual machines available to you
at any time, keeping them up and running around the clock. Running the server
without a GUI interface makes it more difficult to control the machines, but
with a little effort, you can get the same functionality via the command line. You
will still want the GUI in order to change configuration options and create new
machines, however.



The vmware-cmd
program is your gateway to controlling virtual machines. The general syntax of the
vmware-cmd for use with a VMware
Server instance on the same machine is:



$ vmware-cmd [config] [option] ...


Assume you have a virtual machine of Mandriva in /var/lib/vmware/Virtual Machines/Mandriva.
To get the status of the machine—whether it's on or off—you would use:



$ vmware-cmd /var/lib/vmware/Virtual\ Machines/Mandriva/Mandriva.vmx getstate
VMControl: use vnc for unifiedDraw
getstate() = off


As you can see, the virtual machine is turned off. To start
this virtual machine you would use:



$ vmware-cmd /var/lib/vmware/Virtual\ Machines/Mandriva/Mandriva.vmx start
VMControl: use vnc for unifiedDraw
start() = 1


If you have the vmware-console running at the same time, you
would see the virtual machine start. This is an easy way to start virtual
machines at boot: simply call vmware-cmd
with the configuration of each virtual machine that you want to start and the start command in a script like /etc/rc.d/rc.local.



Prior to shutting down your machine, you can signal the
virtual machines in a similar manner by using the suspend command. This will suspend each virtual machine to disk,
allowing you to issue the start
command later to resume the machine from where you left off. Obviously,
suspending a machine will make starting it up much faster than doing a full
shutdown and start each time you have to restart the host system.



Looking at the output of vmware-cmd
-h
will give you a lot of other options that you can play with to
manipulate virtual machines. The ability to start, suspend, and stop virtual
machines from the command line (or a script) is perhaps vmware-cmd's most useful feature.



Delivered each Tuesday, TechRepublic's free Linux NetNote
provides tips, articles, and other resources to help you hone your
Linux skills.


Powered by ScribeFire.

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter