<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://xfs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vegasseo</id>
	<title>xfs.org - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://xfs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vegasseo"/>
	<link rel="alternate" type="text/html" href="https://xfs.org/index.php/Special:Contributions/Vegasseo"/>
	<updated>2026-04-21T11:46:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://xfs.org/index.php?title=FITRIM/discard&amp;diff=2433</id>
		<title>FITRIM/discard</title>
		<link rel="alternate" type="text/html" href="https://xfs.org/index.php?title=FITRIM/discard&amp;diff=2433"/>
		<updated>2012-03-17T03:14:13Z</updated>

		<summary type="html">&lt;p&gt;Vegasseo: /* Batch Mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Purpose ==&lt;br /&gt;
&lt;br /&gt;
FITRIM is a mounted filesystem feature to discard (or &amp;quot;[http://en.wikipedia.org/wiki/TRIM trim]&amp;quot;) blocks which are not in use by the filesystem. This is useful for solid-state drives (SSDs) and thinly-provisioned storage.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
#The block device underneath the filesystem must support the FITRIM operation.&lt;br /&gt;
#The kernel must include TRIM support and XFS must include FITRIM support (this has been true for Linux since v2.6.38, Jan 18 2011)&lt;br /&gt;
#Realtime discard mode requires a more recent v3.0 kernel&lt;br /&gt;
&lt;br /&gt;
This can be verified by viewing /sys/block/&amp;lt;dev&amp;gt;/queue/discard_max_bytes -- If the value is zero then your device doesn&#039;t support discard&lt;br /&gt;
operations.&lt;br /&gt;
&lt;br /&gt;
== Modes of Operation ==&lt;br /&gt;
&lt;br /&gt;
* Realtime discard -- As files are removed, the filesystem issues discard requests automatically&lt;br /&gt;
* Batch Mode -- A user procedure that trims all or portions of the filesystem&lt;br /&gt;
&lt;br /&gt;
=== Realtime discard ===&lt;br /&gt;
&lt;br /&gt;
This mode issues discard requests automatically as files are removed from the filesystem.  No other command or process is required.&lt;br /&gt;
&lt;br /&gt;
There can be a severe performance penalty for enabling realtime discard. (4)&lt;br /&gt;
&lt;br /&gt;
Realtime discard is selected by adding the filesystem option &amp;lt;code&amp;gt;discard&amp;lt;/code&amp;gt; while mounting.&lt;br /&gt;
&lt;br /&gt;
This can be done by the following examples:&lt;br /&gt;
&lt;br /&gt;
# placing &amp;lt;code&amp;gt;discard&amp;lt;/code&amp;gt; in your /etc/fstab for the filesystem: &amp;lt;code&amp;gt;/dev/sda1 /mountpoint xfs defaults,discard 0 1&amp;lt;/code&amp;gt;&lt;br /&gt;
# mount options: &amp;lt;code&amp;gt;mount -o discard /dev/sda1 /mountpoint&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Batch Mode ===&lt;br /&gt;
&lt;br /&gt;
This mode requires user intervention.  This intervention is in the form of the command &amp;lt;code&amp;gt;fstrim&amp;lt;/code&amp;gt;.  It has been included in [http://en.wikipedia.org/wiki/Util-linux util-linux-ng] [http://www.bobsseo.com since] about Nov 26, 2010.&lt;br /&gt;
&lt;br /&gt;
Usage example:&lt;br /&gt;
&amp;lt;code&amp;gt;fstrim /mountpoint&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# FITRIM description - Lukas Czerner &amp;lt;lczerner at redhat.com&amp;gt; http://patchwork.xfs.org/patch/1490/&lt;br /&gt;
# Block requirements - Dave Chinner &amp;lt;david at fromorbit.com&amp;gt; http://oss.sgi.com/pipermail/xfs/2011-October/053379.html&lt;br /&gt;
# util-linux-ng addition - Karel Zak &amp;lt;kzak@xxxxxxxxxx&amp;gt; http://www.spinics.net/lists/util-linux-ng/msg03646.&lt;br /&gt;
# Online TRIM/discard performance impact - http://oss.sgi.com/pipermail/xfs/2011-November/053841.html&lt;/div&gt;</summary>
		<author><name>Vegasseo</name></author>
	</entry>
</feed>