VMware


Installation

This is a quick list of the steps.

  1. install kernel-devel
  2. install xinetd
  3. get VMware-server-xxxx.rpm
  4. get VMware-server-linux-client-xxxx.zip
  5. install VMware-server-xxxx.rpm
  6. run 'vmware-config.pl'
  7. unzip VMware-server-linux-client-xxxx.zip
    1. install VMware-server-linux-client-xxxx.rpm
  8. run 'vmware-config-server-console.pl'

That's it.

You may notice that I didn't install the 'mui', which I don't use.


Never use entire system disk in vm

I figured I could get a linux VM to use specific LVM volumes off the host system disk, but it's just not stable. Also, totally kills any security advantage.A cracked VM could then mount volumes from the system disk to alter files on the host OS and any other VMs.


VMware and LVM

It is not possible to mount an LVM volume from the fedora installer (for the installtion media source). This is actually a fedora issue and not at all specific to VMware, but I was trying to install a VM and I was dissapointed to find out I had to serve the files on a server and I couldn't just mount the LV.

You might be able to mount LVMs on the system disk from within a VM, but that requires you to make the system disk accessable to the VM, which is a bad idea (see Gotchas above).


Mounting a VM's disk on the Host

You can mount a VMware disk in the linux host OS. It's a little wierd, but it works. Here's how:

  1. Make sure the VG in your VM is not the same as any VGs you have anywhere on your host box.
  2. Stop the VM
  3. load the nbd (Network Block Device) module into the running kernel
  4. Make sure you have /dev/nb* (use "MAKEDEV nb" if you don't)
  5. run "vmware-loop -p filename.vmdk" and note which partition you have your LVM on
  6. run "vmware-loop filename.vmdk partition-number /dev/nb*" to attach the file to the network block device
  7. run "lvmdiskscan" to make it re-scan the disks
  8. run lvscan to see the nice list
  9. run 'lvchange -ay volgroup' where volgroup is the volume group on your VM
  10. run lvscan to see the nice list, this time with your VM's LVs listed as ACTIVE
  11. Mount and play with LVs

See Also: http://www.vmware.com/support/reference/linux/loopback_linux.html


Multiple Bridged Interfaces

If you have multiple ethernet adapters on the host and you want your guest to be able to use them in bridged mode, you have to make them both bridged in vmware-config.pl, which is pretty straight forward. The bit that fooled me, is that you have to pay attention to the virtual network (vmnet2, for instance) the second bridge is attached to. When it comes time to add the 2nd adapter to the guest, things are a little trickier. The "Bridged" selection refers only to the first adapter. To use the second adapter, you need to connect the guest's virtual adapter to the correct bridge's virtual network (vmnet2, for instance again). To do that, you choose "Custom", and then the correct vmnet.


Running out of Space

I just had what I think might be the ultimate running-out-of-space scenario, in that it includes just about every possible variation of running out of space.Follow this and it probably includes your problem as a sub-problem.

Just to be clear, this is for Linux boxes with LVM on both the host and the guest. The LVM is the 2nd and last partition on the real host disk and the virtual guest disk. None of this will work otherwise.

I ran out of space on both my virtual disk and also on the volume on the host os that contained it.

Getting more space on host volume

Since I'm using LVM this isn't too hard, just use lvresize and ext3online.

Making the virtual disk bigger

This was really wierd. First, the tool is "vmware-vdiskmanager". If your disks are of the growable type, you can expand them even further. If not, in theory you can convert them to the growable type and back again, but I digress.. Anyway the command to grow a vdisk is "vmware-vdiskmanager -x XXGb filename.vmdk".

The wierd part was, even though I had lots of space on my hosts volume, the command refused to let me enlarge the image. Finally, I expanded the host volume even further and suddenly, it let me enlarge away. I really don't know what that was all about.

An Alternative Approach

I recently had a situation where I couldn't get the vdisk to grow, no matter what I did. However, it was easy to create another vdisk and add it to the LVM volume group on the guest, effectively acheiving the same thing with less elegance.

Expanding Partition on VM

You have to start the VM now and log on as root.

OK, so now the raw virtual disk is bigger, the next thing you need to do is expand the partition. Since I'm using LVM and my LVM is on the 2nd and last partition, I can just delete the 2nd partion and recreate it larger. This won't affect the data, just the partition table. Since the partition starts in the same place, the data really won't mind.

After that, reboot the VM to make the new partition table take affect.

Expanding LVM on the VM

Ok, so now the partition is larger, but LVM doesn't know about it. I ran 'pvresize /dev/sda2' to tell it.

Expanding the volume on the VM

Now, when I run 'vgdisplay' I see a whole bunch of new available space. I can use lvresize to add that extra space where needed and ext2online to grow the filesystem.


Upgrading Host Kernel

If it doesn't work


Learn to Love vmware-cmd

http://www.vmware.com/support/esx21/doc/vmware-cmd.html

Seriously. You can start/stop and a few other things with vmware-cmd. I rarely go through the trouble of starting up vmware-server-console any more. My favorites so far are:

Well, ok, that's not much, but it's a hell of a lot easier than making all those ssh connections with the -X switch and then running vmware-server-console.


Non-root user

If individual vms belong to a non-root user, /dev/vm* must be rw that user. As this seems to get re-fuxored at boot, this seems to be causing problems on marlinspike.


or, as root

This is usally tricky only when running X over SSH. Just log in and copy .Xauthority from the user-you-logged-in-as's home to /root/. Next, look for /root/.xauth??????? and copy .Xauthority over that.

It's better though, to use vmware's console over an ssh tunnel or suchlike.


Vmware Console over SSH

  1. Make sure that vmware is listening on localhost port 902.
  2. ssh to the host forwarding ports
  3. open vmware console on local box
  4. connect to localhost:portnum
  5. you may need root password for the vmware host


VMWare tools

These are helper modules that run on the VMs. This lets you do nice things like shutdown the VM's OS cleanly from the host. Must be updated at each kernel upgrade. Very similer to the kernel stuff above. Copy-n-paste does not seem to work with console mouse.

Warning! this will kill networking on the VM until you reboot (as far as I can tell.)

See Also: http://www.vmware.com/pdf/server_vm_manual.pdf

  1. log on to the VM from the vmware console Not over ssh.

  2. make sure the kernel-devel rpm is installed
  3. click the 'install vmware-tools' thingy inside the vmware-server-console
  4. mount /dev/cdrom somewhere
  5. install the .rpm file
  6. run vmware-config-tools.pl -c -d

  7. reboot to restore functioning networking

Compiling Before Reboot

The source code for the kernel modules is located in: /usr/lib/vmware/modules/source/vmmon.tar /usr/lib/vmware/modules/source/vmnet.tar


CategoryNotes

VMware (last edited 2008-06-11 19:59:54 by dmartin)