BLKDISCARD(8)
โจ BLKDISCARD(8) โจ
okay so bestie, welcome to the System Administration girlie side of your terminal ๐
this is the blkdiscard page, and it's literally the moment where we tell your storage device to forget things on purpose. iconic behavior, honestly.
๐ธ NAME ๐ธ
blkdiscard โ discard sectors on a device ๐งนโจ
๐ SYNOPSIS ๐
blkdiscard [options] [-o offset] [-l length] device
that's it. that's the whole vibe. one device, some options, and a whole lot of forgetting ๐ซถ
๐ DESCRIPTION ๐
so blkdiscard is used to discard device sectors. not me being obsessed with this for solid-state drives (SSDs) and thinly-provisioned storage ๐ฅ it's giving main character energy for anyone who wants their SSD to actually know which blocks are free.
and here's the tea: unlike fstrim(8), this command is used directly on the block device. no filesystem middleman. we go straight to the source, no cap ๐
by default, blkdiscard will discard all blocks on the device. options may be used to modify this behavior based on range or size, as explained below. you can be picky if you want to be โจ
the device argument is the pathname of the block device. that's the one you point at. that's your girl.
โ ๏ธ WARNING: All data in the discarded region on the device will be lost! like, GONE gone. not in the trash, not in the cloud, not in a notes app draft. gone ๐ญ
and since util-linux v2.41, fdisk has the ability to discard sectors on both partitions and unpartitioned areas using the 'T' command. additionally, sfdisk has the option --discard-free to discard unpartitioned areas. so we have options, bestie, we have range ๐
โจ OPTIONS โจ
first, the units lore, because it matters ๐
the offset and length 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.
so yes, K and KiB are the same thing. lowercase KB is a whole different number. the math girlies know ๐
-f,--forceโ Disable all checking. since v2.36 the block device is open in exclusive mode (O_EXCL) by default to avoid collision with mounted filesystem or another kernel subsystem. The--forceoption disables the exclusive access mode. basically: default behavior is protective, this is the "i know what i'm doing" button ๐ซฃ-o,--offsetoffsetโ 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. so like, if your offset is off-grid the device is gonna be like "no โค๏ธ"-l,--lengthlengthโ 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,blkdiscardwill stop at the device size boundary. The default value extends to the end of the device. so it politely stops at the edge instead of falling off ๐ฆ-p,--steplengthโ The number of bytes to discard within one iteration. The default is to discard all by one ioctl call. one big swoop, or many little nibbles, your call ๐-q,--quietโ Suppress warning messages. for when you simply do not wish to be perceived ๐-s,--secureโ 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. so extra. so thorough. so device-dependent โจ-z,--zerooutโ Zero-fill rather than discard. not discarding, filling with zeros. different vibe, same dedication ๐-v,--verboseโ Display the aligned values of offset and length. If the--stepoption is specified, it prints the discard progress every second. live updates, we love a progress moment ๐-h,--helpโ Display help text and exit. the classic escape hatch ๐ซถ-V,--versionโ Display version and exit. drop the version number and dip โ๏ธ
๐ EXIT STATUS ๐
blkdiscard has the following exit status values:
0โ success ๐ slay, it worked1โ failure; incorrect invocation, permissions or any other generic error ๐ญ the broad "something went wrong" bucket2โ failure; since v2.39, the device does not support discard operation ๐ your device simply said no
๐ง AUTHORS ๐ง
Lukas Czerner <lczerner@redhat.com>, Karel Zak <kzak@redhat.com>
thank you to the icons who built this ๐๐
๐ SEE ALSO ๐
(yes, the filesystem-flavored cousin. different girl, same energy.)
๐ REPORTING BUGS ๐
For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.
found something cursed? tell the maintainers, not the group chat ๐
โญ AVAILABILITY โญ
The blkdiscard command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
okay that's the whole page bestie!! this was util-linux 2.42.4, dated 2026-09-21, and you just read BLKDISCARD(8) ๐ go forth and discard responsibly, no cap ๐โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms