Quantcast
Channel: Adam Palmer, PHP Programmer, Website Security Consultant » Linux
Viewing all articles
Browse latest Browse all 15

Move Xen Guest from loopback filesystem to LVM

$
0
0

Moving a Xen Guest into an LVM container from a loopback sparse image is easy enough.

You’ll need to power down the VM using xm shutdown mymachine

Once done, create the logical volume with: lvcreate –name mymachine-disk –size 10G myvg 10G should match the exact size (if not more) of your current VM. Now create the same for the swap file: lvcreate -name mymachine-swap -size 128M myvg. Now edit your machine’s config (/etc/xen/mymachine.cfg), replacing the disk part from:

disk        = [
'file:/xen/mymachine/mymachine-swap,sda1,w',
'file:/xen/mymachine/mymachine-disk,sda2,w',
]

to

disk        = [
'phy:/dev/myvg/mymachine-swap,sda1,w',
'phy:/dev/myvg/mymachine-disk,sda2,w',
]

And use dd to write the disk to your new LVM filesystem:

dd if=/xen/mymachine/mymachine-disk of=/dev/myvg/mymachine-disk
dd if=/xen/mymachine/mymachine-swap of=/dev/myvg/mymachine-swap

Remembering that you can use killall -SIGUSR1 dd at any time to gain a status update on dd’s IO.

Once done, power up your VM again with xm create mymachine.cfg


Viewing all articles
Browse latest Browse all 15

Trending Articles