md

package
v3.0.0-rc49 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCapable

func IsCapable() bool

func WithLogger

func WithLogger(log *plog.Logger) funcopt.O

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

func (t Sizes) IsWhole() bool

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 New

func New(name string, uuid string, opts ...funcopt.O) *T

func (T) Activate

func (t T) Activate(ctx context.Context) error

func (T) AsBlkID

func (t T) AsBlkID() (string, error)

func (T) ContainsUUIDOrName

func (t T) ContainsUUIDOrName(buff string) bool

func (*T) Create

func (t *T) Create(ctx context.Context, level string, devs []string, spares int, layout string, chunk *int64, bitmap string) error

func (T) Deactivate

func (t T) Deactivate(ctx context.Context) error

func (T) DevOverhead

func (t T) DevOverhead(ctx context.Context, devpath string) (int64, error)

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) Devices

func (t T) Devices(ctx context.Context) (device.L, error)

func (T) DisableAutoActivation

func (t T) DisableAutoActivation() error

func (T) Exists

func (t T) Exists(ctx context.Context) (bool, error)

func (T) IsActive

func (t T) IsActive(ctx context.Context) (bool, string, error)

func (T) IsAutoActivated

func (t T) IsAutoActivated() bool

func (T) Remove

func (t T) Remove(ctx context.Context) error

func (T) Resync

func (t T) Resync(ctx context.Context) error

func (T) SetSize

func (t T) SetSize(ctx context.Context, perDev int64) error

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.

func (T) Sizes

func (t T) Sizes(ctx context.Context) (Sizes, error)

Sizes reads what the array hands out and what it uses on each member.

func (T) String

func (t T) String() string

func (T) UUID

func (t T) UUID() string

func (T) Wipe

func (t T) Wipe(ctx context.Context) error

Jump to

Keyboard shortcuts

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