Check out my first novel, midnight's simulacra!

Growlight

From dankwiki
"Growlight logo"
Grow, baby, grow

Growlight is a powerful open source tool for visualizing and managing persistent storage under Linux, built atop Notcurses. It began life as Sprezzatech's system installation prep tool, designed for use with SprezzOS, but is now aimed at more mainstream (and non-defunct) distributions.

Debian installer

My talk, "proposing a new d-i disk preparation tool" at debconf21 introduces the idea of using growlight within the mainstream Debian Installer.

Some capabilities

Capability Version Helpers
CDROM_TIMED_MEDIA_CHANGE Linux 5.16
EFIstub setup efibootmgr
BLKGETDISKSEQ Linux 5.15
Discoverable partitions
NVMe-ZNS recognition Linux 5.9
exFAT support Linux 5.6, exfat-utils
Linux 5.6 "drivetemp" support Linux 5.6
Optane DCPMM device support ipmctl
Collect and display statistics 1.1.0 procfs
NVMe device support 1.0.5 nvme-cli
Pass stride_width and stripe parameters to mkfs.ext* 1.0.2 e2fsprogs (mkfs.ext*)
Make ZFS filesystems 1.0.1 zfs
Make jfs filesystems 1.0.3 mkfs.jfs
Make xfs filesystems 1.0.2 mkfs.xfs
Make HFS/HFS+ filesystems needs testing mkfs.hfs, mkfs.hfsplus
Filesystem signature wiping 1.0.2 wipefs
Create/manipulate MSDOS partition tables 1.0.2
Create/manipulate Apple Partition Maps Create added in 1.0.4
Create MD aggregates 1.0.2 mdadm
Create DM aggregates needs testing
MD / zpool aggregate scan + import 1.0.1 mdadm, zpool
Temperature sensing (where supported) 1.0.1 libatasmart
Rotation speed / Transport detection 1.0.1
Create ZFS zpools 1.0.1 zpool, zfs
Make ext2, ext3, ext4 filesystems 1.0.0 e2fsprogs (mkfs.ext*)
Make swap devices 1.0.0 mkswap
Labeled filesystem creation 1.0.0
Make vfat filesystems 1.0.0 mkfs.vfat
Create/manipulate GPT partition tables 1.0.0
Align partitions based off physical sector size 1.0.0
SMART status check 1.0.0 libatasmart
UEFI boot preparation (UEFI bootloader, ESP, /etc/fstab) 1.0.0 grub2
BIOS boot preparation (BIOS bootloader, /etc/fstab) 1.0.0 grub2

Partitions and the Linux kernel

When a disk's partitioning is changed, the kernel must be notified via an explicit ioctl() or sysfs operation.

  • From the command line: echo 1 | sudo tee -a /sys/block/<device>/device/rescan
  • From C: use the BLKRRPART or BLKPG ioctls
    • BLKRRPART is deprecated. It fails if any partition on the disk is in use, wheras BLKPG fails only if given invalid arguments, or attempting to modify a partition that is being used.

Growlight handles all of this for you, of course.

Identifying Block Devices

"A terminal running growlight-curses"
The growlight 1.0.1 release poster

Terminology!

  • UUID A 128-bit RFC 4122 number. Used in GPT for disks and partitions. Used in many filesystems.
  • WWN A 64- or 128-bit number associated with physical components. Makes use of IEEE OUIs.
  • Partition table: A structure describing logical volumes on a single disk
    • Disklabel An old (BSDish) name for a partition table
  • Superblock A filesystem's metadata, usually occupying the first few sectors
    • Sometimes backed up, sometimes multiple times.
  • Label A string of up to 16 bytes associated with a filesystem
    • Volume Label An old (DOSish) name for a filesystem label
  • Master Boot Record The first sector on a disk in a BIOS/MBR machine
    • Boot sector The first sector of a bootable partition

Thus:

  • A disk has a WWN, a model, and a serial number.
  • A GPT partition table has a UUID, sometimes called the disk GUID
    • but though there is only one per disk, it's a property of the GUID Partition Table
  • A MBR partition table has nothing, really.
  • A GPT partition has a UUID and a name of up to 36 UTF-16LE units
    • A GPT partition also has a 128-bit number for its partition type, but they're commonly defined
      • Thus UUID/GUID is really a misnomer, but whatever
      • 024DEE41-33E7-11D3-9D69-0008C781F39F -- MBR scheme
      • C12A7328-F81F-11D2-BA4B-00A0C93EC93B -- EFI system partition (ESP)
      • ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 -- basic data partition
      • A19D880F-05FC-4D3B-A006-743F0F84911E -- linux raid
      • etc...
  • A MBR partition once again has nothing, just an 8-bit type.
  • A filesystem probably has a label, and probably has a UUID. Depends on the filesystem.

Partition Tables

FIXME I think some of these values are wrong, maybe embarrassingly so

Table type Max disk size Max partition size Max partitions
MBR (CHS) 8GB 8GB 4 primary

OR 3 primary, 1 extended, arbitrarily many logical

MBR (LBA) 8TB 2TB 4 primary

OR 3 primary, 1 extended, arbitrarily many logical

