Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Sep 2016 08:35:39 -0500
From:      Brandon J. Wandersee <brandon.wandersee@gmail.com>
To:        Perry Hutchison <perryh@pluto.rain.com>
Cc:        brandon.wandersee@gmail.com, wblock@wonkity.com, freebsd-questions@freebsd.org
Subject:   Re: "gpart add" falsely claiming "No space left on device"
Message-ID:  <86r38tqjpw.fsf@WorkBox.Home>
In-Reply-To: <57d276f6.CwaoGNki0kQYiZns%perryh@pluto.rain.com>
References:  <57ce6e64.EITkODjuwy6pZ4L+%perryh@pluto.rain.com> <alpine.BSF.2.20.1609060814030.1903@wonkity.com> <57cf9b95.Zj/JGHeshaKL6Zr5%perryh@pluto.rain.com> <alpine.BSF.2.20.1609070643120.24506@wonkity.com> <57d0f29b.3QNvCze7LJDzs0SU%perryh@pluto.rain.com> <86wpimm6om.fsf@WorkBox.Home> <57d276f6.CwaoGNki0kQYiZns%perryh@pluto.rain.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

> "Brandon J. Wandersee" <brandon.wandersee@gmail.com> wrote:
>
>> '-s' defaults to everything available.
>
> "available" on the entire disk (as if no partitions were defined),
> the first free block, or the largest free block?  (One hopes, not
> the sum of all free blocks :)  Again, the man page should say!

"Available" as in "available based on logical context." If no
partitions are present on the disk, you get one partition starting at
the first sector and ending at the last, less any space needed for
scheme-specific metadata and buffer space resulting from '-a' or '-b.'
If partitions exist, you'll get a partition starting at the first free
sector and extending until you hit another partition or the end of the
disk, assuming the partition can be created in that space while
abiding by traits set with '-a' or '-b'.

Obviously partitions can only consist of contiguous space, and the
command will not automatically destroy an existing partition
layout. `gpart add` *adds a partition.* Deleting and resizing
partitions, and destroying tables, are handled by separate commands.

> [The need to specify partition type] _could_ be implied by its not
> being bracketed in the usage section, if not for the fact that -b and
> -s (which apparently do have defaults, even though the man page does
> not say what they are) are not bracketed either.

> There's no [ATTRIBUTES] section in the gpart(8) man page I'm looking at (on
> FreeBSD 8.1) ...  There's no BOOTSTRAPPING section in this gpart(8)
> man page, either.

All of this---including the bracketed '-s' and '-b'---are present in
the latest version of the man page.[1] 8.1 hasn't been supported for four
years, so it's documentation won't be updated.

> Alignment to 4k makes sense if the physical sector size is 4k (as
> is often the case with newer disk drives) -- but 1M?  Seems a bit
> much, which is why it would be useful for that page to include a
> more detailed explanation.

Aligning to 1Mb guarantees that a partition is aligned to physical
sector boundaries regardless a disk's actual or reported sector
size. Newer HDD firmwares often report having 512k sectors for
backwards compatibility, even when they have 4k sectors, while SSDs
don't really have an industry-standard sector size and report whatever
the manufacturer feels like. But in all cases, they're factors of
1Mb. The point is that you either spend some time and effort
researching each disk model in the system and doing some math, or you
just sacrifice a megabyte or two for guaranteed alignment and be done
with it.

[1]: https://www.freebsd.org/cgi/man.cgi?query=gpart&apropos=0&sektion=8&manpath=FreeBSD+10.3-RELEASE+and+Ports&arch=default&format=html

-- 
::  Brandon J. Wandersee
::  brandon.wandersee@gmail.com
::  --------------------------------------------------
::  'The best design is as little design as possible.'
::  --- Dieter Rams ----------------------------------



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?86r38tqjpw.fsf>