Virtualization With KVM On A Debian Lenny Server - Page 3
7 Creating An LVM-Based GuestDebian Lenny KVM Host: LVM-based guests have some advantages over image-based guests. They are not as heavy on hard disk IO, and they are easier to back up (using LVM snapshots). To use LVM-based guests, you need a volume group that has some free space that is not allocated to any logical volume. In this example, I use the volume group /dev/vg0 with a size of approx. 465GB... vgdisplay server1:~# vgdisplay ... that contains the logical volume /dev/vg0/root with a size of approx. 232GB and the logical volume /dev/vg0/swap_1 (about 1GB) - the rest is not allocated and can be used for KVM guests: lvdisplay server1:~# lvdisplay I will now create the virtual machine vm11 as an LVM-based guest. I want vm11 to have 20GB of disk space, so I create the logical volume /dev/vg0/vm11 with a size of 20GB: lvcreate -L20G -n vm11 vg0 Afterwards, we use the virt-install command again to create the guest: virt-install --connect qemu:///system -n vm11 -r 512 --vcpus=2 --disk path=/dev/vg0/vm11 -c ~/debian-500-amd64-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debianLenny --accelerate --network=bridge:br0 --hvm Please note that instead of -f ~/vm11.qcow2 I use --disk path=/dev/vg0/vm11, and I don't need the -s switch to define the disk space anymore because the disk space is defined by the size of the logical volume vm11 (20GB). Now follow chapter 5 to install that guest.
8 Converting Image-Based Guests To LVM-Based GuestsDebian Lenny KVM Host: No let's assume we want to convert our image-based guest vm10 into an LVM-based guest. This is how we do it: First make sure the guest is stopped: virsh --connect qemu:///system shutdown vm10 quit Then create a logical volume (e.g. /dev/vg0/vm10) that has the same size as the image file - the image has 12GB, so the logical volume must have 12GB of size as well: lvcreate -L12G -n vm10 vg0 Now you can convert the image: qemu-img convert ~/vm10.qcow2 -O raw /dev/vg0/vm10 Afterwards you can delete the disk image: rm -f ~/vm10.qcow2 Now we must open the guest's xml configuration file /etc/libvirt/qemu/vm10.xml... vi /etc/libvirt/qemu/vm10.xml ... and change the following section...
... so that it looks as follows:
Afterwards we must redefine the guest: virsh --connect qemu:///system define /etc/libvirt/qemu/vm10.xml Still on the virsh shell, we can start the guest... start vm10 ... and leave the virsh shell: quit
9 Links
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning




print: 

Recent comments
5 hours 26 min ago
7 hours 27 min ago
10 hours 38 min ago
12 hours 57 min ago
14 hours 7 min ago
15 hours 25 min ago
19 hours 29 min ago
23 hours 3 min ago
23 hours 15 min ago
1 day 14 hours ago