GPT 9.4ZB 9.4ZB 128 * n
APM 2TB 2TB n, requiring n + 1 512-byte sectors

Unique Identification

It is useful to uniquely identify block devices in a persistent manner. Device topology and thus /dev entry naming can change dynamically -- devices can be moved between boots; hot pluggable drives can be attached and removed; media can be ejected and replaced or reinserted. For physical devices, the unique identification ought be associated with the physical device. For virtual devices, the unique identification ought be associated with the virtual device and its component devices.

  • Hard drives: Most SAS, FC and ATA drives have a WWN/WWID burned in. These identifiers are 8 or 16 bytes (64 or 128 bits).
    • NAA1: 8 bytes, composed of 00010000:00000000 followed by a MAC-48 (10:00:xx:xx:xx:xx:xx:xx)
    • NAA2: 8 bytes, composed of 0010vvvv:vvvvvvvv (the 24 v bits are vendor-defined), followed by a MAC-48 (2v:vv:xx:xx:xx:xx:xx:xx)
    • ... FIXME
  • Fibre Channel ports and switches: WWSN / WWPN. The WWSN/WWPN namespaces overlap one another and the WWN space.
  • MD devices: 16-byte UUID
  • ZFS zpools: 16-byte UUID

Resources

Note that even using DMI 2.0, a 4x southbridge uplink can be supersaturated by four SATA3 devices.

Interface Max theoretical bandwidth x2 x4
SATA 1.5 Gbps (187.5 MB/s) 3 6
SATA 2 3 Gbps (375 MB/s) 6 12
SATA 3 6 Gbps (750 MB/s) 12 24
SAS 2.4 Gbps (300 MB/s) 4.8 9.6
SAS 2 4.8 Gbps (600 MB/s) 9.6 19.2
SAS 3 9.6 Gbps (1.2 GB/s) 19.2 38.4
USB 1.1 12 Mbps (1.5 MB/s) n/a n/a
USB 2 .48 Gbps (60 MB/s) n/a n/a
USB 3 5 Gbps (625 MB/s) n/a n/a
PCIe lane 2 Gbps (250 MB/s) 4 8
PCIe 2.0 lane 4 Gbps (500 MB/s) 8 16
PCIe 3.0 lane 8 Gbps (1 GB/s) 16 32
DMI lane n/a 5 10
DMI 2.0 lane n/a 10 20
DMI 3.0 lane n/a 20 40

Quick Path Interconnect (QPI) works at different frequencies and usually employs 20 lanes.

8 SATAII devices on 8xPCIe 2.0: 3GB/s on 4GB/s ✔
LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] (rev 03)
 [0:0:0:0]    disk    ATA      ST2000DL003-9VT1 CC3C 
 [0:0:1:0]    disk    ATA      ST2000DL003-9VT1 CC3C
 [0:0:2:0]    disk    ATA      ST2000DL003-9VT1 CC32
 [0:0:3:0]    disk    ATA      ST2000DL003-9VT1 CC3C
 [0:0:4:0]    disk    ATA      INTEL SSDSA2M080 02HD
 [0:0:5:0]    disk    ATA      WDC WD20EARS-00M 51.0
 [0:0:6:0]    disk    ATA      WDC WD20EARS-00M 51.0
 [0:0:7:0]    disk    ATA      ST2000DL003-9VT1 CC32

2 SATAIII devices on 1xPCIe 2.0: 1.5GB/s on 500MB/s ✘
Marvell Technology Group Ltd. 88SE9120 SATA 6Gb/s Controller (rev 12)
[10:0:0:0]    disk    ATA      ST2000DL003-9VT1 CC32
[11:0:0:0]    disk    ATA      ST3000DM001-9YN1 CC9C

1 SATAII device on USB 2.0: 375MB/s on 480MB/s ✔−
Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
[19:0:0:0]    disk    HTC      Android Phone    0100

1 SATAIII device +
1 SATAII device on 1xPCIe 2.0: 1.125GB/s on 500MB/s ✘
Marvell Technology Group Ltd. 88SE9123 PCIe SATA 6.0 Gb/s controller (rev 11)
 [2:0:0:0]    disk    ATA      INTEL SSDSA2CW12 0302
 [3:0:0:0]    disk    ATA      ST2000DL003-9VT1 CC32

4 SATAII devices +
1 SATAIII-on-SATAII device (✘) on PCI 2.0 PCH (?)
Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller (rev 05)
 [4:0:0:0]    disk    ATA      ST9320423AS      SDM1
 [5:0:0:0]    disk    ATA      ST9320423AS      SDM1
 [6:0:0:0]    cd/dvd  ATAPI    iHBS112   2      CL0F
 [7:0:0:0]    disk    ATA      WDC WD20EARX-00P 51.0
 [9:0:0:0]    disk    ATA      ST3000DM001-9YN1 CC9C


1 MDRAID6
1 MDRAID1
1 ZRAID2

Definite Goals

Disks

  • Fully support ZFS during install, include RAIDZ setup
  • Use GPT (correctly) by default.
  • Extract true parameters from SSDs and 4k sector (especially WD-EARS) drives
  • Properly align everything