blkid

package
v2.0.0-...-f4a4030 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package blkid provides information about blockdevice filesystem types and IDs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedLock = errors.New("failed to acquire shared lock while probing blockdevice")
)

Common errors.

Functions

This section is empty.

Types

type Info

type Info struct {
	// Link to the block device, only if the probed file is a blockdevice.
	BlockDevice *block.Device

	// DevNo is the device number of the probed device.
	//
	// Only available if the probed file is a blockdevice.
	DevNo uint64

	// WholeDisk is true if the probed device is a whole disk.
	//
	// Only available if the probed file is a blockdevice.
	WholeDisk bool

	// Overall size of the probed device (in bytes).
	Size uint64

	// Sector size of the device (in bytes).
	SectorSize uint

	// Optimal I/O size for the device (in bytes).
	IOSize uint

	// ProbeResult is the result of probing the device.
	ProbeResult

	// Parts is the result of probing the nested filesystem/partitions.
	Parts []NestedProbeResult
}

Info represents the result of the probe.

func Probe

func Probe(f *os.File, opts ...ProbeOption) (*Info, error)

Probe returns the probe information for the specified file.

func ProbePath

func ProbePath(devpath string, opts ...ProbeOption) (*Info, error)

ProbePath returns the probe information for the specified path.

type NestedProbeResult

type NestedProbeResult struct {
	NestedResult
	ProbeResult

	Parts []NestedProbeResult
}

NestedProbeResult is a result of probing a nested filesystem/partition.

type NestedResult

type NestedResult struct {
	PartitionUUID  *uuid.UUID
	PartitionType  *uuid.UUID
	PartitionLabel *string
	PartitionIndex uint // 1-based index

	PartitionOffset, PartitionSize uint64
}

NestedResult is result of probing a nested filesystem/partition.

It annotates the ProbeResult with the partition information.

type ProbeOption

type ProbeOption func(*ProbeOptions)

ProbeOption is an option for probing.

func WithProbeLogger

func WithProbeLogger(logger *zap.Logger) ProbeOption

WithProbeLogger sets the logger for the probe.

func WithSkipLocking

func WithSkipLocking(skip bool) ProbeOption

WithSkipLocking skips locking blockdevices in shared mode.

type ProbeOptions

type ProbeOptions struct {
	// Logger to use for logging.
	Logger *zap.Logger
	// SkipLocking blockdevices in shared mode.
	SkipLocking bool
}

ProbeOptions is the options for probing.

type ProbeResult

type ProbeResult struct {
	Name  string
	UUID  *uuid.UUID
	Label *string

	BlockSize           uint32
	FilesystemBlockSize uint32
	ProbedSize          uint64
}

ProbeResult is a result of probing a single filesystem/partition.

Directories

Path Synopsis
internal
chain
Package chain provides a list of probers for different filesystems and volume managers.
Package chain provides a list of probers for different filesystems and volume managers.
filesystems/bluestore
Package bluestore probes Ceph bluestore devices.
Package bluestore probes Ceph bluestore devices.
filesystems/ext
Package ext probes extfs filesystems.
Package ext probes extfs filesystems.
filesystems/iso9660
Package iso9660 probes ISO9660 filesystems.
Package iso9660 probes ISO9660 filesystems.
filesystems/luks
Package luks probes LUKS encrypted filesystems.
Package luks probes LUKS encrypted filesystems.
filesystems/lvm2
Package lvm2 probes LVM2 PVs.
Package lvm2 probes LVM2 PVs.
filesystems/squashfs
Package squashfs probes Squash filesystems.
Package squashfs probes Squash filesystems.
filesystems/swap
Package swap probes Linux swapspaces.
Package swap probes Linux swapspaces.
filesystems/talosmeta
Package talosmeta probes Talos META partition.
Package talosmeta probes Talos META partition.
filesystems/vfat
Package vfat probes FAT12/FAT16/FAT32 filesystems.
Package vfat probes FAT12/FAT16/FAT32 filesystems.
filesystems/xfs
Package xfs probes XFS filesystems.
Package xfs probes XFS filesystems.
filesystems/zfs
Package zfs probes ZFS filesystems.
Package zfs probes ZFS filesystems.
magic
Package magic implements the magic number detection for files and block devices.
Package magic implements the magic number detection for files and block devices.
partitions/gpt
Package gpt probes GPT partition tables.
Package gpt probes GPT partition tables.
probe
Package probe defines common probe interfaces.
Package probe defines common probe interfaces.
utils
Package utils provides utility functions.
Package utils provides utility functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL