disks

package
v1.11.4-beta.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRAIDNotFound = fmt.Errorf("cannot find raid device")
)

Functions

func GetBlockSize

func GetBlockSize(device string, sysfsPath string) (int, error)

func GetRAIDDeviceWithName

func GetRAIDDeviceWithName(ctx context.Context, executor exec.Interface, devtmpfsPath, name string) (string, error)

GetRAIDDeviceWithName finds a device path to the raid array with given name. Because mdadm - tool used for array creation - doesn't always use the name we provide, we need to find the device using several heuristics. Different versions of mdadm behaves differently, so there are multiple steps of it. 1. Try provided name, it could be direct reference to a device - if it exists, return it. 2. Try expected name and location /dev/md/name - if file exists, that's the device. 3. List /dev/disk/by-id/md-name-* files, if name we search for is a suffix, then the symlink points to the raid device. 4. Parse mdadm report and find the device by checking name stored in metadata. It supports passing either a name of raid device, or full /dev/md/name pattern.

func MakeFS

func MakeFS(ctx context.Context, executor exec.Interface, device string, blockSize int, fsType string) (bool, error)

func MakeRAID0

func MakeRAID0(ctx context.Context, executor exec.Interface, sysfsPath, devtmpfsPath, name string, devices []string, udevControlEnabled bool) (changed bool, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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