This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
virtualisation [2017/02/08 15:14] hkoller [Mounting a KVM Image on the host] |
virtualisation [2020/02/13 11:47] mantis [vmbuilder] |
||
---|---|---|---|
Line 18: | Line 18: | ||
===== With Ubuntu already installed ===== | ===== With Ubuntu already installed ===== | ||
+ | |||
+ | ==== virt-install ==== | ||
+ | |||
+ | https://www.server-world.info/en/note?os=Ubuntu_18.04&p=kvm&f=2 | ||
+ | |||
+ | |||
+ | ==== vmbuilder ==== | ||
+ | |||
If you want to create an **Ubuntu** VM you can use a shortcut (found here: https://help.ubuntu.com/8.04/serverguide/C/ubuntu-vm-builder.html). Install | If you want to create an **Ubuntu** VM you can use a shortcut (found here: https://help.ubuntu.com/8.04/serverguide/C/ubuntu-vm-builder.html). Install | ||
Line 40: | Line 48: | ||
- | ==== Lucid KVM, 64bit ==== | + | === Lucid KVM, 64bit === |
<code bash> | <code bash> | ||
sudo vmbuilder kvm ubuntu --arch=amd64 --suite=lucid --addpkg vim --addpkg openssh-server --addpkg man --mem 1024 --rootsize=2048 | sudo vmbuilder kvm ubuntu --arch=amd64 --suite=lucid --addpkg vim --addpkg openssh-server --addpkg man --mem 1024 --rootsize=2048 | ||
</code> | </code> | ||
- | ==== Trusty KVM, 64bit ==== | + | === Trusty KVM, 64bit === |
There is currently a bug which causes KVM building to fail under trusty (14.04). It is easily fixed by explicitly adding the parameter "--addpkg linux-image-generic" to the command: | There is currently a bug which causes KVM building to fail under trusty (14.04). It is easily fixed by explicitly adding the parameter "--addpkg linux-image-generic" to the command: | ||
Line 52: | Line 60: | ||
</code> | </code> | ||
+ | |||
+ | === Bionic === | ||
+ | |||
+ | <code bash> | ||
+ | sudo virt-builder ubuntu-18.04 --format qcow2 -o ubuntu1804.qcow2 --root-password password:xxx --install net-tools,ntp,openssh-server | ||
+ | |||
+ | </code> | ||
===== Empty disk Images===== | ===== Empty disk Images===== | ||
Line 134: | Line 149: | ||
sudo qemu-img resize image.qcow2 +10G | sudo qemu-img resize image.qcow2 +10G | ||
</code> | </code> | ||
+ | |||
+ | Make sure virt-manager knows about the changed disk size: go to "Storage" and Refresh (not sure if really necessary, but cant hurt..) | ||
Next boot the VM, log in and increase the size of the partition. This is done by deleting the old partition and re-creating it with the same start, but a larger size: | Next boot the VM, log in and increase the size of the partition. This is done by deleting the old partition and re-creating it with the same start, but a larger size: | ||
Line 140: | Line 157: | ||
sudo fdisk /dev/vda | sudo fdisk /dev/vda | ||
#sudo fdisk --compatibility=dos /dev/vda # in case you want to start at sector 63 | #sudo fdisk --compatibility=dos /dev/vda # in case you want to start at sector 63 | ||
+ | # or on newer fdisk versions: | ||
+ | #sudo fdisk -c=dos /dev/vda # in case you want to start at sector 63 | ||
p # print partition table and memorize start sector etc. | p # print partition table and memorize start sector etc. | ||
Line 153: | Line 172: | ||
<code bash > | <code bash > | ||
- | sudo resise2fs /dev/vda1 | + | sudo resize2fs /dev/vda1 |
</code> | </code> | ||
Line 160: | Line 179: | ||
https://www.jamescoyle.net/how-to/323-reclaim-disk-space-from-a-sparse-image-file-qcow2-vmdk | https://www.jamescoyle.net/how-to/323-reclaim-disk-space-from-a-sparse-image-file-qcow2-vmdk | ||
+ | |||
+ | |||
+ | ===== Convert qcow2 to VMWare ===== | ||
+ | <code bash> | ||
+ | qemu-img convert -f qcow2 file.qcow2 -O vmdk file.vmdk | ||
+ | </code> | ||
+ | |||
+ | |||
====== Troubleshooting ====== | ====== Troubleshooting ====== | ||