1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
.TH BLKDISCARD 8 "July 2014" "util-linux" "System Administration"
.SH NAME
blkdiscard \- discard sectors on a device
.SH SYNOPSIS
.B blkdiscard
[options]
.RB [ \-o
.IR offset ]
.RB [ \-l
.IR length ]
.I device
.SH DESCRIPTION
.B blkdiscard
is used to discard device sectors. This is useful for solid-state
drivers (SSDs) and thinly-provisioned storage. Unlike
.BR fstrim (8),
this command is used directly on the block device.
.PP
By default,
.B blkdiscard
will discard all blocks on the device. Options may be used to modify
this behavior based on range or size, as explained below.
.PP
The
.I device
argument is the pathname of the block device.
.PP
.B WARNING: All data in the discarded region on the device will be lost!
.SH OPTIONS
The
.I offset
and
.I 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.
.TP
.BR \-o , " \-\-offset \fIoffset"
Byte offset into the device from which to start discarding. The provided value
will be aligned to the device sector size. The default value is zero.
.TP
.BR \-l , " \-\-length \fIlength"
The number of bytes to discard (counting from the starting point). The provided value
will be aligned to the device sector size. If the specified value extends past
the end of the device,
.B blkdiscard
will stop at the device size boundary. The default value extends to the end
of the device.
.TP
.BR \-p , " \-\-step \fIlength"
The number of bytes to discard within one iteration. The default is to discard
all by one ioctl call.
.TP
.BR \-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.
.TP
.BR \-z , " \-\-zeroout"
Zero-fill rather than discard.
.TP
.BR \-v , " \-\-verbose"
Display the aligned values of
.I offset
and
.IR length .
If the \fB\-\-step\fR option is specified, it prints the discard progress every second.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.SH AUTHOR
.MT lczerner@redhat.com
Lukas Czerner
.ME
.SH SEE ALSO
.BR fstrim (8)
.SH AVAILABILITY
The blkdiscard command is part of the util-linux package and is available
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
Linux Kernel Archive
.UE .
|