NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/59956: gpt(8): show human-readable units



The following reply was made to PR bin/59956; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/59956: gpt(8): show human-readable units
Date: Wed, 04 Feb 2026 09:31:22 +0700

     Date:        Tue,  3 Feb 2026 18:40:01 +0000 (UTC)
     From:        "Rob Whitlock via gnats" <gnats-admin%NetBSD.org@localhost>
     Message-ID:  <20260203184001.6F4981A923E%mollari.NetBSD.org@localhost>
 
   |  Human readable sizes are available when you add the -a option to gpt
   |  show.
 
 Yes, I know, that's what I meant when I said:
 
 	(note that the code always printed (a degree of) humanized
 	numbers when used as show -a, or show -[ib] arg, it is only
 	the simple "show" case (to print the entire GPT table) where
 	it never did.)
 
 though with -a it is only the size, not the start block (and even then,
 the human readable version is buried in the output, rather than in the
 size column).   With -i or -b (just show 1 partition) human readable
 versions are obvious already, using the same filesystem as used for the
 examples in the previous message:
 
 jacaranda$ gpt show -i 1 ld1
 Details for index 1:
 Start: 2048 (1M)
 Size: 522240 (255M)
 Type: efi (c12a7328-f81f-11d2-ba4b-00a0c93ec93b)
 GUID: 2065f874-8e2c-4475-a4b1-e8e5e2de54dc
 Label: NetBSD_EFI_1
 Attributes: None
 
 All this is also why, in my previous message, I only gave examples for
 the simple "show" case (none of -a -i -b used), as that's the case I
 assume that Taylor intended to be able to change - that's the example that
 is in the PR which requests "if this could show ...", so that's what
 I have concentrated upon.   Currently the -i/-b (same thing, different
 way to select the partition) output is unchanged, and with -a the only
 real useful change I have made is to properly align the data column, the
 existing code "just knows" how wide the start/size/index columns will be,
 and when it is wrong, things like:
 
                                  Attributes: None
   34539643788      9216000     19  GPT part - NetBSD FFSv1/FFSv2
                                  Type: ffs
                                  TypeID: 49f48d5a-b10e-11dc-b99b-0019d1879648
                                  GUID: c15437e4-5b80-476f-8b0a-d6ba6b84789a
                                  Size: 4500 M
 
 appeared (this from a different, bigger, filesystem).
 That I have corrected, it will now be:
 
                                    Attributes: None
   34539643788      9216000     19  GPT part - NetBSD FFSv1/FFSv2
                                    Type: ffs
                                    TypeID: 49f48d5a-b10e-11dc-b99b-0019d1879648
                                    GUID: c15437e4-5b80-476f-8b0a-d6ba6b84789a
                                    Size: 4500 M (4718592000)
 
 The extra number in () in the Size: line is the partition size in bytes.
 Then with -h added, it has more precise human readable data added:
 
                                    Attributes: None
   34539643788      9216000     19  GPT part - NetBSD FFSv1/FFSv2
                                    Type: ffs
                                    TypeID: 49f48d5a-b10e-11dc-b99b-0019d1879648
                                    GUID: c15437e4-5b80-476f-8b0a-d6ba6b84789a
                                    Size: 4500 M (4718592000) = 4G 404M
 
 though I actually doubt that will see much use.   Whether the start/size
 columns in -a output should be modified, I haven't decided, but I suspect
 probably not (they could be, that would be easy to do now.)
 
 Opinions remain welcome - now is the best time to request something different
 (ie: before I write doc!)
 
 kre
 


Home | Main Index | Thread Index | Old Index