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 --force option disables the exclusive access mode. basically: default behavior is protective, this is the "i know what i'm doing" button ๐Ÿซฃ
  • -o, --offset offset โ€” 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, --length length โ€” 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, blkdiscard will 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, --step length โ€” 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 --step option 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:

  1. 0 โ€” success ๐ŸŽ‰ slay, it worked
  2. 1 โ€” failure; incorrect invocation, permissions or any other generic error ๐Ÿ˜ญ the broad "something went wrong" bucket
  3. 2 โ€” 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