Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Sep 2011 19:40:19 +0400
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        freebsd-current@freebsd.org
Subject:   Re: FreeBSD 9.0 BETA2 gpart resize -s uses whole disk on first resize
Message-ID:  <4E679063.5020700@FreeBSD.org>
In-Reply-To: <CALoBCad4=LajXqXEEnEqq3SNvUcVV57ZyXdYoCvoG6U-WdOUpg@mail.gmail.com>
References:  <CALoBCad4=LajXqXEEnEqq3SNvUcVV57ZyXdYoCvoG6U-WdOUpg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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  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.

# dd if=/dev/zero of=./disk count=1 seek=3907029167
1+0 records in
1+0 records out
512 bytes transferred in 0.000116 secs (4409617 bytes/sec)
# mdconfig -f disk
md0
# gpart create -s gpt md0
md0 created
# gpart add -t freebsd-boot -b 64 -s 128 md0
md0p1 added
# gpart add -t freebsd-swap -s 8388608 md0
md0p2 added
# gpart show md0
=>        34  3907029101  md0  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)

# gpart resize -i 2 -s 33554432 md0
md0p2 resized
# gpart show md0
=>        34  3907029101  md0  GPT  (1.8T)
          34          30       - free -  (15k)
          64         128    1  freebsd-boot  (64k)
         192    33554432    2  freebsd-swap  (16G)
    33554624  3873474511       - free -  (1.8T)
===================================================

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.

-- 
WBR, Andrey V. Elsukov


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)

iQEcBAEBAgAGBQJOZ5BqAAoJEAHF6gQQyKF6JLUH/if444OQFc9a1Gr+FwLjAPan
5PAFxQ5qe4ufgmIMLbpBehl8SxNmHCWVEMv/FukHXcQCZvJDzoASCGb83oOAXqCb
YaWBMKUyg4lE03zsUGTpB4wT7JTgJOfmEwCOnBUvQvohevjZ8Qi9hjOTNffrvBr7
LWHIoeti1Na0kCVi6HCsHSso2l1mqPrq4a81OEaFu+ttgtdXFJon5O2L9ixu94Sv
f0NjN0ChF4DzG6fUo2KDw2hsQ+epuozRBxv8AZIHl20gukqNrgLFtZUNo7FzyE5r
Sn39dxUwypRAXe1rCdqgfangUmCepzIua2XcQZbQS0cEofvbwQN15IGPtryQsqc=
=/JWh
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E679063.5020700>