1FSTRIM(8) System Administration 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 the multiplicative suffixes KiB=1024, MiB=1024*1024, and so on for
28 GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g. "K" has the
29 same meaning as "KiB") or the suffixes KB=1000, MB=1000*1000, and so on
30 for GB, TB, PB, EB, ZB and YB.
31
32 -h, --help
33 Print help and exit.
34
35 -o, --offset offset
36 Byte offset in filesystem from which to begin searching for free
37 blocks to discard. Default value is zero, starting at the
38 beginning of the filesystem.
39
40 -l, --length length
41 Number of bytes after starting point to search for free blocks
42 to discard. If the specified value extends past the end of the
43 filesystem, fstrim will stop at the filesystem size boundary.
44 Default value extends to the end of the filesystem.
45
46 -m, --minimum minimum-free-extent
47 Minimum contiguous free range to discard, in bytes. (This value
48 is internally rounded up to a multiple of the filesystem block
49 size). Free ranges smaller than this will be ignored. By
50 increasing this value, the fstrim operation will complete more
51 quickly for filesystems with badly fragmented freespace,
52 although not all blocks will be discarded. Default value is
53 zero, discard every free block.
54
55 -v, --verbose
56 Verbose execution. When specified fstrim will output the number
57 of bytes passed from the filesystem down the block stack to the
58 device for potential discard. This number is a maximum discard
59 amount from the storage device's perspective, because FITRIM
60 ioctl called repeated will keep sending the same sectors for
61 discard repeatedly.
62
63 fstrim will report the same potential discard bytes each time,
64 but only sectors which had been written to between the discards
65 would actually be discarded by the storage device. Further, the
66 kernel block layer reserves the right to adjust the discard
67 ranges to fit raid stripe geometry, non-trim capable devices in
68 a LVM setup, etc. These reductions would not be reflected in
69 fstrim_range.len (the --length option).
70
71
73 Lukas Czerner <lczerner@redhat.com>
74 Karel Zak <kzak@redhat.com>
75
77 mount(8)
78
80 The fstrim command is part of the util-linux package and is available
81 from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
82
83
84
85util-linux November 2010 FSTRIM(8)