Other glabel(8), gdisk(8), gpart(8), isovfy(8), lsblk, newfs(8); UFS and cd9660/iso9660 reportedly sharing the same space on a single device

Why does glabel list da8 continue to list stuff for da8 after the label has been cleared from da8?

Code:
root@mowa219-gjp4-8570p-freebsd:~ # lsblk da8
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da8              2:96  1.9G cd9660                iso9660/13_0_RELEASE_AMD64_BO -
root@mowa219-gjp4-8570p-freebsd:~ # tail -f -n 0 /var/log/messages
Aug 30 00:50:42 mowa219-gjp4-8570p-freebsd kernel: ugen0.12: <General UDisk> at usbus0 (disconnected)
Aug 30 00:50:42 mowa219-gjp4-8570p-freebsd kernel: umass5: at uhub6, port 2, addr 14 (disconnected)
Aug 30 00:50:42 mowa219-gjp4-8570p-freebsd kernel: da8 at umass-sim5 bus 5 scbus9 target 0 lun 0
Aug 30 00:50:42 mowa219-gjp4-8570p-freebsd kernel: da8: <General UDisk 5.00>  detached
Aug 30 00:50:42 mowa219-gjp4-8570p-freebsd kernel: (da8:umass-sim5:5:0:0): Periph destroyed
Aug 30 00:50:42 mowa219-gjp4-8570p-freebsd kernel: umass5: detached
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: ugen0.12: <General UDisk> at usbus0
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: umass5 on uhub6
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: umass5: <General UDisk, class 0/0, rev 2.00/1.00, addr 15> on usbus0
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: da8 at umass-sim5 bus 5 scbus9 target 0 lun 0
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: da8: <General UDisk 5.00> Removable Direct Access SCSI-2 device
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: da8: 40.000MB/s transfers
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: da8: 1911MB (3913728 512 byte sectors)
Aug 30 00:50:46 mowa219-gjp4-8570p-freebsd kernel: da8: quirks=0x2<NO_6_BYTE>
^C
root@mowa219-gjp4-8570p-freebsd:~ # lsblk da8
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da8              0:216 1.9G cd9660                iso9660/13_0_RELEASE_AMD64_BO -
root@mowa219-gjp4-8570p-freebsd:~ # glabel clear -v /dev/da8
Can't clear metadata on /dev/da8: Invalid argument.
glabel: Not fully done.
root@mowa219-gjp4-8570p-freebsd:~ # glabel clear -v da8
Can't clear metadata on da8: Invalid argument.
glabel: Not fully done.
root@mowa219-gjp4-8570p-freebsd:~ # geom disk list da8
Geom name: da8
Providers:
1. Name: da8
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   descr: General UDisk
   ident: (null)
   rotationrate: unknown
   fwsectors: 63
   fwheads: 255

root@mowa219-gjp4-8570p-freebsd:~ # glabel stop iso9660/13_0_RELEASE_AMD64_BO
root@mowa219-gjp4-8570p-freebsd:~ # glabel clear -v da8
Can't clear metadata on da8: Invalid argument.
glabel: Not fully done.
root@mowa219-gjp4-8570p-freebsd:~ # glabel clear -v /dev/da8
Can't clear metadata on /dev/da8: Invalid argument.
glabel: Not fully done.
root@mowa219-gjp4-8570p-freebsd:~ # gpart show -l da8
gpart: No such geom: da8.
root@mowa219-gjp4-8570p-freebsd:~ # fstyp /dev/da8
cd9660
root@mowa219-gjp4-8570p-freebsd:~ # gpart destroy da8
gpart: arg0 'da8': Invalid argument
root@mowa219-gjp4-8570p-freebsd:~ # glabel label -v confused /dev/da8
Metadata value stored on /dev/da8.
Done.
root@mowa219-gjp4-8570p-freebsd:~ # lsblk da8
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da8              0:216 1.9G cd9660                iso9660/13_0_RELEASE_AMD64_BO -
root@mowa219-gjp4-8570p-freebsd:~ # /usr/home/grahamperrin/dev/lsblk/lsblk da8
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da8              0:216 1.9G cd9660                iso9660/13_0_RELEASE_AMD64_BO -
root@mowa219-gjp4-8570p-freebsd:~ # glabel list da8
Geom name: da8
Providers:
1. Name: iso9660/13_0_RELEASE_AMD64_BO
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 3913728
   length: 2003828736
   index: 0
