Ran into another issue with VMWare. I wanted to have the main partition be a normal VMWare image – but be able to mount an LVM partition inside the VM – for better performance and to make it easier to access from different environments. It turns out that VMWare server doesn’t support his sort of thing.
Fortunately, someone else has a fix:
vmgbd: VMware generic block device patch
You have to jump through some hoops to make this work under Ubuntu – but I’ve sorted that out for you:
Make sure you have a complier and such on the machine
apt-get install build-essential
Download the current version
Expand and make
tar -jxvf vmgbd-0.04.tar.bz2
The program is supposed to figure out what needs to be patched for you. This doesn’t seem to work for Ubuntu – but no worries – I’ve got the list.
Make sure this is all one line. This statement makes sure you get a tarball backup of all the files you are patching
sudo tar cvf backup_originals.tar
/usr/bin/vmware-loop /usr/bin/vmware-vdiskmanager /usr/bin/vmrun /usr/lib/vmware-server/bin/vmrun /usr/bin/vmware /usr/lib/vmware-server/bin/vmware /usr/lib/vmware-server/bin/vmware-vmx /usr/lib/vmware-server/lib/snhelper
Now shutdown VMWare (if you don’t you won’t be able to patch one of the files)
sudo /etc/init.d/vmware-server stop
Now apply the patch – again make sure this is all on one line
sudo ./vmgbd /usr/bin/vmware-loop /usr/bin/vmware-vdiskmanager /usr/bin/vmrun /usr/lib/vmware-server/bin/vmrun /usr/bin/vmware /usr/lib/vmware-server/bin/vmware /usr/lib/vmware-server/bin/vmware-vmx /usr/lib/vmware-server/lib/snhelper
It should say 6 files patched – restart VMWare.
Now if you are doing LVM (like me) you are probably going to run into a permission issue. I’m actually using the VMWare Server Admin panel on another machine to control the one I just patched (I haven’t verified that you need to patch both sides of the connection – I just patched them both for completeness).
LVM seems to default partitions to being only rw to root and the group disk. The /dev/lvm is set to read only for root. I added myself to the disk group and changed the permissions on lvm to 750 and set the group to disk. This allowed me to add LVM partitions to the vm.
Keep in mind – that you can now add any kind of block device you want – even loop backs and such. The only thing you must remember is that you have to add things as entire disks and not partitions – which if you are using LVM is very straight forward.