From owner-freebsd-user-groups@freebsd.org Mon Jan 23 13:32:22 2017 Return-Path: Delivered-To: freebsd-user-groups@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B0F0CBCEA9 for ; Mon, 23 Jan 2017 13:32:22 +0000 (UTC) (envelope-from linux.gokan@gmail.com) Received: from mail-vk0-x235.google.com (mail-vk0-x235.google.com [IPv6:2607:f8b0:400c:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 51B10A18 for ; Mon, 23 Jan 2017 13:32:22 +0000 (UTC) (envelope-from linux.gokan@gmail.com) Received: by mail-vk0-x235.google.com with SMTP id t8so90213775vke.3 for ; Mon, 23 Jan 2017 05:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=rH+CdCl/6nQYnMPFiEnws/+hInIL7gRDLu41Ho8GAEk=; b=CvnugQh3RNDSK3xErodXnEIogiYg/IyVF+aAZdHiIc0A/iMtBq+6roW93reff8gCh2 UZlbmulhWCxfT71SAeJrq2HdukWEz0Gv6jHTlMkzqo6GEagc0XiSwk1Ez8CCVEDbyqzM eyz6LHqIHAUpu0lxamp2bE9Ip6IYx+m8k0c1/IyrG5XpN9M6RpQ8RiTnDzMarKeZlSdd CgKBKFimIy0xnGC2eYpCNbfYH06x5SpYPcEaqwcFD93vX5mQ84HvFT5E05UzXKCYjq1J wq5Ch6x0iMZ96HRfPnQE2F/CFQndIeEo4fL835WDjB2XdKK45fpzJ0DN/4cTIVfxBm4T 7a6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=rH+CdCl/6nQYnMPFiEnws/+hInIL7gRDLu41Ho8GAEk=; b=BBZ2Ux585i38ylk8DP0HnTuuX44jBTaWTD53kvcBYDxnCFPyXlcAfE2hzJ+kZ2BYK8 8PZ1bArPkl8aRu4x/fJRXKpVi+ic/tMQfUJUSsqFYL+gK6UPB5FnuaUPdHQN43VQ7kzg SboAgcjnLCTMMbEKAi9fIPHsnPOGlN+igmhFvjD73L5JMnBB7PJWeqnQkOGEXdgVA0aF v8yXF7741ND0anWLglg4yzaq8obaHSoi5D8QWT8j1gML4oDdU6+HmV/AtFFa+4vaGaZ2 J20umXlQGuJo08F4F7ec7a6wy1NnIj7h7QhteQpZmlnfHvLVXC52/UuDxVakB8E1KlLR 9o2Q== X-Gm-Message-State: AIkVDXJki6lSyPlugk/OAyvmeK+SZjaIZhzcTB2snOZImSDWjqOv03uOtvEnNJkkJz5N8Yx+QOTEpzBe5A2iKg== X-Received: by 10.31.212.2 with SMTP id l2mr11130158vkg.134.1485178341270; Mon, 23 Jan 2017 05:32:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.70.69 with HTTP; Mon, 23 Jan 2017 05:32:20 -0800 (PST) In-Reply-To: References: From: Gokan Atmaca Date: Mon, 23 Jan 2017 16:32:20 +0300 Message-ID: Subject: Re: Disk extend To: Jan Bramkamp , freebsd-user-groups@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-user-groups@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User Group Coordination List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 13:32:22 -0000 > You can't expand a partition unless there is free space directly behind it. > In your case the swap partition is in the way. You can disable swap, delete > the swap partition, resize the root partition to the right size (in your > case 19GB+20GB = 29GB) leaving space for a new swap partition (in your case > 1GB). It would look something like this: Can we do online ? Thanks. On Mon, Jan 23, 2017 at 3:53 PM, Jan Bramkamp wrote: > On 21/01/2017 16:01, Gokan Atmaca wrote: >> >> Hello >> >> I use KVM. I upgraded to a single disk that was owned by Freebsd with >> Qemu. But the disk "ROOT" is still small. What should I do for it ? >> >> root@test:~ # gpart show ada0 >> => 34 83886013 ada0 GPT (40G) >> 34 1024 1 freebsd-boot (512K) >> 1058 39844864 2 freebsd-ufs (19G) >> 39845922 2097084 3 freebsd-swap (1.0G) >> 41943006 41943041 - free - (20G) >> >> I did so; >> root@test:~ # gpart resize -i 2 -s 20971520 ada0 >> gpart: Device busy >> >> How can I do this safely? > > You can't expand a partition unless there is free space directly behind it. > In your case the swap partition is in the way. You can disable swap, delete > the swap partition, resize the root partition to the right size (in your > case 19GB+20GB = 29GB) leaving space for a new swap partition (in your case > 1GB). It would look something like this: > > # Disable swap > swapoff -a > > # Delete the third partition > gpart delete -i 3 ada0 > > # Resize the second partition now that there is adjacent free space > gpart resize -i 2 -s 29G ada0 > > # Recreate the swap partition > gpart add -t freebsd-swap -l swap0 ada0 > > # Enable swap > swapon -a > > Now the UFS file system is smaller than the containing partition. Use > growfs(8) to resize your file system. > _______________________________________________ > freebsd-user-groups@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-user-groups > To unsubscribe, send any mail to > "freebsd-user-groups-unsubscribe@freebsd.org"