Re: `gpart show` and secondary GPT header

From: Marcel Moolenaar <xcllnt_at_mac.com>
Date: Sat, 13 Jun 2009 16:37:25 -0700
On Jun 13, 2009, at 11:53 AM, Alexander Best wrote:

> hi there,
>
> i already posted this message to freebsd-questions but didn't get  
> any reply.
> that's why i'm sending it to freebsd-current.
>
> i have a question about gpart. when id do `gpart show ad0` i get the  
> following
> output:
>
> =>       34  488394988  ad0  GPT  (233G)
>         34   20971486    1  freebsd-swap  (10G)
>   20971520  467423502    2  freebsd-ufs  (223G)
>
> which is just what i want. however i'm a bit curious about the GPT  
> header.
> only the primary header from 0 - 33 is being shown. what about the
> secondary/backup GPT header. is it present and just now shown by  
> gpart or
> doesn't it exist at all? if it's just not shown it would be great if  
> gpart had
> a verbose switch or something like that.

gpart(8) does not show headers at all. The first line
merely shows the first possible LBA that can be
assigned to a partition and the amount of space that
can be assigned (starting from the first LBA). This
information also applies to any other scheme, eg:

ns1% gpart show ad0
=>      63  80293185  ad0  MBR  (38G)
         63  80292807    1  freebsd  [active]  (38G)
   80292870       378       - free -  (189K)

ns1% gpart show ad0s1
=>       0  80292807  ad0s1  BSD  (38G)
          0   2097152      1  freebsd-ufs  (1.0G)
    2097152  16777216      2  freebsd-swap  (8.0G)
   18874368  16777216      4  freebsd-ufs  (8.0G)
   35651584  44641223      5  freebsd-ufs  (21G)


Typically the sector before the first allocatable
LBA and extending beyond the allocatable space are
used for metadata (i.e. the GPT headers), but that
may not be the case.

In any case: the primary and secondary GPT headers
and tables are in fact on the disk. They're there,
trust me :-)

>
> because in 7-STABLE e.g. `pt show ad0` also displays the secondary  
> GPT header
> at the end of the disk.

gpart(8) is unlike gpt(8) in having in-depth knowledge
of the on-disk representation. This is a deliberate
abstraction.

FYI,

-- 
Marcel Moolenaar
xcllnt_at_mac.com
Received on Sat Jun 13 2009 - 22:37:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:49 UTC