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

Arno Gaboury arnaud.gaboury at gmail.com
Thu Apr 26 08:36:31 UTC 2012


Le 26. 04. 12 10:02, Richard W.M. Jones a écrit :
> 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.
>
Rich,

sorry to coma back again, but I take the opportunity to deep my knowledges.

Why don't you specify --network? Not needed ?
Is graohics spice best than vnc?
I do not want to use btrfs but ext4, but my host (Archlinux) use btfrs. 
Is this the reason I shall add #options="-x btrfs" ? Or shall I remove?
What about sparse=false ? Not needed? Obsolete, or not a good solution?

TY again for sharing




More information about the virt-tools-list mailing list