Consumers:
1. Name: da8
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0

root@mowa219-gjp4-8570p-freebsd:~ # glabel list | grep -B 3 -A 14 confused

Geom name: da8
Providers:
1. Name: label/confused
   Mediasize: 2003828224 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 3913727
   length: 2003828224
   index: 0
Consumers:
1. Name: da8
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0

root@mowa219-gjp4-8570p-freebsd:~ # glabel clear -v /dev/da8
Metadata cleared on /dev/da8.
Done.
root@mowa219-gjp4-8570p-freebsd:~ # glabel list | grep -B 3 -A 14 confused
root@mowa219-gjp4-8570p-freebsd:~ # glabel list da8
Geom name: da8
Providers:
1. Name: iso9660/13_0_RELEASE_AMD64_BO
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 3913728
   length: 2003828736
   index: 0
Consumers:
1. Name: da8
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0

root@mowa219-gjp4-8570p-freebsd:~ #
 
What's below (for a drive at da9) seems saner. What's above (for the drive that was at da8) continues to confuse me.

Code:
root@mowa219-gjp4-8570p-freebsd:~ # /usr/home/grahamperrin/dev/lsblk/lsblk da9
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da9              0:199 1.9G MBR                                               - -
  <FREE>         -:-   993K -                                                 - -
  da9s1          0:200 1.9G fat32lba                    msdosfs/UBCD%20LIVE%20V -
root@mowa219-gjp4-8570p-freebsd:~ # gpart destroy -F da9
da9 destroyed
root@mowa219-gjp4-8570p-freebsd:~ # /usr/home/grahamperrin/dev/lsblk/lsblk da9
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da9              0:199 1.9G -                                                 - -
root@mowa219-gjp4-8570p-freebsd:~ # glabel list da9
glabel: Class 'LABEL' does not have an instance named 'da9'.
root@mowa219-gjp4-8570p-freebsd:~ # geom disk list da9
Geom name: da9
Providers:
1. Name: da9
   Mediasize: 1993342976 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   descr: General UDisk
   ident: (null)
   rotationrate: unknown
   fwsectors: 63
   fwheads: 255

root@mowa219-gjp4-8570p-freebsd:~ #
 
Part of what confused me was the iso9660 file system label becoming visible only after destruction of the GPT.



The additional surprise is isovfy(1) reporting an error-free cd9660 file system (932 of 932 M used) after a new UFS file system is written.

Code:
root@mowa219-gjp4-8570p-freebsd:~ # gdd status=progress bs=10M of=/dev/da1 if=/Volumes/t500/VirtualBox/BSD/FreeBSD/FreeBSD-14.0-CURRENT-amd64-20210826-8d7cd10ba63-248938-disc1.iso
977600512 bytes (978 MB, 932 MiB) copied, 139 s, 7.0 MB/s
93+1 records in
93+1 records out
977600512 bytes (978 MB, 932 MiB) copied, 139.406 s, 7.0 MB/s
root@mowa219-gjp4-8570p-freebsd:~ # gpart destroy -F da1
da1 destroyed
root@mowa219-gjp4-8570p-freebsd:~ # gpart create -s gpt da1
da1 created
root@mowa219-gjp4-8570p-freebsd:~ # gpart add -t freebsd-ufs -i 1 da1
da1p1 added
root@mowa219-gjp4-8570p-freebsd:~ # newfs /dev/da1p1
/dev/da1p1: 1911.0MB (3913648 sectors) block size 32768, fragment size 4096
        using 4 cylinder groups of 477.75MB, 15288 blks, 61184 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 978624, 1957056, 2935488
root@mowa219-gjp4-8570p-freebsd:~ # isovfy /dev/da1
Root at extent 1028, 4096 bytes
[0 0]
[100 240]
[200 340]
[300 476]
[400 632]
[500 786]
[600 886]
[700 1813]
[800 1925]
[900 2400]
No errors found
root@mowa219-gjp4-8570p-freebsd:~ # fstyp /dev/da1
cd9660
root@mowa219-gjp4-8570p-freebsd:~ # gpart show -l da1
=>     40  3913648  da1  GPT  (1.9G)
       40  3913648    1  (null)  (1.9G)

root@mowa219-gjp4-8570p-freebsd:~ # gpart show da1
=>     40  3913648  da1  GPT  (1.9G)
       40  3913648    1  freebsd-ufs  (1.9G)

