1BLKDISCARD(8) System Administration BLKDISCARD(8)
2
3
4
6 blkdiscard - discard sectors on a device
7
9 blkdiscard [options] [-o offset] [-l length] device
10
12 blkdiscard is used to discard device sectors. This is useful for
13 solid-state drivers (SSDs) and thinly-provisioned storage. Unlike
14 fstrim(8), this command is used directly on the block device.
15
16 By default, blkdiscard will discard all blocks on the device. Options
17 may be used to modify this behavior based on range or size, as
18 explained below.
19
20 The device argument is the pathname of the block device.
21
22 WARNING: All data in the discarded region on the device will be lost!
23
25 The offset and length arguments may be followed by the multiplicative
26 suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB,
27 EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning
28 as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for
29 GB, TB, PB, EB, ZB and YB.
30
31 -f, --force
32 Disable all checking. Since v2.36 the block device is open in
33 exclusive mode (O_EXCL) by default to avoid collision with mounted
34 filesystem or another kernel subsystem. The --force option disables
35 the exclusive access mode.
36
37 -o, --offset offset
38 Byte offset into the device from which to start discarding. The
39 provided value must be aligned to the device sector size. The
40 default value is zero.
41
42 -l, --length length
43 The number of bytes to discard (counting from the starting point).
44 The provided value must be aligned to the device sector size. If
45 the specified value extends past the end of the device, blkdiscard
46 will stop at the device size boundary. The default value extends to
47 the end of the device.
48
49 -p, --step length
50 The number of bytes to discard within one iteration. The default is
51 to discard all by one ioctl call.
52
53 -s, --secure
54 Perform a secure discard. A secure discard is the same as a regular
55 discard except that all copies of the discarded blocks that were
56 possibly created by garbage collection must also be erased. This
57 requires support from the device.
58
59 -z, --zeroout
60 Zero-fill rather than discard.
61
62 -v, --verbose
63 Display the aligned values of offset and length. If the --step
64 option is specified, it prints the discard progress every second.
65
66 -h, --help
67 Display help text and exit.
68
69 -V, --version
70 Print version and exit.
71
73 Lukas Czerner <lczerner@redhat.com>
74
76 fstrim(8)
77
79 For bug reports, use the issue tracker at
80 https://github.com/util-linux/util-linux/issues.
81
83 The blkdiscard command is part of the util-linux package which can be
84 downloaded from Linux Kernel Archive
85 <https://www.kernel.org/pub/linux/utils/util-linux/>.
86
87
88
89util-linux 2.38.1 2022-05-11 BLKDISCARD(8)