LinuxCommandLibrary

sfill

Securely wipe free space on a partition

TLDR

Overwrite free space and inodes of a disk with 38 writes (slow but secure)

$ sfill /[path/to/mounted_disk_directory]
copy

Overwrite free space and inodes of a disk with 6 writes (fast but [l]ess secure) and show status ([v]erbose)
$ sfill -l -v /[path/to/mounted_disk_directory]
copy

Overwrite free space and inodes of a disk with 1 write (very fast but [l]ess secure [v]erbose) and show status
$ sfill -ll -v /[path/to/mounted_disk_directory]
copy

Overwrite only free space of a d[I]sk
$ sfill -I /[path/to/mounted_disk_directory]
copy

Overwrite only free [i]nodes of a disk
$ sfill -i /[path/to/mounted_disk_directory]
copy

SYNOPSIS

sfill [options] [filename...]

PARAMETERS

--fill-byte byte, -f byte
    Specifies the hexadecimal byte value (e.g., 00, FF) to use for filling gaps. The default fill byte is 0xFF.

--range start,end, -r start,end
    Defines the inclusive memory address range (in hexadecimal, e.g., 1000,2000) within which gaps should be identified and filled. If not specified, sfill will only fill gaps between existing records, not expand the overall data coverage.

--exclude start,end, -e start,end
    Specifies an inclusive memory address range (in hexadecimal) that should be explicitly excluded from the filling process, even if it falls within the specified --range.

--enable-progress, -p
    Displays a progress indicator to the standard error output while processing large files, showing the percentage completed.

--verbose, -v
    Produces verbose output, providing more detailed information about the processing steps and any encountered issues.

--help, -h
    Displays a summary of command-line options and usage information.

--version, -V
    Displays the version information of the sfill utility.

DESCRIPTION

sfill is a utility from the SRecord package designed to fill unoccupied memory regions (gaps) within Motorola S-Record files. S-Record files are commonly used in embedded systems development for programming microcontrollers, PROMs, or other memory devices. These files represent memory addresses and their corresponding data.

When a memory image has non-contiguous data – for instance, due to compiler optimizations that leave unused regions, or when specific areas are intentionally left blank – sfill can be used to populate these gaps with a specified fill byte. This ensures that the entire memory range of interest is covered, which can be critical for programming processes that require fully defined memory contents or for security purposes to avoid undefined states.

The command reads an S-Record file (from specified filenames or standard input), identifies the gaps within a defined address range, and then outputs a new S-Record file to standard output with these gaps filled by a user-defined byte (which defaults to 0xFF). It also supports excluding specific sub-ranges from the filling process.

CAVEATS

sfill specifically operates on S-Record (Motorola SREC) formatted files. Ensure your input files are in a compatible S-Record format.

The command processes input files and writes the modified S-Record data to standard output. It is crucial to redirect this output to a new file (e.g., sfill input.srec > output.srec) to save the changes, as it does not modify the original file in place.

Without the --range option, sfill will only fill gaps that exist *between* already defined data records. It will not create new records for entirely empty regions outside of existing data coverage. To guarantee a fully populated memory image, always use --range to define the complete desired extent of the data.

HISTORY

sfill is an integral part of the comprehensive SRecord suite of tools, developed and maintained by Peter Miller. This suite was created to provide robust and flexible utilities for manipulating various EPROM and microcontroller programmer file formats, including Motorola S-Record, Intel HEX, and others. sfill addresses a common requirement in embedded systems development: ensuring that memory images are contiguous and fully defined for reliable device programming. Its functionality has been a stable and essential component within the SRecord toolset, serving the embedded community for many years.

SEE ALSO

srec_cat(1), srec_info(1), srec_cmp(1), srec_input(1), srec_output(1)

Copied to clipboard