Xen find VBD id for physical disks

hard drivehotswapvirtualizationxen

I'm starting a xen domU using xm create config.cfg. Within the config file are a number of physical block devices (LVs) which are added to the guest and can be accessed fine when it boots. However, at a point in the future I need to be able to hot unplug one of these disks using the xm block-detach command. This command, however, requires the vbd id of the device to be detached and I can't find a way to find the device id for a particular disk 'plugged in' at start up. Any help is much appreciated!

Best Answer

I'm not aware of any "good" way to correlate the output of xm block-list <dom> to the physical devices in dom0. Possibly the best you can do is parse the DevController entries from xend.log, which detail the VBD's frontend and backend names at the point of creation. It's certainly not foolproof though and should be used with caution.