Why is lsblk not included in base install?

Code:
> lsblk
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0 0:108 466G - - -
diskinfo: /dev/ada1: Permission denied
It's not giving the error on ada0 (though there seems to be some information missing), it does get a permission error on ada1. What's the difference of these disks?

As for the partition size discrepancy, I suspect it's this bit of code:
Code:
  # READ PARTITIONS OF PROVIDER
  local GPART=$( gpart show -p ${DEV} 2> /dev/null | sed -E 's-\[.*\]--g' | sed 's|=>||g' )
  # PARSE gpart(8) OUTPUT
  echo "${GPART}" \
    | while read BEG END NAME TYPE SIZE SIZE_FREE
      do
There's no SIZE_FREE in the gpart show -p .... output. So everything gets shifted because it reads one value too many.
 
vermaden there's something wrong with lsblk lately.

Firstly, it started demanding root credentials to display disk sizes.

Secondly, it no longer displays partition sizes, it just prints the entire device size per each partition. (if the device size is 16G, then it'll just say 16G for each individual partition on that device).
kern.securelevel : -1
no root needed for me , partition sizes are shown for me.
 
Seems odd with 59G on EFI (pretty sure a 64GB SD card) on 15.1:
Code:
DEVICE         MAJ:MIN  SIZE TYPE                                    LABEL MOUNT
mmcsd0           0:78    59G MBR                                         - -
  <FREE>         -:-    993K -                                           - -
  mmcsd0s1       0:79    59G fat32lba                          msdosfs/EFI /boot/efi
  mmcsd0s2       0:80    59G BSD                               gpt/freebsd -
    <FREE>       -:-     64K -                                           - -
    mmcsd0s2a    0:83    53G freebsd-ufs                        ufs/rootfs /
    mmcsd0s2b    0:84   5.9G freebsd-swap                label/growfs_swap SWAP
  <FREE>         -:-    2.0M -

Was more odd on CURRENT a few weeks ago:
Code:
DEVICE         MAJ:MIN  SIZE TYPE                                    LABEL MOUNT
nda0             0:82   954G GPT                                         - -
  nda0p1         0:84   954G efi                                   gpt/efi /boot/efi
  nda0p2         0:86   954G freebsd-ufs                   gpt/freebsd-ufs /
  nda0p3         0:88   954G freebsd-swap                 gpt/freebsd-swap SWAP
 
Hmm, think I might know why diskinfo(8) works for me on some systems but not others. On the systems where it works my user is a member of the operator group, on the systems where it doesn't work the account wasn't added to operator. That makes sense, permissions on the device give the operator group read access.
 
Hmm, think I might know why diskinfo(8) works for me on some systems but not others. On the systems where it works my user is a member of the operator group, on the systems where it doesn't work the account wasn't added to operator. That makes sense, permissions on the device give the operator group read access.
That's a recent change? It was working fine for me before without the user being part of the operator group.
 
Seems odd with 59G on EFI (pretty sure a 64GB SD card) on 15.1:
Code:
DEVICE         MAJ:MIN  SIZE TYPE                                    LABEL MOUNT
mmcsd0           0:78    59G MBR                                         - -
  <FREE>         -:-    993K -                                           - -
  mmcsd0s1       0:79    59G fat32lba                          msdosfs/EFI /boot/efi
  mmcsd0s2       0:80    59G BSD                               gpt/freebsd -
    <FREE>       -:-     64K -                                           - -
    mmcsd0s2a    0:83    53G freebsd-ufs                        ufs/rootfs /
    mmcsd0s2b    0:84   5.9G freebsd-swap                label/growfs_swap SWAP
  <FREE>         -:-    2.0M -

Was more odd on CURRENT a few weeks ago:
Code:
DEVICE         MAJ:MIN  SIZE TYPE                                    LABEL MOUNT
nda0             0:82   954G GPT                                         - -
  nda0p1         0:84   954G efi                                   gpt/efi /boot/efi
  nda0p2         0:86   954G freebsd-ufs                   gpt/freebsd-ufs /
  nda0p3         0:88   954G freebsd-swap                 gpt/freebsd-swap SWAP
Yeah, something is going on with partition size reporting.
 
User is in operator group, securelevel=0
Code:
$ gpart show -p                                                                   
=>       40  500118112    nda0  GPT  (238G)
         40     532480  nda0p1  efi  (260M)
     532520  490201088  nda0p2  freebsd-ufs  (234G)
  490733608    8388608  nda0p3  freebsd-swap  (4.0G)
  499122216     995936          - free -  (486M)

$ lsblk
DEVICE         MAJ:MIN  SIZE TYPE                                    LABEL MOUNT
nda0             0:108  238G GPT                                         - -
  nda0p1         0:110  238G efi                              gpt/efiboot0 /boot/efi
  nda0p2         0:112  238G freebsd-ufs                         gpt/root0 /
  nda0p3         0:114  238G freebsd-swap                        gpt/swap0 -
  <FREE>         -:-    486M -
 
Recently...mmm, maybe starting a couple of months ago.

> lsblk
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0 0:108 466G - - -
diskinfo: /dev/ada1: Permission denied

And it used to show size of each partition, if I'm not mistaken. Even in some outputs in this thread I seen that.
Add yourself to the operator group - then You will have read permission for disk devices in /dev and will be able to use lsblk(8) as regular user.

Code:
% ls -l /dev/nda*
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda0
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda0p1
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda0p2
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda0p3
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda0p4
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda0p4.eli
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda1
crw-r----- root operator 0 B 2026/07/20 22:02  /dev/nda1p1
crw-r----- root operator 0 B 2026/07/20 22:03  /dev/nda1p1.eli
 
Do you trust yourself?

That's not a joke, but a serious question. Are you likely to do something stupid or ill considered? If yes, restrict your account as much as you like; having to use su/sudo/doas before is a little barrier, which gives you a little more time to think about the consequences of your actions.

My account on my server is NOT in the operator group.
 
Is it safe to add yourself to the operator group, especially just to run lsblk?
Why do you want to run lsblk? gpart gives you everything you need (also, major:minor numbers that lsblk reports is not of much use if any on freebsd. Originally major was used as an index into a blockdev or chardev table when drivers were compiled in. Originally the operator group was to allow any one in the operator to mount/unmount disk/tapes and not much else. You certainly can add yourself to the operator group on your own machine).
 
I add operator on desktop for xfce whiskermenu buttons to work, but don't know if it's useful anywhere else (I don't add it on server)

I like lsblk output for notes but get more use with df -Ht
 
Vermaden, lsblk sum of partition sizes presented + free does not add up to total disk size as it should.

You are right ... probably when I was trying to fix other issue I introduced 'new' bug - will take a look into it - thank You for finding and sharing this.



Code:
% gpart show nda0
=>        40  1000215136  nda0  GPT  (477G)
          40      532480     1  efi  (260M)
      532520        1024     2  freebsd-boot  (512K)
      533544         984        - free -  (492K)
      534528     4194304     3  freebsd-swap  (2G)
     4728832   995485696     4  freebsd-zfs  (475G)
  1000214528         648        - free -  (324K)

% lsblk nda0
DEVICE         MAJ:MIN  SIZE TYPE                                    LABEL MOUNT
nda0             0:95   477G GPT                                         - -
  nda0p1         0:97   477G efi                              gpt/efiboot0 -
  nda0p2         0:99   477G freebsd-boot                     gpt/gptboot0 -
  <FREE>         -:-    492K -                                           - -
  nda0p3         0:101  477G freebsd-swap                        gpt/swap0 -
  nda0p4         0:103  477G freebsd-zfs                   gpt/freebsd-zfs <ZFS>
  nda0p4.eli     0:110  477G zfs                                         - -
  <FREE>         -:-    324K -                                           - -
 
Back
Top