BLKDISCARD(8) FreeBSD System Manager's Manual BLKDISCARD(8)
NAME
blkdiscard - tool to discard portions of a device or file
SYNOPSIS
blkdiscard [-h] [-l length] [-p chunksize] [-n] [-o firstbyte] [-R] [-s]
[-V] [-v] [-z] file
fdiscard [-f firstbyte] [-h] [-l length] [-m chunksize] [-n] [-R] [-s]
[-V] [-v] [-z] file
DESCRIPTION
The blkdiscard program can be used to discard portions of storage, and
works on either device files directly or upon files inside of a mounted
file-system. It provides access to the fdiscard(2) system call, and
relies upon the backing device to have support in both the blkdiscard
driver and in the hardware itself.
The fdiscard interface defaults to the "no-run" mode and requires the -R
option to perform any actions.
OPTIONS
Available options:
-f firstbyte Set the first byte to be discarded. The default is 0.
-h Display built-in help.
-l length Limit the length to be discarded. The default is the full
device or file size, or the rest of the device or file when
the start offset has been set.
-m chunksize Set the per-operation chunksize. The default is 32 MiB.
-n Set the "no-run" option, and do not actually call
fdiscard(2), secure erase, or write zeroes to the file.
-o firstbyte This flag is an alias for the -f flag.
-p chunksize This flag is an alias for the -m flag.
-R Turn off the "no-run mode."
-s Use secure erase operation. This requires specific
hardware support and is not currently supported.
-V Display the program version and exit.
-v Set the verbose flag.
-z Write zeroes instead of calling fdiscard(2).
EXAMPLES
To have a dry-run cleaning of any particular file or device:
# blkdiscard -n -v filename
# blkdiscard -n -v /dev/rwd0b
To discard all the blocks on a swap device:
# blkdiscard -v /dev/rwd0b
To discard all but the first 256MiB of a device, using 128MiB increments:
# blkdiscard -v -f 256m -m 128m /dev/rwd0c
To zero out the contents of a file or device:
# blkdiscard -v -z filename
# blkdiscard -v -z /dev/device
SEE ALSO
fdiscard(2)
HISTORY
The blkdiscard command first appeared linux-util. This implementation
was originally called fdiscard-stuff and has been converted to be
blkdiscard(8) compatible and appeared in NetBSD 10.0.
AUTHORS
The blkdiscard command was written by Matthew R. Green
<
[email protected]>.
BUGS
The secure erase functionality of the -s option is not yet implemented.
FreeBSD 14.1-RELEASE-p8 January 13, 2024 FreeBSD 14.1-RELEASE-p8