Difference between revisions of "Main Page/IT/Virtualisation"
From Lewis Consultancy Wiki
Jump to navigationJump to search(3 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
This will be provisoned "thinly" so the file will grow as data is written into it. | This will be provisoned "thinly" so the file will grow as data is written into it. | ||
− | <pre> | + | <pre>qemu-img create -f qcow2 mydisk.qcow2 8G</pre> |
==Compress a qcow2 disk image== | ==Compress a qcow2 disk image== | ||
− | <pre> | + | <pre>qemu-img convert -c -f qcow2 -O qcow2 -o cluster_size=2M myold_disk.qcow2 mynew_disk.qcow2</pre> |
− | ==Install | + | ==Install an existing VM from the command line using virt-install== |
− | This will spin up a new VM given an existing disk image. | + | This will spin up a new VM given an existing disk image. One virtio disk and one virtio NIC on br100. |
<pre>virt-install --name <<Your machine name>> --hvm --ram 512 --disk path=<<path to your existing OS image>>,format=qcow2,bus=virtio --import --network bridge=br100,model=virtio --vnc --os-type=linux --os-variant=debianwheezy</pre> | <pre>virt-install --name <<Your machine name>> --hvm --ram 512 --disk path=<<path to your existing OS image>>,format=qcow2,bus=virtio --import --network bridge=br100,model=virtio --vnc --os-type=linux --os-variant=debianwheezy</pre> | ||
+ | |||
+ | ==Start a fresh install of VM from command line== | ||
+ | |||
+ | Creates a VM called windows8-test and starts an install of windows from an iso image. | ||
+ | |||
+ | <pre>virt-install --name windows8-test --hvm --ram 1024 --disk path=./windows8-test-disk1.qcow2,format=qcow2,bus=virtio --network bridge=br100,model=virtio --vnc --os-type=windows --cdrom /mnt/vmimages/iso/Windows\ 8\ Retail\(MSDN\)Pro\ x64\ bit.ISO</pre> |
Latest revision as of 13:44, 10 March 2014
Contents
KVM
Stuff relevant to qemu-kvm
Create a qcow2 disk image
This will be provisoned "thinly" so the file will grow as data is written into it.
qemu-img create -f qcow2 mydisk.qcow2 8G
Compress a qcow2 disk image
qemu-img convert -c -f qcow2 -O qcow2 -o cluster_size=2M myold_disk.qcow2 mynew_disk.qcow2
Install an existing VM from the command line using virt-install
This will spin up a new VM given an existing disk image. One virtio disk and one virtio NIC on br100.
virt-install --name <<Your machine name>> --hvm --ram 512 --disk path=<<path to your existing OS image>>,format=qcow2,bus=virtio --import --network bridge=br100,model=virtio --vnc --os-type=linux --os-variant=debianwheezy
Start a fresh install of VM from command line
Creates a VM called windows8-test and starts an install of windows from an iso image.
virt-install --name windows8-test --hvm --ram 1024 --disk path=./windows8-test-disk1.qcow2,format=qcow2,bus=virtio --network bridge=br100,model=virtio --vnc --os-type=windows --cdrom /mnt/vmimages/iso/Windows\ 8\ Retail\(MSDN\)Pro\ x64\ bit.ISO