Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2019 18:56:03 +0100
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        freebsd-virtualization@freebsd.org, FreeBSD <freebsd-stable@freebsd.org>
Subject:   Re: bhyve zfs resizing
Message-ID:  <f7b4a7d7-4c07-22f2-8d56-9a62c685ea5c@quip.cz>
In-Reply-To: <20190318152525.GC91631@rpi3.zyxst.net>
References:  <20190318150404.GB91631@rpi3.zyxst.net> <CAOtMX2j55KCrwSgoPUmGfgsRYdL4ivwC0kf=ODqHf7gwe6H3Gg@mail.gmail.com> <20190318152525.GC91631@rpi3.zyxst.net>

next in thread | previous in thread | raw e-mail | index | archive | help
tech-lists wrote on 2019/03/18 16:25:
> On Mon, Mar 18, 2019 at 09:08:31AM -0600, Alan Somers wrote:
>>
>> Do you mean using a zvol as the backing store for a VM?  If so, then:
>> 1) Yes.  You can just do "zfs set volsize" on the host.
>> 2) In theory no, but the guest may need to be rebooted to notice the
>> change.  And I'm not sure if the current bhyve code will expose the
>> new size without a reboot or not.
>> 3) Sure.  But after you expand the zvol (or before you shrink it),
>> you'll have to change the size of the guest's filesystem using the
>> guest's native tools.


I did it 2 month ago on FreeBSD 11.2.

On the host with running guest:

# zfs set volsize=200G tank1/vol1/bhyve/kotel/disk1

Even if I unmounted disk in the guest it still does not see the new size 
until I rebooted the guest.

After reboot of the guest, you will see corrupted GPT:

# gpart show -p vtbd1
=>       40  209715120    vtbd1  GPT  (200G) [CORRUPT]
          40          8           - free -  (4.0K)
          48       1024  vtbd1p1  freebsd-boot  (512K)
        1072        976           - free -  (488K)
        2048  203423744  vtbd1p2  freebsd-ufs  (97G)
   203425792    6289368           - free -  (3.0G)

And after running recover, the guest will see the added space

# gpart recover vtbd1
vtbd1 recovered


# gpart show -p vtbd1
=>       40  419430320    vtbd1  GPT  (200G)
          40          8           - free -  (4.0K)
          48       1024  vtbd1p1  freebsd-boot  (512K)
        1072        976           - free -  (488K)
        2048  203423744  vtbd1p2  freebsd-ufs  (97G)
   203425792  216004568           - free -  (103G)

After this, the partition can finally be enlarged

# gpart resize -a 1M -s 197G -i 2 vtbd1

# growfs /vol0


Kind regards
Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f7b4a7d7-4c07-22f2-8d56-9a62c685ea5c>