Documentation ¶
Overview ¶
Package disk provides utility method for disk listing and searching using /sys/block data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Disk ¶
type Disk struct { // Size disk size in bytes. Size uint64 // Model from /sys/block/*/device/model. Model string // DeviceName device name (e.g. /dev/sda). DeviceName string // Name /sys/block/<dev>/device/name. Name string // Serial /sys/block/<dev>/device/serial. Serial string // Modalias /sys/block/<dev>/device/modalias. Modalias string // WWID /sys/block/<dev>/wwid. WWID string // UUID /sys/block/<dev>/uuid. UUID string // Type is the disk type: HDD, SSD, SD card, NVMe drive. Type Type // BusPath PCI bus path. BusPath string // SubSystem is the dest path of symlink /sys/block/<dev>/subsystem. SubSystem string // ReadOnly indicates that the kernel has marked this disk as read-only. ReadOnly bool }
Disk reresents disk information obtained by reading /sys/block.
type Matcher ¶
Matcher is a function that can handle some custom disk matching logic.
func WithModalias ¶
WithModalias select disk with modalias.
Click to show internal directories.
Click to hide internal directories.