Documentation ¶
Overview ¶
Package blockdevice provides a library for working with block devices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingPartitionTable = errors.New("missing partition table")
ErrMissingPartitionTable indicates that the the block device does not have a partition table.
Functions ¶
This section is empty.
Types ¶
type BlockDevice ¶
type BlockDevice struct {
// contains filtered or unexported fields
}
BlockDevice represents a block device.
func Open ¶
func Open(devname string, setters ...Option) (bd *BlockDevice, err error)
Open initializes and returns a block device. TODO(andrewrynhard): Use BLKGETSIZE ioctl to get the size.
func (*BlockDevice) Close ¶
func (bd *BlockDevice) Close() error
Close closes the block devices's open file.
func (*BlockDevice) Device ¶
func (bd *BlockDevice) Device() *os.File
Device returns the backing file for the block device.
func (*BlockDevice) PartitionTable ¶
func (bd *BlockDevice) PartitionTable() (table.PartitionTable, error)
PartitionTable returns the block device partition table.
func (*BlockDevice) RereadPartitionTable ¶
func (bd *BlockDevice) RereadPartitionTable() error
RereadPartitionTable invokes the BLKRRPART ioctl to have the kernel read the partition table.
NB: Rereading the partition table requires that all partitions be unmounted or it will fail with EBUSY.
func (*BlockDevice) Reset ¶ added in v0.5.0
func (bd *BlockDevice) Reset() (err error)
Reset will reset a block device given a device name. Simply deletes partition table on device.
func (*BlockDevice) Size ¶
func (bd *BlockDevice) Size() (uint64, error)
Size returns the size of the block device in bytes.
Directories ¶
Path | Synopsis |
---|---|
xfs
Package xfs provides an interface to xfsprogs.
|
Package xfs provides an interface to xfsprogs. |
Package lba provides a library for working with Logical Block Addresses.
|
Package lba provides a library for working with Logical Block Addresses. |
Package table provides a library for working with block device partition tables.
|
Package table provides a library for working with block device partition tables. |
gpt
Package gpt provides a library for working with GPT partitions.
|
Package gpt provides a library for working with GPT partitions. |
gpt/header
Package header provides a library for working with GPT headers.
|
Package header provides a library for working with GPT headers. |
gpt/partition
Package partition provides a library for working with GPT partitions.
|
Package partition provides a library for working with GPT partitions. |