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, netbsd-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/59956: gpt(8): show human-readable units
Date: Tue, 03 Feb 2026 15:36:00 +0700

 I have this working now in a fashion which looks OK to me
 (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.)
 
 Nevertheless I have made some changes to the others as well,
 though when I play more I might limit some of that to verbose
 mode (gpt -v show ...).
 
 No doc on the changes yet of course, but that will come.
 
 A example, one table, shown 3 ways (the last is the traditional version):
 
 jacaranda$ ./gpt show -Ah ld1    # 'A' for "approximately"
   start     size  index  contents
       0     512B         PMBR
    512B     512B         Pri GPT header
    1.0K      16K         Pri GPT table
     17K     1.0M         Unused
    1.0M     255M      1  GPT part - EFI System
    256M     5.7G      2  GPT part - NetBSD FFSv1/FFSv2
    6.0G     1.0T      4  GPT part - NetBSD RAIDFrame component
    1.0T     992K         Unused
    1.0T     769G      5  GPT part - NetBSD ccd component
    1.8T      64G      3  GPT part - NetBSD swap
    1.8T      16K         Sec GPT table
    1.8T     512B         Sec GPT header
 jacaranda$ ./gpt show -h ld1
                start               size  index  contents
                    0               512B         PMBR
                 512B               512B         Pri GPT header
                   1K                16K         Pri GPT table
                  17K              1007K         Unused
                   1M               255M      1  GPT part - EFI System
                 256M       5G 767M 992K      2  GPT part - NetBSD FFSv1/FFSv2
        5G 1023M 992K             1T 32K      4  GPT part - NetBSD RAIDFrame component
                1T 6G               992K         Unused
           1T 6G 992K      769G 269M 32K      5  GPT part - NetBSD ccd component
         1T 775G 270M  63G 771M 71K 512B      3  GPT part - NetBSD swap
 1T 839G 17M 71K 512B                16K         Sec GPT table
 1T 839G 17M 87K 512B               512B         Sec GPT header
 jacaranda$ ./gpt show ld1
        start          size  index  contents
            0             1         PMBR
            1             1         Pri GPT header
            2            32         Pri GPT table
           34          2014         Unused
         2048        522240      1  GPT part - EFI System
       524288      12058560      2  GPT part - NetBSD FFSv1/FFSv2
     12582848    2147483712      4  GPT part - NetBSD RAIDFrame component
   2160066560          1984         Unused
   2160068544    1613260864      5  GPT part - NetBSD ccd component
   3773329408     133699727      3  GPT part - NetBSD swap
   3907029135            32         Sec GPT table
   3907029167             1         Sec GPT header
 
 And just in case idiocy is desired - decimal GB (etc):
 
 jacaranda$ ./gpt show -AH ld1
   start     size  index  contents
       0     512B         PMBR
    512B     512B         Pri GPT header
    1.0k      16k         Pri GPT table
     17k     1.0M         Unused
    1.0M     267M      1  GPT part - EFI System
    268M     6.2G      2  GPT part - NetBSD FFSv1/FFSv2
    6.4G     1.1T      4  GPT part - NetBSD RAIDFrame component
    1.1T     1.0M         Unused
    1.1T     826G      5  GPT part - NetBSD ccd component
    1.9T      68G      3  GPT part - NetBSD swap
    2.0T      16k         Sec GPT table
    2.0T     512B         Sec GPT header
 
 (Yes, that's a "2TB" M.2 NVME).
 
 Comments welcome (the other options, -l, -u, even -x to a degree (not with -A)
 all still work of course).
 
 kre
 


Home | Main Index | Thread Index | Old Index