"gpart add" falsely claiming "No space left on device"

Brandon J. Wandersee brandon.wandersee at gmail.com
Fri Sep 9 14:46:08 UTC 2016


Brandon J. Wandersee writes:

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

I should add that you *can* install the up-to-date documentation
manually, either from source (explained in the "Handbook") or with the
misc/freebsd-doc-* port/package. Replace '*' with your native
language. But since it looks like you're working on upgrading to 10.3,
just use the online docs.

>> 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 at gmail.com
::  --------------------------------------------------
::  'The best design is as little design as possible.'
::  --- Dieter Rams ----------------------------------


More information about the freebsd-questions mailing list