From owner-freebsd-virtualization@freebsd.org Mon Mar 18 17:56:11 2019 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CBCD154899C; Mon, 18 Mar 2019 17:56:11 +0000 (UTC) (envelope-from SRS0=eii1=RV=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4C7C6D0CE; Mon, 18 Mar 2019 17:56:09 +0000 (UTC) (envelope-from SRS0=eii1=RV=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id E31D628416; Mon, 18 Mar 2019 18:56:06 +0100 (CET) Received: from illbsd.quip.test (ip-86-49-16-209.net.upcbroadband.cz [86.49.16.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id BC69728417; Mon, 18 Mar 2019 18:56:05 +0100 (CET) Subject: Re: bhyve zfs resizing To: freebsd-virtualization@freebsd.org, FreeBSD References: <20190318150404.GB91631@rpi3.zyxst.net> <20190318152525.GC91631@rpi3.zyxst.net> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: Date: Mon, 18 Mar 2019 18:56:03 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <20190318152525.GC91631@rpi3.zyxst.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C4C7C6D0CE X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [4.24 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.91)[0.914,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.96)[0.957,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.21)[ip: (0.50), ipnet: 94.124.104.0/21(0.25), asn: 42000(0.20), country: CZ(0.07)]; MX_GOOD(-0.01)[cached: elsa.codelab.cz]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; NEURAL_SPAM_LONG(0.97)[0.971,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=eii1=RV=quip.cz=000.fbsd@elsa.codelab.cz]; RECEIVED_SPAMHAUS_PBL(0.00)[209.16.49.86.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=eii1=RV=quip.cz=000.fbsd@elsa.codelab.cz]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 17:56:11 -0000 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