Creating new disk for VMM
To create a new disk for a virtual machine inside OpenBSD VMM, first login to the host machine:
$ ssh username@host.example.com
Replace username
and host.example.com
.
Next:
$ vmctl create -s 20G newdisk.qcow2
Replace 20G
with the disk size you need, and replace
newdisk.qcow2
. By convention, the disk name for the virtual machine
will be the same as your username.
The hypervisor admin will then need to add your new disk to /etc/vm.conf:
vm "username" { owner username memory 2048M cdrom "/home/username/username.iso" disk /home/username/username.qcow2 disk /home/username/newdisk.qcow2 interface { locked lladdr aa:bb:cc:dd:ee:ff switch "switch0" } }
The user should power off the virtual machine, either by logging in to the guest machine and running:
$ doas shutdown -p now
or logging into the host machine (host.example.com
) and running:
$ vmctl stop username
Or, the hypervisor admin will need to power off the virtual machine:
$ doas vmctl stop username
Next, the hypervisor admin needs to reload the configuration file;
$ doas vmctl reload
Now, log back in to the virtual machine guest. If you're on the hypervisor, type:
$ vmctl console username
Login, then verify that the disk has been detected:
$ dmesg | grep -E 'sd[0-9]' sd0 at scsibus1 targ 0 lun 0: <VirtIO, Block Device, > sd0: 20480MB, 512 bytes/sector, 41943040 sectors sd1 at scsibus2 targ 0 lun 0: <VirtIO, Block Device, > sd1: 20480MB, 512 bytes/sector, 41943040 sectors root on sd0a (fd7ecb3de7e46e12.a) swap on sd0b dump on sd0b
You should see your old disk (sd0) and your new disk (sd1). Make sure to compare the disk size to ensure that you have identified the disks correctly.
The mount command can also show which disk is being actively used:
$ mount /dev/sd0a on / type ffs (local) /dev/sd0k on /home type ffs (local, nodev, nosuid) ...
You can then format the new disk.