jrm@

Daemon
Developer

Reaction score: 504
Messages: 1,219

I think you need to load the geom_part_bsd64 kernel module for GEOM to understand the DragonFlyBSD disklabel.
# kldload geom_part_bsd64

Indeed. Error checking is still warranted though.
Code:
jrm@bravo ~ % lsblk
DEVICE           MA:MI SIZE TYPE                      LABEL MOUNT
ada0              0:63 466G GPT                           - -
  <FREE>           -:- 3.0K -                             - -
  ada0p1          0:65 512K freebsd-boot             gpboot -
  <FREE>           -:- 492K -                             - -
  ada0p2          0:67 466G freebsd-ufs            gprootfs <UNMOUNTED>
  <FREE>           -:- 3.5K -                             - -
ada1              0:6a 149G MBR                           - -
  ada1s1          0:71 149G freebsd                       - -
    ada1s1a       0:74 768M dragonfly-ufs                 - <UNMOUNTED>
    ada1s1b       0:ac  16G dragonfly-swap                - <UNMOUNTED>
    ada1s1d       0:ae 132G dragonfly-hammer              - <UNMOUNTED>
    <FREE>         -:- 4.0K -                             - -
  <FREE>           -:-  10M -                             - -
 

jrm@

Daemon
Developer

Reaction score: 504
Messages: 1,219

I also notice ada0p2 0:67 466G freebsd-ufs gprootfs <UNMOUNTED> when
Code:
jrm@bravo ~ % mount | grep gprootfs
/dev/gpt/gprootfs on / (ufs, local, soft-updates)
 

Juha Nurmela

Well-Known Member

Reaction score: 121
Messages: 401

It still has trouble locating the mountpoint with the curve ball mounts from /dev/oddity/label. If I use the canonical /dev/da0p3 instead of /dev/gpt/TIKKU_3 for the usb stick, it shows up correctly.

This is 10.1-p10. No fstyp command. The /dev/msdosfs/MSDOSBOOT is a twin of /dev/mmcsd0s1, it's from an MBR formatted RaspberryPI-B image, type !12. Cameras also pop up in /dev/msdosfs.

Wait... My glabel output is garbled: The following would be ok, if I asked about mmcsd0, not da0.
Code:
hopo $ glabel list da0p3s1
Geom name: da0p3s1
Providers:
1. Name: msdosfs/MSDOSBOOT

hopo $ glabel list da0p3s2a
Geom name: da0p3s2a
Providers:
1. Name: ufs/rootfs
da0p3s1 or 2a should not exist. I might have broken it myself, by copying the rpi image to the stick swap for speed test or something. Apologies for wasting your time.

Juha

Zeroed the usb stick swap, replugged stick and card, now glabel behaves ok :)
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

@ junovitch
I will submit a request for a port, but I must rewrite it first, current version is work in progress.

I tried different approach with stats for each /dev/DEV variant but that does not show free space ... which is less useful.

I will now mix both approaches to provide the final version, give me several days ...
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

Please remind me, what does not work with current lsblk.sh script?
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

Latest version described and 'released' here:

Regards.
 

unitrunker

Aspiring Daemon

Reaction score: 252
Messages: 551

Latest version described and 'released' here:
Regards.
A brief man page would be great. Typing 'lsblk --help' (or -h or -?) produces some amusing output.
 

roccobaroccoSC

Aspiring Daemon

Reaction score: 226
Messages: 749

Hi,

as we all know there is no single command to show storage devices on FreeBSD system. Some grep(1) the dmesg(8) command, some check /var/run/dmesg.boot file, some try camcontrol(8) command and so on ... as I struggle to create any empathy for Linux systems I really like the lsblk(8) command and I always missed in in the FreeBSD land. As I got a free afternoon I started to write one from scratch and after several hours it works on my systems as designed. Below You will find the attached lsblk(8) implementation with BSD license and example outputs. As this is implementation from scratch we may come with better then lsblk name ... I hear your propositions ;)

If you have time, please test it on your systems and report bugs so I will be able to fix them.

It's attached to this thread as lsblk.sh.txt file as files with .sh extension are not allowed on this forum.

As this forum configuration CODE tags are useless (only up to two consecutive spaces allowed) check attached screenshot for formatted output -
lsblk.sh.examples.png also displayed below.

Regards,
vermaden
Way to go man! Why don't you create a port out of it?
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

A brief man page would be great. Typing 'lsblk --help' (or -h or -?) produces some amusing output.

Just added the -h/--h/-help/--help argument which displays usage with examples.

Here is how it looks.

6928
 

Alain De Vos

Son of Beastie

Reaction score: 762
Messages: 2,512

Interesting script, but the lsblk.sh script does not work perfectly on my system.
The mount column is not correct.
# lsblk.sh
da2p1 0:b0 5.5T freebsd-ufs 6T <UNMOUNTED>
whereas:
# mount
/dev/gpt/6T on /mnt/6T (ufs, local, noatime, noexec, nosuid, nosymfollow, read-only)
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

The lsblk.sh script does not work perfectly on my system.
The mount column is not correct.
# lsblk.sh
da2p1 0:b0 5.5T freebsd-ufs 6T <UNMOUNTED>
whereas:
# mount
/dev/gpt/6T on /mnt/6T (ufs, local, noatime, noexec, nosuid, nosymfollow, read-only)


Could you send me (can be non public) output of sh -x /full/path/to/lsblk.sh command? Thanks.
 

Alain De Vos

Son of Beastie

Reaction score: 762
Messages: 2,512

OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

