diskfill

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package diskfill fills a volume, so a chaos run can make a disk full without writing anything of the server's or a worker's own. It writes a ballast file that leaves a chosen amount of free space, and optionally empty files that use up the volume's inodes, and removes both again. Fill is supported only on Linux, the one OS a disk_full fault runs on.

Index

Constants

View Source
const (
	// BallastName is the file that takes up the volume's free space.
	BallastName = ".sqiload-ballast"
	// InodesName is the directory of empty files that take up its inodes.
	InodesName = ".sqiload-inodes"
)

The names Fill writes under the directory it is given.

Variables

View Source
var ErrUnsupported = errors.New("diskfill: filling a volume is supported only on Linux")

ErrUnsupported is what Fill returns off Linux.

Functions

This section is empty.

Types

type Ballast

type Ballast struct {
	// contains filtered or unexported fields
}

Ballast is what Fill wrote on one volume.

func Adopt

func Adopt(dir string) *Ballast

Adopt returns the Ballast for whatever an earlier Fill left in dir, so a later process can free it. Freeing a directory Fill never wrote to removes nothing.

func Fill

func Fill(dir string, headroom int64, inodes bool) (*Ballast, error)

Fill writes a ballast file under dir (BallastName) sized to the volume's free space (statfs Bavail*Bsize) minus headroom, preallocated when the file system allows it and written otherwise. With inodes it then creates empty files under dir/InodesName until the volume refuses one, at most 1,000,000. A volume already at or under headroom gets no ballast file and is not an error. A ballast left in dir by an earlier Fill is replaced.

When Fill fails it removes what it wrote.

func (*Ballast) Free

func (b *Ballast) Free() error

Free removes everything Fill wrote. It is safe on a nil Ballast and more than once.

Jump to

Keyboard shortcuts

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