[virt-tools-list] Install KVM Virtual machine with virt-install on a LVM partition

Richard W.M. Jones rjones at redhat.com
Thu Apr 26 08:02:57 UTC 2012


On Wed, Apr 25, 2012 at 12:27:36PM +0200, arnaud gaboury wrote:
> virt-install --connect qemu:///system --name=daffodil --ram 8192 --cpu host
>  --disk path=/dev/vg0/lv_daffodil,size=200,bus=virtio,sparse=false,format=raw
> --cdrom /var/lib/libvirt/images/isofiles/debian-6.0.4-amd64-netinst.iso
>  --description="daffodil (debian squeeze) - vm guest on host magnolia"
> --graphics vnc --os-type=linux --os-variant=debiansqueeze
>  --network bridge:br0 --video=vga  --hvm --accelerate
> Is the command correct and academic?

I have a "standard" script I use to automate virt-install:

----------------------------------------------------------------------
#!/bin/bash -

# Script used to install VMs.
# You have to lvcreate the disk first!
# lvcreate -L 10G -n $name vg_data

set -e

name=F16x64
cpus="--cpu=host --vcpus=4"
disk="--disk path=/dev/vg_data/$name"
#location="-l http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/fedora/linux/releases/15/Fedora/x86_64/os/"
location="--cdrom /mnt/media/installers/Fedora-16-x86_64-DVD/Fedora-16-x86_64-DVD.iso"
type="--os-type=linux"
variant="--os-variant=fedora16"
#graphics="--graphics spice"
#options="-x btrfs"
#extra=""

virt-install -n $name -r 1024 \
  $cpus $type $variant $disk $location $graphics $options $extra
----------------------------------------------------------------------

By making small adjustments to this, I can install all guests I need.

> I think size=200 is maybe not needed, as the LV has already be created. Right?
> format=raw seems weird to me and not needed. Right?

You don't need size or format since virt-install will pick that up
from the disk image itself.

> My host has 16G RAM. Shall I put 16 as --ram argument or stay with 8 ?

Depends how much you need for the *guest*.  It needs to be smaller
than the host size, but will depend on how many concurrent guests you
want to run.

> How about the filesystem? I want an ext4. Shall I create it on
> lv_daffodil BEFORE the install or will I do it under the install
> process when partitioning?

No, the guest installer deals with all that.

> Not sure about the --accelerate argument

--accelerate is not required with modern virt-install.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the virt-tools-list mailing list