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 ¶
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 ¶
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 ¶
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 ¶
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.