Linux "blkdiscard" Command Line Options and Examples
discard sectors on a device

blkdiscard is used to discard device sectors. This is useful for solid-state drivers (SSDs) and thinly-provisioned storage. Unlike fstrim(8), this command is used directly on the block device.


Usage:

blkdiscard [options] [-o offset] [-l length] device




Command Line Options:

-o
Byte offset into the device from which to start discarding. The provided value will be aligned to the device sector size.The default value is zero.
blkdiscard -o ...
-l
The number of bytes to discard (counting from the starting point). The provided value will be aligned to the device sectorsize. If the specified value extends past the end of the device, blkdiscard will stop at the device size boundary. Thedefault value extends to the end of the device.
blkdiscard -l ...
-p
The number of bytes to discard within one iteration. The default is to discard all by one ioctl call.
blkdiscard -p ...
-s
Perform a secure discard. A secure discard is the same as a regular discard except that all copies of the discarded blocksthat were possibly created by garbage collection must also be erased. This requires support from the device.
blkdiscard -s ...
-z
Zero-fill rather than discard.
blkdiscard -z ...
-v
Display the aligned values of offset and length. If the --step option is specified, it prints the discard progress every sec‐ond.
blkdiscard -v ...
-V
Display version information and exit.
blkdiscard -V ...
-h
Display help text and exit.AUTHORLukas Czerner ⟨lczerner@redhat.com⟩
blkdiscard -h ...