On 19/11/15 12:20 PM, John wrote:
> Hello list,
> 
> What's the best way of increasing the space of a bhyve guest instance?
> Would it be via growfs? Inside or outside of the vm? Or would it be 
> better to truncate another chunk of space and refer to it in /etc/fstab?
> 
> thanks,

> Hello John,
> 
> -     Do you use virtio-blk (a file created with 'truncate') or ahci-hd (A
> ZFS filesystem, for example) for your guest disk? You have to increase the 
> space of the virtual disk that bhyve uses.

I see no reason to associate truncated files with virtio, and ZVOL with 
ahci-hd. You could just as easily use virtio with a ZVOL and ahci-hd with a 
truncated file. The choice between the two emulation modes really just comes 
down to which is supported better by the guest, or the one that performs better 
in your environment. (For example Windows doesn't support virtio-blk, so you 
need to use ahci-hd regardless of whether you're using ZFS/ZVOL storage or a 
sparse file).

>       - If you used 'truncate', my guess is that you can use truncate to 
> create a new file of larger size. Then, boot into a livecd in bhyve with both 
> > disks and do a 'dd' from one disk to the other. I have tried to 'dd' 
> between files on the host but that didn't seem to work.
>       - If it is a ZFS filesystem, create a new filesystem with 'zfs create 
> -V 50gb zroot/new-volume/' then use a 'zfs send ... | zfs receive ...'
>

Not that I've ever done it, but I'm under the impression you should be able to 
just make the existing disk device bigger by 'truncating' it to a larger size, 
or by using ZFS commands to increase the size of a ZVOL. There should be no 
need to create a brand new disk image and dd or send/recv the data over.

Of course that's the easy bit. The more dangerous part is resizing the 
partitions inside the guest (if it's not whole disk ZFS), and then resizing the 
filesystems. If the disk is GPT partitioned in the guest you will probably have 
to recover the partition table first, as the secondary copy will no longer 
exist at the end of the disk. You'll then need to resize the partitions 
(hopefully the 'main' partition you want to resize is the last on the disk as 
that'll probably make it easier). Once done you then need to resize the 
filesystem. For ZFS you can usually just 'zpool online -e'. For UFS you'll need 
to grow the filesystem as shown in the handbook.

Adding another disk image to the guest and just using that is obviously a much 
simpler solution, if you're happy to permanently have multiple disks attached 
to the guest and reorganise your data. That's what I did when one of my mail 
vm's got too full; I just created a second disk, formatted and mounted it on 
'/mail', and moved all the users there.

Matt

> -     Are these FreeBSD guests (and which filesystem - UFS or ZFS) or Linux
> guests?
>       - If these are FreeBSD guests running UFS, look at 
> https://www.freebsd.org/doc/handbook/disks-growing.html
>       - If these are FreeBSD guests running ZFS, you can probably create the 
> filesystems on your new disk and then use zfs send & receive
>       - If these are linux guests, you will have to use a livecd and 
> something like 'gpart'.

> Thanks,
> Manas

_______________________________________________
freebsd-virtualization@freebsd.org mailing list 
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"
_______________________________________________
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"

Reply via email to