can a bhyve instance be resized? adding another virtual disk?

Michael Gmelin freebsd at grem.de
Wed Oct 15 12:32:49 UTC 2014



On Wed, 15 Oct 2014 12:56:38 +0100
freebsd-lists at potato.growveg.org wrote:

> Hello list,
> 
> Can a bhyve instance be resized? I'm talking about the disk. 
> Say your end user needs more diskspace. They have 32GB. They need
> 64GB. How do you do it? I presume one has to stop the guest, then use
> truncate. What about if the guest OS isn't freebsd, and they use say
> ext2 or 3? Will ext3 start yelling at me because I've resized it?
> 
> What if they just want another disk? How does one refer to a 
> newly created virtual disk from a guest? How is it mounted to the
> guest?
> 
> thanks

If you're using a zvol with UFS on top the procedure is quite simple,
this is how I did it last time (at your own risk), I resized the disk
to 15G (was like 5G beforehand).

zvol is at tank/bhyve/virt03.

Shutdown the VM.

zfs set volsize=15G tank/bhyve/virt03
zfs rename tank/bhyve/virt03  tank/bhyve/virtxx
gpart recover zvol/tank/bhyve/virtxx
zfs rename tank/bhyve/virtxx  tank/bhyve/virt03

# this is not the exact size, sorry
gpart resize -i1 -s15359M zvol/tank/bhyve/virt03
growfs /dev/zvol/tank/bhyve/virt03p1

Start VM

The renaming step was necessary so that GEOM picks up the new zvol size
(this was on 10.0-RELEASE, might work without this on CURRENT). You
might want to make a backup before doing this.

-- 
Michael Gmelin


More information about the freebsd-virtualization mailing list