It's rather lengthy,
lsblkoutput.txt :
mountoutput.txt

Thanks.

Could you also send me lsblk.sh output without sh -x and also glabel status output.
 

Alain De Vos

Son of Beastie

Reaction score: 762
Messages: 2,512

Here you go,

/home/x/my_scripts #./lsblk.sh

DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0 0:80 932G MBR - -
<FREE> -:- 1.0G - - -
ada0s3 0:89 378G freebsd dufs -
ada0s2 0:83 176G ntfs ntfsa <UNMOUNTED>
<FREE> -:- 188G - - -
ada0s4 0:8a 188G ntfs ntfsb <UNMOUNTED>
<FREE> -:- 728K - - -
ada1 0:81 119G MBR - -
<FREE> -:- 60G - - -
ada1s3 0:8b 60G linux-data - <UNMOUNTED>
<FREE> -:- 344K - - -
ada2 0:82 466G GPT - -
<FREE> -:- 3.0K - - -
ada2p1 0:8c 236K freebsd-boot fboot1 -
<FREE> -:- 1.8M - - -
ada2p2 0:8d 80G freebsd-ufs mybsdx /
<FREE> -:- 256K - - -
ada2p3 0:8e 17G freebsd-swap fswap1 SWAP
<FREE> -:- 768K - - -
ada2p4 0:8f 1.0G efi efi1 /
ada2p5 0:90 110G freebsd-ufs fbsd2 /
ada2p7 0:91 2.0G linux-data sharext2 /
ada2p8 0:92 2.0G ms-basic-data sharfat /
<FREE> -:- 100G - - -
ada2p10 0:93 110G openbsd-data odatswap /
<FREE> -:- 44G - - -
cd0 0:73 - - - -
da0 0:94 - - - -
da1 0:57 4.5T GPT - -
da1p4 0:af 4.5T openbsd-data 5T <UNMOUNTED>
<FREE> -:- 232K - - -
da2 0:58 5.5T GPT - -
da2p1 0:b0 5.5T freebsd-ufs 6T <UNMOUNTED>
<FREE> -:- 3.5K - - -

#glabel status
Name Status Components
ntfs/ntfsa N/A ada0s2
ufs/dufs N/A ada0s3
ntfs/ntfsb N/A ada0s4
gpt/fboot1 N/A ada2p1
gpt/efi1 N/A ada2p4
gpt/fbsd2 N/A ada2p5
gpt/sharfat N/A ada2p8
gpt/odatswap N/A ada2p10
gpt/5T N/A da1p4
gpt/6T N/A da2p1
gpt/sharext2 N/A ada2p7
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

Thank You.

I just added UPDATE 2 - Code Reorganization and 75% Rewrite to the List Block Devices on FreeBSD lsblk(8) Style article.

The 𝚕𝚜𝚋𝚕𝚔(𝟾) just got 75% code rewrite and 25% code reduction while having more comments.

Please report issues if there are any.

Regards.
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122

vermaden - you sir are on fire right now!

That older '1.0' lsblk.sh really needed that rework. In that '1.0' I found way too many ways to set/get these labels and mount points.

Now after all methods to set/get things are known it could be reworked into something elegant and well thought making '2.0' mature and stable ... I hope :)

... I just finally got a large block of free time :>

Regards.
 
OP
vermaden

vermaden

Son of Beastie

Reaction score: 1,787
Messages: 3,122


Great.
In the mean time I also added geli(8) support and reworked/fixed some of the internals regarding MOUNT and LABEL detection.

Grab the latest lsblk.sh at the same place.

Details in the 𝗨𝗣𝗗𝗔𝗧𝗘 𝟯 - 𝗔𝗱𝗱𝗲𝗱 𝗴𝗲𝗹𝗶(𝟴) 𝗦𝘂𝗽𝗽𝗼𝗿𝘁 at the bottom of 𝗟𝗶𝘀𝘁 𝗕𝗹𝗼𝗰𝗸 𝗗𝗲𝘃𝗶𝗰𝗲𝘀 𝗼𝗻 𝗙𝗿𝗲𝗲𝗕𝗦𝗗 𝗹𝘀𝗯𝗹𝗸(𝟴) 𝗦𝘁𝘆𝗹𝗲 article.

Preview below.

6936


Regards.
 

Alain De Vos

Son of Beastie

Reaction score: 762
Messages: 2,512

I don't know if it is supposed to work with fuse mounts

# /usr/local/bin/ntfs-3g -o ro /dev/ada0s2 /mnt/ntfs1
#/usr/local/bin/ntfs-3g -o ro /dev/ada0s4 /mnt/ntfs2

# mount
/dev/fuse on /mnt/ntfs1 (fusefs, local, read-only, synchronous)
/dev/fuse on /mnt/ntfs2 (fusefs, local, read-only, synchronous)

#./lsblk.sh
DEVICE MAJ:MIN SIZE TYPE LABEL MOUNT
ada0s2 0:83 176G ntfs ntfs/ntfsa -
ada0s4 0:8a 188G ntfs ntfs/ntfsb -

It returns no mountpoints
 

ralphbsz

Son of Beastie

Reaction score: 2,404
Messages: 3,281

Love the script.
But even better: How do you get the wild colors on your screen? I tried taking LSD, but it has side effects.
 

Alain De Vos

Son of Beastie

Reaction score: 762
Messages: 2,512

It looks like ntfs-3g does not keep record of the mounted block devices anywhere.
#mount only returns /dev/fuse
The only way to access it was this , I don't know if there is a a better way.
lsof | grep ntfs-3g | grep /dev/ada
 
Top