vermaden / lsblk

List information about block devices in the FreeBSD system.
BSD 2-Clause "Simplified" License
25 stars 2 forks source link

lsblk handling of spaces in GEOM labels #5

Closed EHWV closed 2 years ago

EHWV commented 2 years ago

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
vermaden commented 2 years ago

Hi,

try this one please:

Regards.

EHWV commented 2 years ago

Thanks!

vermaden commented 2 years ago

Does that mean it works properly now?

EHWV commented 2 years ago

Yes, this solves the "space" issue. Also correctly handles spaces in gpt label names (which gpt label names must allow):

gpart add -t freebsd-ufs -l "Free BLAH" da0 
vermaden commented 2 years ago

Ok, thanks for feedback and testing.

Regards.