Skip to content

Instantly share code, notes, and snippets.

@coldfire-x
Created April 22, 2013 03:51
Show Gist options
  • Save coldfire-x/5432339 to your computer and use it in GitHub Desktop.
Save coldfire-x/5432339 to your computer and use it in GitHub Desktop.
script for creating kvm virtual machine from a raw partition which has DDed the vm image.
#!/bin/sh
USAGE='Usage: ./create_kvm.sh kvm_name lvm hd1'
# kvm_name is the virtual machine's name
# lvm is the virtual machine's image disk path
# hd1 is the addtional disk we want to attach to this kvm
if [ "$1" = "help" ]
then
echo $USAGE
elif [ "$1" = "--help" ]
then
echo $USAGE
elif [ "$1" = "" ]
then
echo $USAGE
else
virt-install --connect qemu:///system -n $1 -r 2048 --vcpus=2 --cpuset=18,19 \
--disk path=$2 --import $2 --disk path=$3 --vnc --noautoconsole --os-type linux \
--os-variant rhel5.4 --accelerate \
--network=bridge:br0 --network=bridge:br1 --hvm --autostart
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment