Documentation
¶
Index ¶
- func IsCapable() bool
- func UUIDOfKernelName(name string) string
- func WithLogger(log *plog.Logger) funcopt.O
- type Sizes
- type T
- func (t T) Activate(ctx context.Context) error
- func (t T) AsBlkID() (string, error)
- func (t T) ContainsUUIDOrName(buff string) bool
- func (t *T) Create(ctx context.Context, level string, devs []string, spares int, layout string, ...) error
- func (t T) Deactivate(ctx context.Context) error
- func (t T) DevOverhead(ctx context.Context, devpath string) (int64, error)
- func (t T) Devices(ctx context.Context) (device.L, error)
- func (t T) DisableAutoActivation() error
- func (t T) Exists(ctx context.Context) (bool, error)
- func (t T) ExistsFresh(ctx context.Context) (bool, error)
- func (t T) IsActive(ctx context.Context) (bool, string, error)
- func (t T) IsAutoActivated() bool
- func (t T) KernelName() string
- func (t T) Remove(ctx context.Context) error
- func (t T) Resync(ctx context.Context) error
- func (t T) SetSize(ctx context.Context, perDev int64) error
- func (t T) Sizes(ctx context.Context) (Sizes, error)
- func (t T) String() string
- func (t T) UUID() string
- func (t T) Wipe(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UUIDOfKernelName ¶
UUIDOfKernelName returns the uuid of the array of kernel name, as "md127", from the udev link by uuid leading to it, empty when none does.
Types ¶
type Sizes ¶
type Sizes struct {
// Level is the raid level, to say which array cannot do what.
Level string
// State is what mdadm reports the array is: "clean", "active", and
// what it is missing or busy with when it is either of those and
// something else. An array is grown once it is whole, so this is what
// says whether it is.
State string
// Array is what the array device holds.
Array int64
// UsedDev is what the array uses on each member device. The array
// size divided by it is the number of members the size is made of:
// one for a raid1, n-1 for a raid5, n-2 for a raid6, n/copies for a
// raid10. Measuring it is how the rule of every level and every
// raid10 layout is had without enumerating them.
UsedDev int64
// Chunk is the stripe unit, which a member size has to be a whole
// number of on a striped level.
Chunk int64
}
Sizes are what an array hands out, what it uses on each of the members it hands it out from, and what it is doing while it does.
func (Sizes) IsWhole ¶
IsWhole says the array holds every member it is made of and is doing nothing to the space it already has.
mdadm grows a degraded array without a word, and the space that adds is as unprotected as the array it is added to: a raid5 missing a member grows onto members that have no parity for the new space and no member to rebuild it from. An array rebuilding, resyncing or reshaping is busy with what it holds, and is not asked for more while it is.
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (T) ContainsUUIDOrName ¶
func (T) DevOverhead ¶
DevOverhead is what the array keeps on a member before the data it hands out: its superblock, and the room left for a bitmap to grow into.
It is read from the metadata written when the array was made, so it does not change when a member grows. The gap between what a member holds and what the array uses on it would: a member grown ahead of the array reads as all overhead, and asking for it again compounds every pass.
func (T) DisableAutoActivation ¶
func (T) Exists ¶
Exists says a device holds a superblock of the array, a path of a multipath device aside: blkid reads a path from its buffers, which a write through the multipath device leaves stale, so a path goes on reporting a superblock zeroed or overwritten. The multipath device itself says what the LUN holds.
func (T) ExistsFresh ¶
ExistsFresh is Exists made sure of, for a provision about to create the array or to adopt it: the buffers of each device found are dropped, those of its paths included, and the device is probed again. A superblock zeroed from another node, or through another device, lingers in the buffers of this node blkid reads, and would be taken for an array to adopt. Status does not pay the price of the flushes.
func (T) IsAutoActivated ¶
func (T) KernelName ¶
KernelName returns the kernel name of the array, as "md127", the name /proc/mdstat gives it, while it is assembled: the target of its udev link by uuid, or of its link by name. It is empty when neither resolves to an md device, as an array stopped, or a node whose udev did not make the links.
func (T) SetSize ¶
SetSize sets the bytes the array uses on each of its member devices, which is how it is grown onto members that have grown.
It does not reshape: the members and the level stay as they are.