Xen DomU Gentoo Linux Cloning

From JMK Wiki
Jump to: navigation, search

stop irma

xl shutdown source

create lvs

lvcreate -L2G -ndomu-swap /dev/xendomains
lvcreate -L8G -ndomu-root /dev/xendomains

create filesystems

mkswap -Ldomu-swap /dev/xendomains/domu-swap
mkfs.ext4 -Ldomu-root /dev/xendomains/domu-root

add mountpoint to /etc/fstab

/dev/xendomains/domu-root       /mnt/domu-root          ext4            defaults,noatime,noauto

mount partitions and copy the data

mkdir -p /mnt/source-root /mnt/domu-root
mount /dev/xendomains/source-root
mount /dev/xendomains/domu-root
cd /mnt
cp -a /mnt/source-root/* /mnt/domu-root/

update configuration on the target filesystem

nano -w /mnt/domu-root/etc/conf.d/hostname
nano -w /mnt/domu-root/etc/conf.d/net
nano -w /mnt/domu-root/etc/udev/rules.d/70-persistent-net.rules

unomunt partitions

umount /dev/xendomains/source-root
umount /dev/xendomains/domu-root

copy and update domu configuration

cp source domu
nano -w domu

start the instances

xl create source
xl create domu