Documentation ¶
Index ¶
- Variables
- func GetBlockSize(device string, sysfsPath string) (int, error)
- func GetRAIDDeviceWithName(ctx context.Context, executor exec.Interface, devtmpfsPath, name string) (string, error)
- func MakeFS(ctx context.Context, executor exec.Interface, device string, blockSize int, ...) (bool, error)
- func MakeRAID0(ctx context.Context, executor exec.Interface, ...) (changed bool, err error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrRAIDNotFound = fmt.Errorf("cannot find raid device")
)
Functions ¶
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.
Types ¶
This section is empty.