1FSTRIM(8) System Manager's Manual FSTRIM(8)
2
3
4
6 fstrim - discard unused blocks on a mounted filesystem
7
9 fstrim [-o offset] [-l length] [-m minimum-free-extent] [-v] mountpoint
10
11
13 fstrim is used on a mounted filesystem to discard (or "trim") blocks
14 which are not in use by the filesystem. This is useful for solid-state
15 drives (SSDs) and thinly-provisioned storage.
16
17 By default, fstrim will discard all unused blocks in the filesystem.
18 Options may be used to modify this behavior based on range or size, as
19 explained below.
20
21 The mountpoint argument is the pathname of the directory where the
22 filesystem is mounted.
23
24
26 The offset, length, and minimum-free-extent arguments may be followed
27 by binary (2^N) suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is
28 optional, e.g. "K" has the same meaning as "KiB") or decimal (10^N)
29 suffixes KB, MB, GB, PB and EB.
30
31 -h, --help
32 Print help and exit.
33
34 -o, --offset offset
35 Byte offset in filesystem from which to begin searching for free
36 blocks to discard. Default value is zero, starting at the
37 beginning of the filesystem.
38
39 -l, --length length
40 Number of bytes after starting point to search for free blocks
41 to discard. If the specified value extends past the end of the
42 filesystem, fstrim will stop at the filesystem size boundary.
43 Default value extends to the end of the filesystem.
44
45 -m, --minimum minimum-free-extent
46 Minimum contiguous free range to discard, in bytes. (This value
47 is internally rounded up to a multiple of the filesystem block
48 size). Free ranges smaller than this will be ignored. By
49 increasing this value, the fstrim operation will complete more
50 quickly for filesystems with badly fragmented freespace,
51 although not all blocks will be discarded. Default value is
52 zero, discard every free block.
53
54 -v, --verbose
55 Verbose execution. When specified fstrim will output the number
56 of bytes passed from the filesystem down the block stack to the
57 device for potential discard. This number is a maximum discard
58 amount from the storage device's perspective, because FITRIM
59 ioctl called repeated will keep sending the same sectors for
60 discard repeatedly.
61
62 fstrim will report the same potential discard bytes each time,
63 but only sectors which had been written to between the discards
64 would actually be discarded by the storage device. Further, the
65 kernel block layer reserves the right to adjust the discard
66 ranges to fit raid stripe geometry, non-trim capable devices in
67 a LVM setup, etc. These reductions would not be reflected in
68 fstrim_range.len (the --length option).
69
70
72 Lukas Czerner <lczerner@redhat.com>
73 Karel Zak <kzak@redhat.com>
74
76 mount(8)
77
79 The fstrim command is part of the util-linux-ng package and is availā
80 able from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
81
82
83
84 Nov 2010 FSTRIM(8)