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 02:21:26 +0200
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 just tried to perform the same on an old 8.2-STABLE machine and it
did not behave the same. Growing a partition worked fine on initial
attempts.

See excerpt from session below:

freebsd9# gpart show ada0
=>        34  3907029101  ada0  GPT  (1.8T)
          34          30        - free -  (15k)
          64         128     1  freebsd-boot  (64k)
         192     8388608     2  freebsd-swap  (4.0G)
     8388800  3898640335        - free -  (1.8T)

freebsd9# expr 8388608 \* 4
33554432

freebsd9# gpart resize -i 2 -s 33554432 ada0
ada0p2 resized

freebsd9# gpart show ada0
=>        34  3907029101  ada0  GPT  (1.8T)
          34          30        - free -  (15k)
          64         128     1  freebsd-boot  (64k)
         192  3907028936     2  freebsd-swap  (1.8T)
  3907029128           7        - free -  (3.5k)

freebsd9# gpart resize -i 2 -s 33554432 ada0
ada0p2 resized

freebsd9# gpart show ada0
=>        34  3907029101  ada0  GPT  (1.8T)
          34          30        - free -  (15k)
          64         128     1  freebsd-boot  (64k)
         192    33554432     2  freebsd-swap  (16G)
    33554624  3873474511        - free -  (1.8T)
Received on Tue Sep 06 2011 - 22:44:54 UTC

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