Xen attach disk live
- xm,
- resize,
- open-future,
- live,
- block-attach,
- linux
I had to resize a lvm-volume with swap on a xen domU without bringing it down. I'm just making a small how-to so I don't forget it in the future.
On the host create a swapfile big enough to get the currently used swap in it.
dd if=/dev/zero of=swapfile bs=1k count=1500000
mkswap swapfile
swapon swapfile
swapoff /dev/xvdb1
On the Dom0 Xen-server:
xm block-detach server01 /dev/xvdb1
lvresize /dev/vg0/server01_swap -L 2G
mkswap /dev/vg0/server01_swap
xm block-attach server01 phy:/dev/vg0/server01_swap /dev/xvdb1 w