This is small wrapper library for VMware. By tweaking some block-device ioctls issued by VMware, you can use arbitrary block devices such as LVM controlled, md or loop devices as a raw container of virtual disk. If you don't understand what I mean, probably you don't need it.
Read the source for limitations and detail.
** The wrapper is now compatible with CentOS 4.2 (and probably other Linux-2.6.9 based systems).
# # INSTALLATION # You need GNU libtool to compile this wrapper. $ make # make install vmware-vmx is suid'ed. For suid executables, all libs must be reside in standard lib path and preload-library must also be suid. This limitation is due to ld.so's security mechanism. Anyway, 'make install' places the wrapper in /usr/lib/ and set permissions appropriately. # # RUNNING # Specify the wrapper with LD_PRELOAD and devices with VMWARE_BDWRAPPER_DEVICES. Device names must be colon separated. For example: $ LD_PRELOAD=libvmware-bdwrapper.so.0 VMWARE_BDWRAPPER_DEVICES=/dev/hdx:/dev/sd/test vmware Note that, in LD_PRELOAD, libvmware-bdwrapper.so.0 must not contain '/', since (again) vmware-vmx is suid. # # EXAMPLE CONFIGURATION (using loop) # # chown the-user:the-group /dev/loop0 # chmod 660 /dev/loop0 # ln -s ../loop0 /dev/sd/test # dd if=/dev/zero of=/tmp/sd-test bs=1M count=128 # losetup /dev/sd/test /tmp/sd-test In vmware, now you can add a virtual disk using 'a physical disk' '/dev/sd/test'. You can not expand capacity on-line. Offline capacity expansion is possible but you must do it in correct order of operations with care. One of safe method is (probably) as following: 1. Stop the VM which is using that device. 2. If it is a loop, stop it (i.e. losetup -p /dev/sd/test). 3. Expand the capacity (i.e. dd if=/dev/zero bs=1M count=128 >>/tmp/sd-test). 4. If it is a loop, recreate it (i.e. losetup /dev/sd/test /tmp/sd-test). 5. In vmware, remove the virtual disk, and then add it again. 6. Start the VM. 7. Resize the filesystem in it (if you want). # # NOTES, BUGS & LIMITATIONS # * Device name must be '/dev/hd*' or '/dev/sd*'. This limitation is due to vmware's safety check. Symlink is one easiest solution. Note that '*' part may contain '/', which means you can use more descriptive name such as '/dev/sd/my-raid5-volume-for-data. See EXAMPLE CONFIGURATION. * This may not work with, or may break, existing vmware configurations using raw disks, external storage and so on. Since version 20051106-0, such kind of dangerousness is even low but still there. Don't specify real hd's, sd's and other unnecessary devices in your VMWARE_BDWRAPPER_DEVICES. * Almost always, geometries reported by Linux and this wrapper don't match. Normally this would not cause any problems, but it is not guaranteed. * Geometries and capacities reported by this wrapper may be different between versions. This leads filesystems may not be usable with certain version of wrapper. * This may have some limitation on volume capacity. * This is not tested well. This is still beta. # # NEWS # * User visible changes in vmware-bdwrapper-20060304-0 ** The wrapper is now compatible with CentOS 4.2 (and probably other Linux-2.6.9 based systems). * User visible changes in vmware-bdwrapper-20051109-0 ** For virtual IDE, SCSI_IOCTL_GET_IDLUN sets errno to EINVAL. That probably fixes 'The specified device is not a valid physical disk device' problem. * User visible changes in vmware-bdwrapper-20051108-1 ** SCSI_IOCTL_GET_IDLUN on virtual IDE disks no longer calls real_ioctl, returns -1 instead. * User visible changes in vmware-bdwrapper-20051108-0 ** Restrictions on device names are weakened. They can have arbitrary (>0) number of characters after /dev/hd or /dev/sd. ** New environment variable VMWARE_BDWRAPPER_LOG_LEVEL was introduced. Default value is 1. Possible values in this release are: -1: no messages at all. 0: only error messages are written on stderr. 10: some debug information are written on stderr on startup. 100: fd changes are written on stderr. 1000: captured ioctls are written on stderr. * User visible changes in vmware-bdwrapper-20051107-0 ** 'IDE disks' are supported. Specify /dev/hd? in VMWARE_BDWRAPPER_DEVICES as usual. (i.e. VMWARE_BDWRAPPER_DEVICES=/dev/hdx:/dev/hdy:/dev/hdz:/dev/sdz) * User visible changes in vmware-bdwrapper-20051106-0 ** Now you must specify which devices to be tweaked with environment variable VMWARE_BDWRAPPER_DEVICES. In previous version, all ioctl calls were wrapped and tweaked. But in this version, only ioctl calls on specified devices are tweaked. ** This wrapper can be installed on non Debian systems. Thanks to devzero roland. ** BLKGETSIZE64 related code was commented out since it doesn't seem really necessary. # # # Have fun.