]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/blkdiscard.8
Merge branch 'eject-sparc' of https://github.com/mator/util-linux
[thirdparty/util-linux.git] / sys-utils / blkdiscard.8
CommitLineData
c372860d 1.TH BLKDISCARD 8 "July 2014" "util-linux" "System Administration"
d964b669
LC
2.SH NAME
3blkdiscard \- discard sectors on a device
4.SH SYNOPSIS
5.B blkdiscard
7154cc89 6[options]
d964b669
LC
7.RB [ \-o
8.IR offset ]
9.RB [ \-l
10.IR length ]
d964b669 11.I device
d964b669
LC
12.SH DESCRIPTION
13.B blkdiscard
9f6bd5bd
SK
14is used to discard device sectors. This is useful for solid-state
15drivers (SSDs) and thinly-provisioned storage. Unlike
b2cc2a7f 16.BR fstrim (8),
d964b669
LC
17this command is used directly on the block device.
18.PP
19By default,
20.B blkdiscard
9f6bd5bd
SK
21will discard all blocks on the device. Options may be used to modify
22this behavior based on range or size, as explained below.
d964b669
LC
23.PP
24The
25.I device
26argument is the pathname of the block device.
9f6bd5bd 27.PP
d964b669 28.B WARNING: All data in the discarded region on the device will be lost!
d964b669 29.SH OPTIONS
9f6bd5bd
SK
30The
31.I offset
32and
33.I length
c372860d
BS
34arguments may be followed by the multiplicative suffixes KiB (=1024),
35MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is
9f6bd5bd 36optional, e.g., "K" has the same meaning as "KiB") or the suffixes
c372860d
BS
37KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
38.TP
34fed3ff
KZ
39.BR \-f , " \-\-force"
40Disable all checking. Since v2.36 the block device is open in exclusive mode (O_EXCL)
41by default to avoid collision with mounted filesystem or another kernel subsystem.
42The force option disables the exclusive access mode.
43.TP
c372860d
BS
44.BR \-o , " \-\-offset \fIoffset"
45Byte offset into the device from which to start discarding. The provided value
46will be aligned to the device sector size. The default value is zero.
47.TP
48.BR \-l , " \-\-length \fIlength"
49The number of bytes to discard (counting from the starting point). The provided value
50will be aligned to the device sector size. If the specified value extends past
9f6bd5bd 51the end of the device,
d964b669 52.B blkdiscard
c372860d 53will stop at the device size boundary. The default value extends to the end
d964b669 54of the device.
c372860d 55.TP
8f59654a
KZ
56.BR \-p , " \-\-step \fIlength"
57The number of bytes to discard within one iteration. The default is to discard
58all by one ioctl call.
59.TP
c372860d
BS
60.BR \-s , " \-\-secure"
61Perform a secure discard. A secure discard is the same as a regular discard
62except that all copies of the discarded blocks that were possibly created by
63garbage collection must also be erased. This requires support from the device.
64.TP
7154cc89
KZ
65.BR \-z , " \-\-zeroout"
66Zero-fill rather than discard.
67.TP
c372860d
BS
68.BR \-v , " \-\-verbose"
69Display the aligned values of
9f6bd5bd
SK
70.I offset
71and
c372860d 72.IR length .
6bc4cc18 73If the \fB\-\-step\fR option is specified, it prints the discard progress every second.
c372860d
BS
74.TP
75.BR \-V , " \-\-version"
76Display version information and exit.
77.TP
78.BR \-h , " \-\-help"
79Display help text and exit.
d964b669 80.SH AUTHOR
9f6bd5bd
SK
81.MT lczerner@redhat.com
82Lukas Czerner
83.ME
d964b669
LC
84.SH SEE ALSO
85.BR fstrim (8)
86.SH AVAILABILITY
87The blkdiscard command is part of the util-linux package and is available
d673b74e 88.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
9f6bd5bd
SK
89Linux Kernel Archive
90.UE .