From owner-freebsd-current@FreeBSD.ORG Wed Sep 7 20:27:41 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2D071065674 for ; Wed, 7 Sep 2011 20:27:41 +0000 (UTC) (envelope-from frimik@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 739588FC1C for ; Wed, 7 Sep 2011 20:27:41 +0000 (UTC) Received: by qyk4 with SMTP id 4so1712325qyk.13 for ; Wed, 07 Sep 2011 13:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=fHWUx5YtzzW/toZDuMEB3NgeSl8CYUrUK44BaqNWJzY=; b=kNz78PEsesUkwlVOAzc61O+MUSWi9zhM05mDI7/QHiADZVd7XhlIQmgQMt5D9UViQw gjAZ1Y+zw4+zlOLVWKiIuvHBrpywnBA8EJlTCcVwFYJi+YKMhnw6kO4cddyhNpcmXGI/ xSr6AUxnLXeY6AkgYxwWTPaSdfh0feBm222dA= MIME-Version: 1.0 Received: by 10.52.156.13 with SMTP id wa13mr2861191vdb.165.1315427260508; Wed, 07 Sep 2011 13:27:40 -0700 (PDT) Received: by 10.52.160.1 with HTTP; Wed, 7 Sep 2011 13:27:40 -0700 (PDT) In-Reply-To: <4E679063.5020700@FreeBSD.org> References: <4E679063.5020700@FreeBSD.org> Date: Wed, 7 Sep 2011 22:27:40 +0200 Message-ID: From: Mikael Fridh To: "Andrey V. Elsukov" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org Subject: Re: FreeBSD 9.0 BETA2 gpart resize -s uses whole disk on first resize X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 20:27:41 -0000 2011/9/7 Andrey V. Elsukov : > On 07.09.2011 04:21, Mikael Fridh wrote: >> Hi gurus, >> >> FreeBSD freebsd9.mg8.tmtowtdi.se 9.0-BETA2 FreeBSD 9.0-BETA2 #0: Wed >> Aug 31 18:07:44 UTC 2011 >> root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC =A0amd64 >> >> When resizing a partition, on first attempt it uses up the whole disk. >> Only on second attempt it resizes to the correct target size. >> >> Resizing from any smaller size to a larger size initially uses up the >> whole disk, like if -s was not used at all even if it's as little as >> one logical disk block. >> >> I'm wondering if anyone else can reproduce. > > I can't reproduce. > > So, can you enable G_F_CTLDUMP flag and try it again, and show what you > will get? > Just use: > # sysctl kern.geom.debugflags=3D0x80 > # gpart resize -i 2 -s 33554432 md0 > > On the console (and in the log files) will be printed some info. I saw your patch and will try to patch and try it. For completion here is the information you requested. freebsd9# gpart add -t freebsd-swap -s 200 -l testswap ada0 ada0p5 added freebsd9# gpart show ada0 =3D> 34 3907029101 ada0 GPT (1.8T) 34 30 - free - (15k) 64 128 1 freebsd-boot (64k) 192 33554240 2 freebsd-swap (16G) 33554432 209715200 3 freebsd-zfs (100G) 243269632 3663757312 4 freebsd-zfs (1.7T) 3907026944 200 5 freebsd-swap (100k) 3907027144 1991 - free - (995k) freebsd9# sysctl kern.geom.debugflags=3D0x80 kern.geom.debugflags: 0 -> 128 freebsd9# gpart resize -i 5 -s 800 ada0 ada0p5 resized freebsd9# gpart show ada0 =3D> 34 3907029101 ada0 GPT (1.8T) 34 30 - free - (15k) 64 128 1 freebsd-boot (64k) 192 33554240 2 freebsd-swap (16G) 33554432 209715200 3 freebsd-zfs (100G) 243269632 3663757312 4 freebsd-zfs (1.7T) 3907026944 2184 5 freebsd-swap (1.1M) 3907029128 7 - free - (3.5k) freebsd9# diskinfo -v ada0 ada0 512 # sectorsize 2000398934016 # mediasize in bytes (1.8T) 3907029168 # mediasize in sectors 4096 # stripesize 0 # stripeoffset 3876021 # Cylinders according to firmware. 16 # Heads according to firmware. 63 # Sectors according to firmware. WD-WCAVY1880124 # Disk ident. dmesg output from gpart add and 2 sequential gpart resizes (gpart resize -i 5 -s 800 ada0): * add: Dump of gctl request at 0xfffffe0002b94a80: param: "class" [R5] =3D "PART" param: "verb" [R4] =3D "add" param: "version" [R4] =3D 00 00 00 00 param: "type" [R13] =3D "freebsd-swap" param: "size" [R4] =3D "200" param: "label" [R9] =3D "testswap" param: "start" [R11] =3D "3907026944" param: "flags" [R2] =3D "C" param: "arg0" [R5] =3D "ada0" param: "output" [RW4096] =3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * resize 1: Dump of gctl request at 0xfffffe0002b94c80: param: "class" [R5] =3D "PART" param: "verb" [R7] =3D "resize" param: "version" [R4] =3D 00 00 00 00 param: "index" [R8] =3D 05 00 00 00 00 00 00 00 param: "size" [R5] =3D "2184" param: "flags" [R2] =3D "C" param: "arg0" [R5] =3D "ada0" param: "output" [RW4096] =3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * resize 2: Dump of gctl request at 0xfffffe0002b93680: param: "class" [R5] =3D "PART" param: "verb" [R7] =3D "resize" param: "version" [R4] =3D 00 00 00 00 param: "index" [R8] =3D 05 00 00 00 00 00 00 00 param: "size" [R4] =3D "800" param: "flags" [R2] =3D "C" param: "arg0" [R5] =3D "ada0" param: "output" [RW4096] =3D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -- Mikael Fridh