Thursday, February 10, 2011

Cloning a VM that uses LVM using libvirt utilities

Get specs for your existing VM storage and create an LV for the new VM

# lvdisplay /dev/sdbvg/eng3.example.net_root
--- Logical volume ---
LV Name /dev/sdbvg/eng3.example.net_root
VG Name sdbvg
LV UUID 9APovE-4ad5-QYe9-UB3U-ndP2-lW3p-IcZWt1
LV Write Access read/write
LV Status available
# open 1
LV Size 40.00 GB
Current LE 10240
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:46

[root@vm01 ~]# lvcreate -L 40G -n template.example.net_swap /dev/sdbvg
Logical volume "template.example.net_swap" created

Do the same thing for swap or any other partitions you may have.
Then call virt-clone
virt-clone --prompt --original eng3.example.net --name template.example.net --file /dev/sdbvg/template.example.net_root --file/dev/sdbvg/template.example.net_swap
Cloning /dev/sdbvg/eng3..example.net_root | 40 GB 05:55
Cloning /dev/sdbvg/eng3.example.nett_swap | 4.0 GB 00:34



No comments:

Post a Comment