Virtual Computing Tips

 

by
Shannon Dealy, dealy@deatech.com
DeaTech Research Inc. (www.deatech.com)



Originally these techniques were devised for use with VMWare, but many of them really apply to many virtual computing environments.  Some tips have been removed since the original version because they were VMWare specific and no longer apply to the current version of VMWare.

Configuration

  • Edit configuration files to remove all directory information from path names and place all files related to the virtual machine in a single directory - this makes the Virtual Machine (VM) independent of directory location, and therefore more portable, just change to the directory before executing VMWare for the directory's VM
  • Rename vmware configuration files for each VM to a common name such as "vmware.cfg" to make it easier to write shell scripts that handle all of your virtual machines.

Execution Environment

  • Set variable "TMPDIR" in order to change temporary file directory (defaults to "/tmp").  Important if your "/tmp" directory is on a small or nearly full file system.  Example: export TMPDIR=/home/vmware/tmp
  • Use "esd" (enlightened sound daemon) to share audio output between host and virtual computers.  Start esd running on host system, then execute vmware using esddsp.  This allows multiple virtual computers to share the sound card.

Display

  • Headless operation can be setup using VNC, a free software package allowing remote access to a variety of computer operating systems.  The VNC software includes a virtual Xserver that does not make use of a video display adapter.  To access the display, you can use any of their VNC clients which are available for Mac, Linux, Windows, Java (i.e. your web browser!).
  • I don't know if overall performance is faster for VMWare, but for at least some of my Linux VM's I get a more responsive X display by configuring XDM in the VM to provide "remote" X display access, and then run X "remotely" from the host computer.  Though I have not yet tried to measure performance, this appears to be faster even then full screen mode.  Note: if the host computer does not have access to all of the fonts on the VM, your display may look a little different for some applications.  This should definitely be faster when running Linux/UNIX in a virtual computer inside of non-VMWare virtual computer products.
  • If you need console mode access for running interactive scripts from the host computer, or don't need/want a virtual display for the VM, you can configure Linux based VM's to support a serial console and tie it into a virtual serial port on the host computer.  Linux provides a series of virtual serial connections with the names of the form: "/dev/pty[p|q|r|s][0-9a-f]" for each "/dev/ptyXX" device name, there is a "/dev/ttyXX" which provides the other end of the serial link.  To make use of these "serial" ports with VMWare, you configure your VM serial port to be of type "TTY" and specify the path for an unused "/dev/ptyXX" device, then when you wish to communicate with the machine using the serial console you connect to the corresponding "/dev/ttyXX" device.  For example, you might configure a VM to use "/dev/ptyr7" as it's serial port, in order talk to this machine you could use your favorite modem program and tell it to connect to "/dev/ttyr7".  Alternatively if you wish to run a script from the host computer which talks to the VM, you could use "chat", "expect", or some other program to communicate using this virtual serial port.

Disks

  • Information and startup scripts can be passed to virtual machines by statically or dynamically creating virtual floppy disks which are used as the default floppy drive when the virtual machine boots.  When doing this you may want to reconfigure the virtual machine BIOS to boot first from something other than the floppy, and then add a script to the VM's hard disk which processes the information passed on the floppy.  To create the virtual floppy, create an empty file the size of a real floppy disk using the "dd" command, use "mke2fs" or other appropriate filesystem creation program to create a file system on the empty file, then using the "loop" option to the mount command you can mount this virtual file system on a local directory, copy files to it and unmount it when you are done.  To use this disk in your VM, the VM configuration file must have it's floppy disk configured to be of type "file" and the name you give the file must match the name for the floppy filename specified in the configuration file.
  • If you use multiple virtual machines which need a common, unchanging core configuration, you can install all common data on a single virtual hard drive, then configure all virtual machines which need the data to reference the virtual hard drive as read-only/non-persistent.  Even if the virtual computer environment doesn't support this, it may be possible to safely do this by configuring all of the guest operating systems to treat the disk as read only, such as setting the "ro" option for this drive in the /etc/fstab file in Linux guest operating systems.

Networking

Some virtual computer environments provide what amounts to virtual network "hubs", allowing you to create one or more independent private networks that can only be shared by other virtual machines configured to use the same hub.  These have some valuable uses including:

  • Creating a secure well partitioned firewall network complete with DMZ, all hosted on a single computer.
  • Experimenting with and modeling computing clusters.

Performance

  • System Overload -- some client operating systems such as Windows 95, DOS, etc. never sleep/stop, their idle state consumes all available cpu, so it may be desirable to use "nice" or "renice" on these virtual machines to lower their priority (though I think VMWare may already do something to handle this problem, it certainly applies to other virtual computer products).