root@mowa219-gjp4-8570p-freebsd:~ # glabel list da1
Geom name: da1
Providers:
1. Name: iso9660/14_0_CURRENT_AMD64_CD
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   secoffset: 0
   offset: 0
   seclength: 3913728
   length: 2003828736
   index: 0
Consumers:
1. Name: da1
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0

root@mowa219-gjp4-8570p-freebsd:~ # /usr/home/grahamperrin/dev/lsblk/lsblk da1
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da1              0:189 1.9G GPT                                               - -
  da1p1          0:174 1.9G freebsd-ufs                                       - -
root@mowa219-gjp4-8570p-freebsd:~ # gdisk /dev/da1
GPT fdisk (gdisk) version 1.0.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): x

Expert command (? for help): z
About to wipe out GPT on /dev/da1. Proceed? (Y/N): y
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): y
root@mowa219-gjp4-8570p-freebsd:~ # /usr/home/grahamperrin/dev/lsblk/lsblk da1
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da1              0:189 1.9G cd9660                iso9660/14_0_CURRENT_AMD64_CD -
root@mowa219-gjp4-8570p-freebsd:~ # wipe -o | gdd status=progress bs=10M of=/dev/da1
138346496 bytes (138 MB, 132 MiB) copied, 18 s, 7.7 MB/s^C
0+2116 records in
0+2116 records out
138674176 bytes (139 MB, 132 MiB) copied, 18.0726 s, 7.7 MB/s
root@mowa219-gjp4-8570p-freebsd:~ # /usr/home/grahamperrin/dev/lsblk/lsblk da1
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da1              0:189 1.9G -                                                 - -
root@mowa219-gjp4-8570p-freebsd:~ # fstyp /dev/da1
fstyp: /dev/da1: filesystem not recognized
root@mowa219-gjp4-8570p-freebsd:~ # geom disk list da1
Geom name: da1
Providers:
1. Name: da1
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r0w0e0
   descr: General UDisk
   ident: (null)
   rotationrate: unknown
   fwsectors: 63
   fwheads: 255

root@mowa219-gjp4-8570p-freebsd:~ #
 
Last edited:
Supposedly erasing the content of the 1.9 G disk before making the 1.9 G UFS file system – without unmounting the 932 M read-only cd9660 file system on the same device:

Code:
root@mowa219-gjp4-8570p-freebsd:~ # df -h /media/General_UDisk_
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/da1      932M    932M      0B   100%    /media/General_UDisk_
root@mowa219-gjp4-8570p-freebsd:~ # man newfs
root@mowa219-gjp4-8570p-freebsd:~ # newfs -E /dev/da1p1
/dev/da1p1: 1911.0MB (3913648 sectors) block size 32768, fragment size 4096
        using 4 cylinder groups of 477.75MB, 15288 blks, 61184 inodes.
Erasing sectors [128...3913647]
super-block backups (for fsck_ffs -b #) at:
 192, 978624, 1957056, 2935488
root@mowa219-gjp4-8570p-freebsd:~ # df -h /media/General_UDisk_
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/da1      932M    932M      0B   100%    /media/General_UDisk_
root@mowa219-gjp4-8570p-freebsd:~ # isovfy /dev/da1
Root at extent 1028, 4096 bytes
[0 0]
[100 240]
[200 340]
[300 476]
[400 632]
[500 786]
[600 886]
[700 1813]
[800 1925]
[900 2400]
No errors found
root@mowa219-gjp4-8570p-freebsd:~ # fsck_ufs -y /dev/da1p1
** /dev/da1p1
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 2 used, 473819 free (27 frags, 59224 blocks, 0.0% fragmentation)

***** FILE SYSTEM IS CLEAN *****
root@mowa219-gjp4-8570p-freebsd:~ # gpart show da1
=>     40  3913648  da1  GPT  (1.9G)
       40  3913648    1  freebsd-ufs  (1.9G)

root@mowa219-gjp4-8570p-freebsd:~ # geom disk list da1
Geom name: da1
Providers:
1. Name: da1
   Mediasize: 2003828736 (1.9G)
   Sectorsize: 512
   Mode: r1w0e0
   descr: General UDisk
   ident: (null)
   rotationrate: unknown
   fwsectors: 63
   fwheads: 255

root@mowa219-gjp4-8570p-freebsd:~ #
 
Back
Top