[virt-tools-list] Install KVM Virtual machine with virt-install on a LVM partition
Arno Gaboury
arnaud.gaboury at gmail.com
Thu Apr 26 09:08:45 UTC 2012
Le 26. 04. 12 10:40, Richard W.M. Jones a écrit :
> On Thu, Apr 26, 2012 at 10:36:31AM +0200, Arno Gaboury wrote:
>> Why don't you specify --network? Not needed ?
>
> It depends. No --network gives you the defaults.
> You could also specify: --network bridge=br0
>
>> Is graohics spice best than vnc?
>
> Usually yes.
>
>> 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?
>
> It's commented out in the script. Only Fedora would use this option.
>
>> What about sparse=false ? Not needed? Obsolete, or not a good solution?
>
> I thought you were using an LV as storage? There's no choice for LVs
> (except with extremely recent versions of LVM that you're unlikely to
> be using).
>
> Rich.
>
Here we go :
#!/bin/bash
#created Thursday April 26
#following Richard W.M.Jones <rjones at redhat.com> advices and script
#this script can be changed according your own need. This one will
#install a debian VM called daffodil on a LVM partition, with 2 CPU,
8192 RAM
# Script used to install VMs.
# You have to lvcreate the disk first!
# lvcreate -L sizeG -n $name vg_data
set -e
name=daffodil
cpus="--cpu=host --vcpus=2"
disk="--disk path=/dev/vg0/lv_daffodil"
location="--cdrom
/var/lib/libvirt/images/isofiles/debian-6.0.4-amd64-netinst.iso
type="--os-type=linux"
variant="--os-variant=debiansqueeze"
graphics="--graphics spice"
extra="bus=virtio"
network="--network bridge=br0"
virt-install -n $name -r 8192 \
$cpus $type $variant $disk $location $graphics $extra $network
Hope everything is correctly set up and it can help other users. I
realised KVM is not so straightforward and could be very different
depending on your source.
More information about the virt-tools-list
mailing list