Documentation ¶
Overview ¶
Package block contains functions dealing with linux block devices and the underlying hardware.
Index ¶
- Variables
- func AllBlockDevs() []string
- func BFiltNotRecovery(bi BlkInfo) bool
- func DFiltOnlyParts(dir, relpath string) bool
- func DFiltOnlyUsb(_, relpath string) bool
- func DFiltOnlyUsbParts(dir, relpath string) bool
- func FilterBlockDevs(filter DevIncludeFn) []string
- func IsDev(dev string) bool
- func IsPart(dev string) bool
- func PartNum(dev string) string
- func PartParent(dev string) string
- func ReadModel(dev string) (m string, err error)
- func ReadSize(dev string) (devSize uint64, err error)
- func ReadVendor(dev string) (v string, err error)
- func SizeToleranceMatch(have, want, tol uint64) bool
- type BlkIncludeFn
- type BlkInfo
- type BlockDev
- type DevIncludeFn
- type FsType
Constants ¶
This section is empty.
Variables ¶
var Verbose bool
Functions ¶
func AllBlockDevs ¶
func AllBlockDevs() []string
Return a path for each non-virtual block device. Unlike Devices(), include partitions.
func BFiltNotRecovery ¶
func DFiltOnlyParts ¶
func DFiltOnlyUsb ¶
func DFiltOnlyUsbParts ¶
func FilterBlockDevs ¶
func FilterBlockDevs(filter DevIncludeFn) []string
like AllBlockDevs, but uses a filter function to limit the results
func PartParent ¶
PartParent returns the parent block device for the given partition. Does not check if dev is actually a partition.
func ReadModel ¶
given a dev like '/dev/sda', find device model string for sata, 'model' file includes vendor as well
func ReadVendor ¶
for sata, always returns ATA for scsi, ??? for usb, returns actual vendor
func SizeToleranceMatch ¶
SizeToleranceMatch returns true if actual value is within tolerance of desired value. Tolerance is expressed as an integer 1-100, representing a percent.
Types ¶
type BlkIncludeFn ¶
a function that returns false if given bi should be filtered out
type BlkInfo ¶
type BlkInfo struct { FsType FsType UUID string Partition bool PartUUID string Label string Usage string Device string }
func GetFilesystems ¶
func GetFilesystems(blkfilter BlkIncludeFn, devfilter DevIncludeFn) []BlkInfo
return a BlkInfo for each blockdevice containing a filesystem we recognize
type DevIncludeFn ¶
A function that returns true if the entry is to be kept. relpath is relative to dir, which is likely /sys/class/block.
Directories ¶
Path | Synopsis |
---|---|
Package md does various things with mdadm.
|
Package md does various things with mdadm. |
Package partitioning allows creation of MBR and GPT partition tables and partitions, DESTROYING ANY EXISTING DATA.
|
Package partitioning allows creation of MBR and GPT partition tables and partitions, DESTROYING ANY EXISTING DATA. |