VMware GSX
Using LVM as raw disks
If you want to use logical volumes as raw disks, you get stuck with VMware. Only /dev/sd* and /dev/hd* is supported. But there is a workaround for this problem. Some really tough guys in the VMware-forum have written a wrapper library to support other devices as well. You can find the original homepage here.
This little tutorial shows, how to support LVM with VMware GSX Server. Same applies to VMware Server too.
- get vmware-bdwrapper and compile as stated in the README
- mv /usr/sbin/vmware-serverd /usr/sbin/vmware-serverd.bin
- mv /usr/lib/vmware/bin/vmware-vmx /usr/lib/vmware/bin/vmware-vmx.bin
- mv /usr/lib/vmware/bin-debug/vmware-vmx /usr/lib/vmware/bin-debug/vmware-vmx.bin
- now write a script to /usr/sbin/vmware-serverd
#!/bin/sh
VMWARE_BDWRAPPER_DEVICES=/dev/sd0/test
VMWARE_BDWRAPPER_LOG_LEVEL=-1
LD_PRELOAD=libvmware-bdwrapper.so.0
export LD_PRELOAD VMWARE_BDWRAPPER_DEVICES VMWARE_BDWRAPPER_LOG_LEVEL
exec "$0.bin" "$@" - hardlink this script to the vmware-vmx locations
ln /usr/sbin/vmware-serverd /usr/lib/vmware/bin/vmware-vmx
ln /usr/sbin/vmware-serverd /usr/lib/vmware/bin-debug/vmware-vmx
Wildcards with vmware-bdwrapper
The library vmware-bdwrapper doesn't support wildcards in version 20060304-0. A little tweak helps, here is the patch:--- vmware-bdwrapper-20060304-0/vmware-bdwrapper.c 2006-03-04 00:06:36.000000000 +0100
+++ vmware-bdwrapper-20060304-0.smay/vmware-bdwrapper.c 2006-05-25 12:42:28.102319351 +0200
@@ -218,8 +218,15 @@
int i;
for (i = 0; i < devices_to_be_tweaked__size(); i++) {
- if (strcmp(device_file_name, devices_to_be_tweaked__data_[i]) == 0)
- return i;
+ int length = strlen(devices_to_be_tweaked__data_[i]);
+ if (devices_to_be_tweaked__data_[i][length-1] == '*') {
+ if (strncmp(device_file_name, devices_to_be_tweaked__data_[i], length - 1) == 0)
+ return i;
+ }
+ else {
+ if (strcmp(device_file_name, devices_to_be_tweaked__data_[i]) == 0)
+ return i;
+ }
}
return -1;
Just apply the patch and compile as described in README. After that you can specify device-names with a star * as postfix.