From owner-freebsd-virtualization@FreeBSD.ORG Wed Oct 15 15:59:08 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B3D851A for ; Wed, 15 Oct 2014 15:59:08 +0000 (UTC) Received: from mail-ig0-f172.google.com (mail-ig0-f172.google.com [209.85.213.172]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66200AA8 for ; Wed, 15 Oct 2014 15:59:08 +0000 (UTC) Received: by mail-ig0-f172.google.com with SMTP id r2so17584505igi.11 for ; Wed, 15 Oct 2014 08:59:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=gJF4vKldIvBpaQ7ZbUtI94unb+niAGeQwT9U7I/dlvU=; b=Wsic8zK6/M71IjQWBL6/G1/ZdybMFA9yX4EVW8vqPlHzykL0G66M6Gjilfr3jidCng VbActLt136Hv+5HYKslWl8JKpxGW4YPsMB6JnnJc6X24A18mZ7529Qf3eFipMaIbkbrn cp00eueSneIhUH9Ehp3pKVFvo99R98IWbMe6npB4mxGRzRXXuO2IE0IbtG7ySzGm9yGZ 6vSnO6OuQova5/pexvVPd/yA2a4wmgNeYtkYjLTu8USZHaqHoSJAFb96YGxdQrwe1cvm CT1fwl+fELkwnzG9brbdoggbXpgv8zImPh8lg/fko6Pk2hxaxlobKtHwu/dF83RDZO/T n4fA== X-Gm-Message-State: ALoCoQm9f3JEGjx/1LGDRXWX6JBvNLyfozYwbEdfvihMBe5/c8FZU1nZlMsQFIpjKOCAPgKddNWo X-Received: by 10.50.141.197 with SMTP id rq5mr15054513igb.21.1413388296385; Wed, 15 Oct 2014 08:51:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.19.30 with HTTP; Wed, 15 Oct 2014 08:51:16 -0700 (PDT) X-Originating-IP: [216.240.30.23] In-Reply-To: References: <20141015115638.GA72800@potato.growveg.org> From: Bryan Venteicher Date: Wed, 15 Oct 2014 10:51:16 -0500 Message-ID: Subject: Re: can a bhyve instance be resized? adding another virtual disk? To: John Nielsen Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 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: Wed, 15 Oct 2014 15:59:08 -0000 On Wed, Oct 15, 2014 at 9:38 AM, John Nielsen wrote: > On Oct 15, 2014, at 5:56 AM, freebsd-lists@potato.growveg.org wrote: > > > 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 truncat= e. > > 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? > > This isn't specific to FreeBSD or bhyve. Virtio block devices actually ca= n > support online resizing, but I don't know if bhyve allows that yet (I'm > assuming it doesn't). In which case, yes, stop the guest and resize > whatever its volume lives on (if a raw file then truncate would work), th= en > start it up again. That's the easy part. > > Correct - the VirtIO block driver notifies GEOM when it receives that event, but =E2=80=8Bbhyve doesn't yet report size changes. It is on my todo= list for whenever I have the spare cycles to start hacking on bhyve.=E2=80=8B > The harder part (but much easier than it used to be) is resizing > everything else. If using partitions they need to be extended first (and = if > using GPT the backup partition table needs to be moved first of all, a la > "gpart recover".) On FreeBSD this is pretty straightforward with gpart: > sysctl kern.geom.debugflags=3D16 > gpart resize -i $number_of_last_partition $underlying_block_device > > You should probably reboot at this point so the kernel forgets about the > old partition table. > > Then you get to resize the filesystem. If you are using ZFS or if you hav= e > FreeBSD 9.2 or newer and UFS then you can do it while it is mounted. > Otherwise you may need to boot from another source to do the resize. For > UFS use growfs a la "growfs /dev/$block_special_for_partition". For ZFS u= se > "zpool online -e $zpool $zdev" > > For ext[234] on Linux, use "resize2fs /dev/$block_special". (If using LVM > then you need to first resize the LV with lvextend). For XFS use > "xfs_growfs $mountpoint". You can also resize btrfs but I don't know the > command off the top of my head. > > That should be 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= ? > > Just add a "-d /path/to/new/device" to your vmrun.sh or the corresponding > -s to bhyve when you start the VM. It will show up as a new block device = in > the guest (e.g. /dev/vtbd1), you can partition and/or put filesystems on = it > as you choose and mount them normally and/or add them to /etc/fstab, etc. > > JN > > _______________________________________________ > freebsd-virtualization@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization > To unsubscribe, send any mail to " > freebsd-virtualization-unsubscribe@freebsd.org" >