Documentation
¶
Overview ¶
Package fstrim discards unused blocks of a mounted filesystem (the equivalent of the fstrim(8) command).
Index ¶
Constants ¶
const FITRIM = 0xc0185879
FITRIM is the ioctl number to discard unused blocks of a mounted filesystem.
It is _IOWR('X', 121, struct fstrim_range), where struct fstrim_range is three uint64 fields (24 bytes). This encoding is the same on all architectures using the asm-generic ioctl numbering (amd64, arm64, ...).
Variables ¶
var ErrNotSupported = errors.New("fstrim is not supported for this filesystem")
ErrNotSupported indicates that the filesystem (or the underlying block device) does not support discarding unused blocks.
Functions ¶
func Fstrim ¶
Fstrim discards unused blocks of the mounted filesystem at the given path.
The path may be the mount point or any file or directory within the mounted filesystem.
It returns the number of bytes discarded as reported by the kernel (the same figure printed by `fstrim -v`; an estimate, not a hardware-confirmed count).
The error is nil on success, ErrNotSupported if the filesystem or the underlying device does not support discard, or another error if the operation failed.
Types ¶
This section is empty.