Re: FreeBSD 9.0 BETA2 gpart resize -s uses whole disk on first resize

From: Mikael Fridh <frimik_at_gmail.com>
Date: Wed, 7 Sep 2011 22:27:40 +0200
2011/9/7 Andrey V. Elsukov <ae_at_freebsd.org>:
> 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_at_farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>>
>> 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=0x80
> # 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
=>        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=0x80
kern.geom.debugflags: 0 -> 128
freebsd9# gpart resize -i 5 -s 800 ada0
ada0p5 resized
freebsd9# gpart show ada0
=>        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] = "PART"
  param:        "verb" [R4] = "add"
  param:        "version" [R4] =  00 00 00 00
  param:        "type" [R13] = "freebsd-swap"
  param:        "size" [R4] = "200"
  param:        "label" [R9] = "testswap"
  param:        "start" [R11] = "3907026944"
  param:        "flags" [R2] = "C"
  param:        "arg0" [R5] = "ada0"
  param:        "output" [RW4096] =  00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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] = "PART"
  param:        "verb" [R7] = "resize"
  param:        "version" [R4] =  00 00 00 00
  param:        "index" [R8] =  05 00 00 00 00 00 00 00
  param:        "size" [R5] = "2184"
  param:        "flags" [R2] = "C"
  param:        "arg0" [R5] = "ada0"
  param:        "output" [RW4096] =  00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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] = "PART"
  param:        "verb" [R7] = "resize"
  param:        "version" [R4] =  00 00 00 00
  param:        "index" [R8] =  05 00 00 00 00 00 00 00
  param:        "size" [R4] = "800"
  param:        "flags" [R2] = "C"
  param:        "arg0" [R5] = "ada0"
  param:        "output" [RW4096] =  00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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
Received on Wed Sep 07 2011 - 18:27:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:17 UTC