Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Sep 2016 08:35:39 -0500
From:      Brandon J. Wandersee <>
To:        Perry Hutchison <>
Subject:   Re: "gpart add" falsely claiming "No space left on device"
Message-ID:  <86r38tqjpw.fsf@WorkBox.Home>
In-Reply-To: <>
References:  <> <> <57cf9b95.Zj/> <> <> <86wpimm6om.fsf@WorkBox.Home> <>

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

> "Brandon J. Wandersee" <> 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.


::  Brandon J. Wandersee
::  --------------------------------------------------
::  'The best design is as little design as possible.'
::  --- Dieter Rams ----------------------------------

Want to link to this message? Use this URL: <>