fillfs is a utility designed to either fill a filesystem to a specified size or overwrite an existing file with either zeroed or random data. It is a versatile tool for testing disk behavior under high usage or verifying data integrity by overwriting existing files.
- Directory Mode: Creates a hidden file (
/.fillfs) in the specified directory and fills the filesystem until:- The specified size is reached, or
- The disk is full.
- File Mode: Overwrites an existing file with zero or random data without removing it.
- Supports writing zeroed or random data.
- Optional progress updates, including throughput and ETA.
- Customizable block size for writing operations.
- Automatic cleanup for hidden files on most termination signals.
fillfs [OPTIONS] <mount_point_or_file> [size]<mount_point_or_file>: Required. The target path can be either:- A directory, where a hidden file (
/.fillfs) will be created and filled. - An existing file, which will be overwritten in-place.
- A directory, where a hidden file (
[size]: Optional. Specifies the target size for the operation. Supports human-readable formats such as1G,800M,32K. If omitted:- For directories: The disk is filled until no space remains.
- For files: The entire file is overwritten.
-r, --random: Write random data instead of zeroed data.-z, --zero: Explicitly write zeroed data (overrides--randomif both are set).-s, --status: Show progress updates, including throughput and estimated time remaining (ETA).-b, --block-size=SIZE: Use a custom block size for writes. Defaults to32Mif not specified.-h, --help: Display help information.
Fill 1 GB on the root filesystem, showing status updates:
fillfs / --status 1GFill until the disk is completely full at /mnt/data with zeroed data:
fillfs /mnt/dataOverwrite an existing file up to 500 MB (without removing it):
fillfs /tmp/existing_file 500MUse random data for 10 GB with a custom 4M block size:
fillfs -r -s -b 4M /mnt/data 10G0: Success.- Non-zero: An error occurred or the program was interrupted.
- Directory Mode: If forcibly terminated with
kill -9(SIGKILL), cleanup of the hidden file may not occur. - File Mode: No cleanup is attempted; the file remains in its current state after termination.
This utility is licensed under the MIT License:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Robert Heffernan robert@heffernantech.au