From owner-freebsd-user-groups@freebsd.org Mon Jan 23 12:53:14 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 E2E9DCBD93F for ; Mon, 23 Jan 2017 12:53:14 +0000 (UTC) (envelope-from crest@rlwinm.de) Received: from smtp.rlwinm.de (smtp.rlwinm.de [148.251.233.239]) (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 AEE02198 for ; Mon, 23 Jan 2017 12:53:14 +0000 (UTC) (envelope-from crest@rlwinm.de) Received: from crest.local (unknown [87.253.189.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.rlwinm.de (Postfix) with ESMTPSA id BD76211EC9 for ; Mon, 23 Jan 2017 13:53:05 +0100 (CET) Subject: Re: Disk extend To: freebsd-user-groups@freebsd.org References: From: Jan Bramkamp Message-ID: Date: Mon, 23 Jan 2017 13:53:05 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 12:53:15 -0000 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.