bhyve increase disk size

rmccullough

Patron
Joined
May 17, 2018
Messages
269
I have an Ubuntu 18.04 LTS VM running on bhyve. I created it and now want to increase the disk size. I looked around these forums and didn't see a good thread on this topic. I know I could delete the VM and create a new one, but I would rather not have to setup the Ubuntu server again. Is there a good guide on how to do this? I think I am looking for 2 things:
1) How to increase the VM disk size in FreeNAS 11.2
2) How to resize the disk in Ubuntu 18.04 (I can probably find this elsewhere)
3) Is this a bad idea and I should just invest the time to setup the VM again from scratch?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
1. increase disk size in FreeNAS
Code:
# shutdown VM
# get current disk size
root@freenas-pmh[~]# zfs get volsize ssd/vms/wiki-pmh-disk0
NAME                    PROPERTY  VALUE    SOURCE
ssd/vms/wiki-pmh-disk0  volsize   100G     local
# set new disk size
zfs set volsize=200g ssd/vms/wiki-pmh-disk0

Make sure not to truncate the volsize by accident (typo) - your data will be lost.

2. Increase the size in Ubuntu
  • repair the second GPT header
  • resize partition to the end of disk
  • extend filesystem
It's pretty simple, if LVM is not involved. You will easily find instructions online, I don't know them from the top of my head but I did it a couple of times. With LVM it's some more steps, but also possible.

3. Good idea?
Of course it is! Saves a ton of time and work. You might want to create a separate backup first, with the VM shut down:
zfs send mypool/something/myzvol | gzip -c > /mnt/mypool/somedir/vmdisk.gz

HTH,
Patrick
 
Last edited:

rmccullough

Patron
Joined
May 17, 2018
Messages
269
Finally got this figured out.

I did find these resources helpful:
Sending and Receiving ZFS Data - because I screwed up the first time and had to restore my backup
Increase partition size on which Ubuntu is installed? - specifically the post by jtlindsey on 7/27/17 where he provided screenshots of using cfdisk to do this.
Ubuntu 18.04 Extend Disk - specifically this piece:
A more advanced user would probably fire up parted /dev/sda, then enter resizepart 2. The end of the partition will automatically be selected to match the end of the disk. This will only resize the partition, though. The file-system can be resized to span the whole partition with the appropriate tool, like resize2fs /dev/sda2 for ext2/3/4.

How to resize an Ubuntu 18.04 LVM disk - I tried to get by with the TL;DR section, but the key was running parted.
 

kjacques1

Dabbler
Joined
May 6, 2019
Messages
14
Just wanted to say thanks for this thread. Did this in three parts.

1. Took snapshot.
2. Followed Patricks guide above for increasing the volume size from 10gig to 100g.
3. Booted my dietpi vm with the gparted live iso and resized the partition from 10gig to 100gig.

Worked like a champ.
 
Top