0 Development Setup (Linux)
Christian Schwarz edited this page 2022-12-22 18:38:00 +01:00

High-Level Overview

  • Libvirt + QEMU + KVM
  • 2 long-lived Ubuntu VMs on a bridged network, accsessible from the host
  • Develop & build zrepl on the host
  • Use a script to scp built binaries into the guest

Creating The VMs

(This section is copy-pasted from some notes and likely imperfect, feel free to amend)

Prepare disk images:

cd /var/lib/libvirt/images
wget 'https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img'
qemu-img convert jammy-server-cloudimg-amd64.img ubuntu-2204.qcow2
cp ubuntu-2204.qcow2 zrepl-2-ubuntu-2204.qcow2
cp ubuntu-2204.qcow2 zrepl-1-ubuntu-2204.qcow2
qemu-img resize zrepl-2-ubuntu-2204.qcow2 +10G
qemu-img resize zrepl-1-ubuntu-2204.qcow2 +10G
virt-customize -a zrepl-1-ubuntu-2204.qcow2 --hostname zrepl-1-2204 --root-password password:""          
virt-customize -a zrepl-2-ubuntu-2204.qcow2 --hostname zrepl-2-2204 --root-password password:""          

Start VMs.

Setup SSH using ssh-copy-id or similar.

From here on, inside each VM

mkdir /etc/zrepl
ln -s /opt/zrepl /usr/bin/zrepl
# we'll later scp the binaries built on the host to /opt/zrepl

Create zpool p1

dd if=/dev/zero of=/pool.img bs=1M count=1024 status=progress
poolname=p1
# for unencrypted pool
sudo zpool create -f $poolname /pool.img
# for encrypted pool
echo foobar2342 > /pool.key && sudo zpool create -f -O encryption=on -O keyformat=passphrase -O keylocation=file:///pool.key $poolname /pool.img