make backing-image.qcow2
- downloads the backing image and extracts itqemu-img resize backing-image.qcow2 +10G
- increases the size of the backing imagemake run-backing-image
- runs the backing image for initial setup- login with root:root
lsblk
- confirm the backing image sizefdisk /dev/sda
d 3
- delete the 3rd partitionn 3
- create a new partition, use default optionsw
- write changesreboot
- reboot the machine, reload the partition tableresize2fs /dev/sda3
- resize the partition- Change /etc/ssh/sshd_config to: PermitRootLogin yes, PasswordAuthentication yes
- Setup ssh keys for zso, from host:
ssh-copy-id -p 2222 zso@localhost
- Setup ssh keys for root, from host:
ssh-copy-id -p 2222 root@localhost
- Copy your own ssh keys to the machine to use git and ssh:
scp -P 2222 -r ~/.ssh zso@localhost:~
apt-get update && apt-get install -y rsync
- close the virtual machine
make current-image.qcow2
- creates the current image, backed by the backing imagemake run-current-image
- runs the current image
You can add aliases to ssh config to simplify commands. In ~/.ssh/config:
Host zso-zso
HostName localhost
Port 2222
User zso
Host root-zso
HostName localhost
Port 2222
User root
Sources: https://sandilands.info/sgordon/increasing-kvm-virtual-machine-disk-using-lvm-ext4