How to dynamically attach a disk to running DomU in Xen?
To attach phy:vg_xen/vm-228-large to vm-228 as xvdb, run this on Dom0:
# xl block-attach vm-228 phy:vg_xen/vm-228-large xvdb w
With the old
xm tool stack, replace
In the VM vm-228, a new device
/dev/xvdb should appear.
The general format for
block-attach is as follows.
xl [-v] block-attach <Domain> <BackDev> <FrontDev> [<Mode>] [BackDomain]
Using this method, you can also mounting a USB drive to a DomU by attaching the whole USB drive (e.g.
/dev/sde, not the partition
/dev/sde1) to a VM as a disk like
# xl block-attach vm-228 /dev/sde xvde w
Detach a disk:
# xl block-detach vm-228 xvde