Documentation
¶
Index ¶
- Constants
- func ClearBlock(blockPath string, blockOffset int64) error
- func DiskBlockSize(path string) (uint32, error)
- func DiskFSType(pathName string) (string, error)
- func DiskFSUUID(pathName string) (string, error)
- func DiskSizeBytes(blockDiskPath string) (int64, error)
- func GetDiskDevicePath(diskNamePrefix string, diskPathFilter devicePathFilterFunc) (string, error)
- func GetDisksByID(filterPrefix string) ([]string, error)
- func LoopDeviceSetupAlign(sourcePath string) (string, error)
- func RefreshDiskDeviceSize(ctx context.Context, diskPath string) error
- func WaitDiskDeviceGone(ctx context.Context, diskPath string) bool
- func WaitDiskDevicePath(ctx context.Context, diskNamePrefix string, ...) (string, error)
- func WaitDiskDeviceResize(ctx context.Context, diskPath string, newSizeBytes int64) error
Constants ¶
const DevDiskByID = "/dev/disk/by-id"
DevDiskByID represents the system's path for disks identified by their ID.
Variables ¶
This section is empty.
Functions ¶
func ClearBlock ¶
ClearBlock fully resets a block device or disk file using the most efficient mechanism available. For files, it will truncate them down to zero and back to their original size. For blocks, it will attempt a variety of discard options, validating the result with marker files and eventually fallback to full zero-ing.
An offset can be specified to only reset a part of a device.
func DiskBlockSize ¶
DiskBlockSize returns the physical block size of a block device.
func DiskFSType ¶
DiskFSType detects the filesystem type of the block device.
func DiskFSUUID ¶
DiskFSUUID returns the UUID of a filesystem on the device. An empty string is returned in case of a pristine disk.
func DiskSizeBytes ¶
DiskSizeBytes returns the size of a block disk (path can be either block device or raw file).
func GetDiskDevicePath ¶
GetDiskDevicePath checks whether the disk device with a given prefix and suffix exists in /dev/disk/by-id directory. A device path is returned if the device is found, otherwise an error is returned.
func GetDisksByID ¶
GetDisksByID returns all disks whose ID contains the filter prefix.
func LoopDeviceSetupAlign ¶
LoopDeviceSetupAlign creates a forced 512-byte aligned loop device.
func RefreshDiskDeviceSize ¶
RefreshDiskDeviceSize refreshes ISCSI multipath device-mapper device size.
func WaitDiskDeviceGone ¶
WaitDiskDeviceGone waits for the disk device to disappear from /dev/disk/by-id. It periodically checks for the device to disappear and returns once the device is gone. If the device does not disappear within the timeout, an error is returned.
func WaitDiskDevicePath ¶
func WaitDiskDevicePath(ctx context.Context, diskNamePrefix string, diskPathFilter devicePathFilterFunc) (string, error)
WaitDiskDevicePath waits for the disk device to appear in /dev/disk/by-id. It periodically checks for the device to appear and returns the device path once it is found. If the device does not appear within the timeout, an error is returned.
Types ¶
This section is empty.