Coder Social home page Coder Social logo

lsblk's People

Contributors

vermaden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

kiela mfaridi1394

lsblk's Issues

LABEL persists while looping past GPT disks

When a disk is encountered which has no partition scheme, a diskid/DISK-* label is shown properly,
but on the next disk with GPT partitions the raw disk shows the label from the prior disk.
I have not tested with other types than GPT.

da3              0:138 373G -                  diskid/DISK-0QY4XMRA -
da4              0:201 186G GPT                diskid/DISK-0QY4XMRA -
  da4p1          0:251 512K freebsd-boot               gpt/gptboot2 -
  <FREE>         -:-   492K -                                     - -

I believe under __gpart_present() you simply need to blank the label variable as done with some other fields. After adding local LABEL="-" I see more the output I expected.

da3              0:138 373G -                  diskid/DISK-0QY4XMRA -
da4              0:201 186G GPT                                   - -
  da4p1          0:251 512K freebsd-boot               gpt/gptboot2 -
  <FREE>         -:-   492K -                                     - -

Many thanks, and best regards.

Wrong fstype detected for ZFS RAID-Z1

On FreeBSD 13.0 / amd64, I have 4 SATA disks (ada0, ada1, ada2, ada3) used in a ZFS RAID-Z1 filesystem :

$ sysctl kern.disks
kern.disks: ada5 ada4 ada3 ada2 ada1 ada0

$ zpool list -v
NAME                                             SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
tank                                            5.44T  2.78T  2.66T        -         -      -    51%  1.00x    ONLINE  -
  raidz1                                        5.44T  2.78T  2.66T        -         -      -  51.1%      -  ONLINE
    gpt/zfs                                         -      -      -        -         -      -      -      -  ONLINE
    gptid/6a63e7be-a817-4f48-d1e7-8eb51f2ab127      -      -      -        -         -      -      -      -  ONLINE
    gptid/3241c64a-282f-2449-d799-bb00de95ecb2      -      -      -        -         -      -      -      -  ONLINE
    gptid/dedca703-d054-67e9-8a8b-c79b3c4284ca      -      -      -        -         -      -      -      -  ONLINE

With your script lsblk, the FS type for the 4 disks/partitions is not detected properly, apple-zfs instead of freebsd-zfs :

./lsblk ada0
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
ada0             0:116 1.4T GPT                                               - -
  <FREE>         -:-   111K -                                                 - -
  ada0p1         0:117 1.4T apple-zfs                                   gpt/zfs -
  ada0p9         0:118 8.0M solaris-reserved   

Device path is incompatible with linux

In the Linux implementation, you need to specify the path to the device.

$ lsblk sda
lsblk: sda: not a block device
$ lsblk /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 223,6G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
└─sda2   8:2    0 223,1G  0 part /

In your implementation, specifying the /dev/ directory results in an error.

# lsblk ada0
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
ada0             0:106 932G GPT                                               - -
  ada0p1         0:108 512K freebsd-boot                                      - -
  <FREE>         -:-   492K -                                                 - -
  ada0p2         0:110 932G freebsd-zfs                                       - <ZFS>
  <FREE>         -:-   676K -                                                 - -
# lsblk /dev/ada0
NOPE: disk '/dev/ada0' does not exist in the system

Because of this, it is difficult to use lsblk in scripts running under both Linux and FreeBSD

fstat: /dev/fuse: No such file or directory

Hi!

I've just upgraded to 3.6 and I'm getting the following error:

# lsblk
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
ada0             0:101 233G GPT                                               - -
fstat: /dev/fuse: No such file or directory
  ada0p1         0:102 512K freebsd-boot                           gpt/gptboot0 -
  <FREE>         -:-   492K -                                                 - -
  ada0p2         0:103 2.0G freebsd-swap                              gpt/swap0 SWAP
  ada0p3         0:104 222G freebsd-zfs                                gpt/zfs0 <ZFS>
  <FREE>         -:-   9.3G -                                                 - -

This is caused by an unconditional use of /dev/fuse at https://github.com/vermaden/lsblk/blob/master/lsblk#L281

FreeBSD-12.2-STABLE with up-to-date ports collection.

Cheers,
ʝɛʑ

lsblk handling of spaces in GEOM labels

Hi, thanks for lsblk!

AFAIK spaces are allowed in GEOM labels; at least I haven't seen anything that prohibits it.
Kind regards,
Eric

[1] # lsblk --version

  ___     ___   ___ __       _ _ _____    
  \  \  __\__\__\  \  \  __ / / /     \   
   \  \/  __/    \  \  \/ // / /   .   \  
    \  \___ \  \  \  \_   \\ \ \    \  / 
     \___\__/\____/\___\/\_\\_\_\____\/  

lsblk 3.7 2021/08/28

[2] # lsblk da0
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da0              0:168  29G GPT                                               - -
  da0p1          0:171  29G freebsd-ufs                            gpt/FreeBLAH -
[3] # glabel list da0p1
Geom name: da0p1
Providers:
1. Name: gpt/FreeBLAH
   Mediasize: 31037808640 (29G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 60620720
   length: 31037808640
   index: 0
Consumers:
1. Name: da0p1
   Mediasize: 31037808640 (29G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0

[4] # glabel label "try BLAH" da0p1
[5] # lsblk da0
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da0              0:168  29G GPT                                               - -
  da0p1          0:171  29G freebsd-ufs                               label/try -
[6] # glabel list da0p1
Geom name: da0p1
Providers:
1. Name: label/try BLAH
   Mediasize: 31037808128 (29G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 60620719
   length: 31037808128
   index: 0
Consumers:
1. Name: da0p1
   Mediasize: 31037808640 (29G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0

[7] # glabel dump da0p1
Metadata on da0p1:
    Magic string: GEOM::LABEL
Metadata version: 2
           Label: try BLAH

[8] # glabel stop "try BLAH" 
[9] # lsblk da0
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da0              0:168  29G GPT                                               - -
  da0p1          0:171  29G freebsd-ufs                            gpt/FreeBLAH -
[10] # glabel clear da0p1
[11] # glabel list da0p1
Geom name: da0p1
Providers:
1. Name: gpt/FreeBLAH
   Mediasize: 31037808640 (29G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 60620720
   length: 31037808640
   index: 0
Consumers:
1. Name: da0p1
   Mediasize: 31037808640 (29G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.