Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Blockdevice ¶
type Blockdevice struct { Name string // device name Kname string // internal kernel device name Pkname string // internal parent kernel device name Path string // path to the device node MajMin string `json:"maj:min"` // major:minor device number Fsavail Num // filesystem size available Fssize Num // filesystem size in bytes Fstype string // filesystem type Fsused string // filesystem size used Fsusep string `json:"fsuse%"` // filesystem use percentage Fsver string // filesystem version Mountpoint string // path where the device is mounted Label string // filesystem LABEL UUID string // filesystem UUID Ptuuid string // partition table identifier (usually UUID) Pttype string // partition table type Parttype string // partition type code or UUID Parttypename string // partition type name Partlabel string // partition LABEL Partuuid string // partition UUID Partflags string // partition flags Ra json.Number // read-ahead of the devic Ro bool // read-only device Rm bool // removable device Hotplug bool // removable or hotplug device (usb, pcmcia, ...) Rota bool // rotational device Rand bool // adds randomness Model string // device identifier Serial string // disk serial number Size Num // size of the device in bytes State string // state of the device e.g. suspended, running, live Owner string // user name Group string // group name Mode string // device node permissions e.g. brw-rw---- Alignment json.Number // alignment offset Minio json.Number `json:"min-io"` // minimum I/O size Optio json.Number `json:"opt-io"` // optimal I/O size Physec json.Number `json:"phy-sec"` // physical sector size Logsec json.Number `json:"log-sec"` // logical sector size Sched string // I/O scheduler name e.g. mq-deadline Rqsize json.Number `json:"rq-size"` // request queue size Type string // device type e.g. loop, disk, part, crypt, lvm Discaln json.Number `json:"disc-aln"` // discard alignment offset Discgran json.Number `json:"disc-gran"` // discard granularity Discmax json.Number `json:"disc-max"` // discard max bytes Disczero bool `json:"disc-zero"` // discard zeroes data Wsame json.Number // write same max bytes Wwn string // unique storage identifier Hctl string // Host:Channel:Target:Lun for SCSI Tran string // device transport type e.g. usb, nvme Subsystems string // de-duplicated chain of subsystems e.g. block, block:scsi:usb:pci, block:nvme:pci Rev string // device revision Vendor string // device vendor Zoned string // zone model Dax bool // dax-capable device Children []Blockdevice }
Blockdevice JSON strruct with details for every device
func USBMountedPartitions ¶
func USBMountedPartitions() []Blockdevice
USBMountedPartitions returns all USB disk mounted partitions
func USBNotMountedPartitionOfLargestSize ¶
func USBNotMountedPartitionOfLargestSize() Blockdevice
USBNotMountedPartitionOfLargestSize .
func USBNotMountedPartitions ¶
func USBNotMountedPartitions() []Blockdevice
USBNotMountedPartitions returns all USB disk NOT mounted partitions
func (Blockdevice) HasPartitions ¶
func (b Blockdevice) HasPartitions() bool
HasPartitions checks if blockdevice has partitions
func (Blockdevice) IsMounted ¶
func (b Blockdevice) IsMounted() bool
IsMounted checks if blockdevice has mountpoint
func (Blockdevice) IsRunning ¶
func (b Blockdevice) IsRunning() bool
IsRunning checks if blockdevice is running
func (Blockdevice) IsUsbTran ¶
func (b Blockdevice) IsUsbTran() bool
IsUsbTran checks if blockdevices has USB as its transport
func (*Blockdevice) UnmarshalJSON ¶
func (b *Blockdevice) UnmarshalJSON(data []byte) error
UnmarshalJSON custom marshaling of the JSON fields
type Lsblk ¶
type Lsblk struct {
Blockdevices []Blockdevice
}
Lsblk main JSON struct to capture the output of `lsblk`
Click to show internal directories.
Click to hide internal directories.