---
# System prepended metadata

title: Virtualization

---

# Virtualization

Generate Ubuntu 14.04 image (install libguestfs first):
```
virt-builder ubuntu-16.04 \
    --no-check-signature --format qcow2 --size 30G \
    --root-password password:rootpass --output ubuntu.qcow2
## Root is at /dev/vda1
```

Create the second disk:
```
qemu-img create -f qcow2 ext4.qcow2 80M
```

Boot:
```
qemu-system-x86_64 -enable-kvm \
    -m 4G -smp 4 \
    -hda ubuntu.qcow2
    -hdb ext4.qcow2 \
    -device e1000,netdev=net0 \
    -nographic -netdev user,id=net0,hostfwd=tcp::5557-:22
```

After boot, enter the non-graphic shell and add a user.
```
apt-get install sudo openssh-server
useradd -G sudo -m user
passwd user
systemctl start sshd
```

ssh into the VM:

```
ssh -p 5557 user@localhost
```