'\" t .\" Title: blkdiscard .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.15 .\" Date: 2022-02-17 .\" Manual: System Administration .\" Source: util-linux 2.38 .\" Language: English .\" .TH "BLKDISCARD" "8" "2022-02-17" "util\-linux 2.38" "System Administration" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" blkdiscard \- discard sectors on a device .SH "SYNOPSIS" .sp \fBblkdiscard\fP [options] [\fB\-o\fP \fIoffset\fP] [\fB\-l\fP \fIlength\fP] \fIdevice\fP .SH "DESCRIPTION" .sp \fBblkdiscard\fP is used to discard device sectors. This is useful for solid\-state drivers (SSDs) and thinly\-provisioned storage. Unlike \fBfstrim\fP(8), this command is used directly on the block device. .sp By default, \fBblkdiscard\fP will discard all blocks on the device. Options may be used to modify this behavior based on range or size, as explained below. .sp The \fIdevice\fP argument is the pathname of the block device. .sp \fBWARNING: All data in the discarded region on the device will be lost!\fP .SH "OPTIONS" .sp The \fIoffset\fP and \fIlength\fP arguments may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. .sp \fB\-f\fP, \fB\-\-force\fP .RS 4 Disable all checking. Since v2.36 the block device is open in exclusive mode (\fBO_EXCL\fP) by default to avoid collision with mounted filesystem or another kernel subsystem. The \fB\-\-force\fP option disables the exclusive access mode. .RE .sp \fB\-o\fP, \fB\-\-offset\fP \fIoffset\fP .RS 4 Byte offset into the device from which to start discarding. The provided value must be aligned to the device sector size. The default value is zero. .RE .sp \fB\-l\fP, \fB\-\-length\fP \fIlength\fP .RS 4 The number of bytes to discard (counting from the starting point). The provided value must be aligned to the device sector size. If the specified value extends past the end of the device, \fBblkdiscard\fP will stop at the device size boundary. The default value extends to the end of the device. .RE .sp \fB\-p\fP, \fB\-\-step\fP \fIlength\fP .RS 4 The number of bytes to discard within one iteration. The default is to discard all by one ioctl call. .RE .sp \fB\-s\fP, \fB\-\-secure\fP .RS 4 Perform a secure discard. A secure discard is the same as a regular discard except that all copies of the discarded blocks that were possibly created by garbage collection must also be erased. This requires support from the device. .RE .sp \fB\-z\fP, \fB\-\-zeroout\fP .RS 4 Zero\-fill rather than discard. .RE .sp \fB\-v\fP, \fB\-\-verbose\fP .RS 4 Display the aligned values of \fIoffset\fP and \fIlength\fP. If the \fB\-\-step\fP option is specified, it prints the discard progress every second. .RE .sp \fB\-h\fP, \fB\-\-help\fP .RS 4 Display help text and exit. .RE .sp \fB\-V\fP, \fB\-\-version\fP .RS 4 Print version and exit. .RE .SH "AUTHORS" .sp .MTO "lczerner\(atredhat.com" "Lukas Czerner" "" .SH "SEE ALSO" .sp \fBfstrim\fP(8) .SH "REPORTING BUGS" .sp For bug reports, use the issue tracker at \c .URL "https://github.com/util\-linux/util\-linux/issues" "" "." .SH "AVAILABILITY" .sp The \fBblkdiscard\fP command is part of the util\-linux package which can be downloaded from \c .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."