Skip to contentSkip to conversation

TRIM on XFS

DISCUSSION Michael Monnerie 4 participants 9 messages Oct 7, 2011 – Oct 11, 2011

lore
Share & tools
lore
#0 lore raw

It's been a long time since I've been reading about TRIM. What is the current state for XFS? I believe there's TRIM support, but only offline. Can someone explain how to activate that and actually run a TRIM?

And there was some talk of "inline TRIM", i.e. always TRIMing on delete. Is that implemented already?

We're on VMware with thin provisioned machines, and that would hugely benefit from TRIM.

Signature · 8 lines
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc

it-management Internet Services: Protéger
http://proteger.at [gesprochen: Prot-e-schee]
Tel: +43 660 / 415 6531

// Haus zu verkaufen: http://zmi.at/langegg/

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 10 lines · Michael Monnerie

It's been a long time since I've been reading about TRIM. What is the current state for XFS? I believe there's TRIM support, but only offline. Can someone explain how to activate that and actually run a TRIM?

And there was some talk of "inline TRIM", i.e. always TRIMing on delete. Is that implemented already?

We're on VMware with thin provisioned machines, and that would hugely benefit from TRIM.

e84661a xfs: add online discard support

and

a46db60 xfs: add FITRIM support

So both online and background trim methods are available. Test well before using them in production, though, as buggy hardware or thinp implementations are quite common....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
Quoted 5 lines · On Samstag, 8. Oktober 2011 Dave Chinner wrote:

e84661a xfs: add online discard support

and

a46db60 xfs: add FITRIM support

I guess that means those patches are not released by now? Sorry, I know that these numbers are the patch ID, but don't know what to do with it.

Quoted 1 line

So both online and background trim methods are available.

I found the threads in the mailing list. FITRIM v3 Patch was posted 7.Jan.2011, but even if it's in default kernel already - how would you call it?

Quoted 2 lines

Test well before using them in production, though, as buggy hardware or thinp implementations are quite common....

I have a NetApp Storage here that is quite capable :-) Just having no idea how to activate filesystem discard support :-(

Signature · 8 lines
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc

it-management Internet Services: Protéger
http://proteger.at [gesprochen: Prot-e-schee]
Tel: +43 660 / 415 6531

// Haus zu verkaufen: http://zmi.at/langegg/

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 10 lines · Michael Monnerie
Quoted 5 lines · On Samstag, 8. Oktober 2011 Dave Chinner wrote:

e84661a xfs: add online discard support

and

a46db60 xfs: add FITRIM support

I guess that means those patches are not released by now? Sorry, I know that these numbers are the patch ID, but don't know what to do with it.

I think online was added in the spring of this year, so around 2.6.38.

I don't know when batch kernel support went in, but I assume some time ago.

Quoted 6 lines
Quoted 2 lines

So both online and background trim methods are available.

I found the threads in the mailing list. FITRIM v3 Patch was posted 7.Jan.2011, but even if it's in default kernel already - how would you call it?

fitrim is the batch mode.

To enable realtime discard, add --discard to your mount options.

Documented at http://lxr.linux.no/#linux+v3.0.4/Documentation/filesystems/xfs.txt

To invoke batch mode, simply use fstrim from user space.

Quoted 6 lines
Quoted 3 lines

Test well before using them in production, though, as buggy hardware or thinp implementations are quite common....

I have a NetApp Storage here that is quite capable :-) Just having no idea how to activate filesystem discard support :-(

Definitely test. Particularly for performance. Many are surprised to see their performance drop not go up when they start using discard heavily.

Many people assume realtime support is better than a batched version.

In most cases I believe users find the opposite to be true.

They can simply have cron call fstrim on a routine basis and all is good. ie. Maybe every night right after the backups complete.

Especially when talking about thin provisioning, fstrim has more flexibility.  You can tell it to only discard free areas that meet minimum size criteria.  So if your thin provisioning is 1MB at a time, it would be logical to pass 1 MB to fstrim as a minimum discard size. You can't do that with mount --discard

Quoted 4 lines

--
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc

HTH
Greg

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 7 lines · Greg Freemyer

fitrim is the batch mode.

To enable realtime discard, add --discard to your mount options.

Documented athttp://lxr.linux.no/#linux+v3.0.4/Documentation/filesystems/xfs.txt

To invoke batch mode, simply use fstrim from user space.

Hello,

I'm also trying to use FITRIM on a simple XFS partition on a spinning magnetic hard drive (remember those). I haven't had much luck. I'm doing this just to get used to the commands when using this against a thinly provisioned disk. I have no idea if this should work in this configuration.

On a Debian system with Linux 3.0.0-2-amd64 when I issue:

# fstrim /

I receive:
fstrim: /: FITRIM ioctl failed: Operation not supported

With an strace this looks like:
open("/", O_RDONLY) = 3
ioctl(3, 0xc0185879, 0x7fff4ea851b0) = -1 EOPNOTSUPP (Operation not supported)

My fstrim is from util-linux-2.19.1-5

I'd be happy to try to diagnose this further if people are interested. Any suggestions where I should start would be much appreciated.

Signature · 6 lines
Jeffrey Hundstad

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw
Quoted 29 lines · Jeffrey Hundstad
Quoted 9 lines · Greg Freemyer

fitrim is the batch mode.

To enable realtime discard, add --discard to your mount options.

Documented athttp://lxr.linux.no/#linux+v3.0.4/Documentation/filesystems/xfs.txt

To invoke batch mode, simply use fstrim from user space.

Hello,

I'm also trying to use FITRIM on a simple XFS partition on a spinning magnetic hard drive (remember those).  I haven't had much luck.  I'm doing this just to get used to the commands when using this against a thinly provisioned disk.  I have no idea if this should work in this configuration.

On a Debian system with Linux 3.0.0-2-amd64 when I issue:

# fstrim /

I receive:
fstrim: /: FITRIM ioctl failed: Operation not supported

With an strace this looks like:
open("/", O_RDONLY)                     = 3
ioctl(3, 0xc0185879, 0x7fff4ea851b0)    = -1 EOPNOTSUPP (Operation not supported)

Quoted 7 lines

My fstrim is from util-linux-2.19.1-5

I'd be happy to try to diagnose this further if people are interested.  Any suggestions where I should start would be much appreciated.

--
Jeffrey Hundstad

I just tried it with a 3.1.0-rc9 kernel and had the same problem.

I just checked xfstests group file and see that test 251 (the fstrim one) is not in the auto group, so I haven't been running it.

Same is true of btrfs and ext4. I've only been running the auto group recently. And mostly against btrfs and ext4.

Hopefully someone can explain it to us both.
Greg

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw
In reply to Jeffrey Hundstad
Quoted 20 lines · Jeffrey Hundstad
Quoted 7 lines · Greg Freemyer

fitrim is the batch mode.

To enable realtime discard, add --discard to your mount options.

Documented athttp://lxr.linux.no/#linux+v3.0.4/Documentation/filesystems/xfs.txt

To invoke batch mode, simply use fstrim from user space.

Hello,

I'm also trying to use FITRIM on a simple XFS partition on a spinning magnetic hard drive (remember those). I haven't had much luck. I'm doing this just to get used to the commands when using this against a thinly provisioned disk. I have no idea if this should work in this configuration.

On a Debian system with Linux 3.0.0-2-amd64 when I issue:

# fstrim /
Quoted 7 lines

I receive:
fstrim: /: FITRIM ioctl failed: Operation not supported

With an strace this looks like:
open("/", O_RDONLY) = 3
ioctl(3, 0xc0185879, 0x7fff4ea851b0) = -1 EOPNOTSUPP (Operation
not supported)

It means the block device underneath the filesystem doesn't support the TRIM operation. Check /sys/block/<dev>/queue/discard_max_bytes - if the value is zero then your device doesn't support discard operations.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw

Dave,

Thank you. I suspected this may be the case. It is awfully nice to have a definitive answer though. It is especially nice to have a way to determine if it is possible. Thank you!

I've created a an XFS Wiki page for this info:
http://xfs.org/index.php/FITRIM/discard

Signature · 1 line
Jeffrey Hundstad
Quoted 27 lines · Dave Chinner
Quoted 19 lines · Jeffrey Hundstad
Quoted 7 lines · Greg Freemyer

fitrim is the batch mode.

To enable realtime discard, add --discard to your mount options.

Documented athttp://lxr.linux.no/#linux+v3.0.4/Documentation/filesystems/xfs.txt

To invoke batch mode, simply use fstrim from user space.

Hello,

I'm also trying to use FITRIM on a simple XFS partition on a spinning magnetic hard drive (remember those). I haven't had much luck. I'm doing this just to get used to the commands when using this against a thinly provisioned disk. I have no idea if this should work in this configuration.

On a Debian system with Linux 3.0.0-2-amd64 when I issue:

# fstrim /
Quoted 7 lines

I receive:
fstrim: /: FITRIM ioctl failed: Operation not supported

With an strace this looks like:
open("/", O_RDONLY) = 3
ioctl(3, 0xc0185879, 0x7fff4ea851b0) = -1 EOPNOTSUPP (Operation
not supported)

Quoted 8 lines

It means the block device underneath the filesystem doesn't support the TRIM operation. Check /sys/block/<dev>/queue/discard_max_bytes - if the value is zero then your device doesn't support discard operations.

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#8 lore raw
Quoted 8 lines · Jeffrey Hundstad

Dave,

Thank you. I suspected this may be the case. It is awfully nice to have a definitive answer though. It is especially nice to have a way to determine if it is possible. Thank you!

I've created a an XFS Wiki page for this info:
http://xfs.org/index.php/FITRIM/discard

Great!

Looks good - I'll just have to find out which release online discard first appeared in (different to FITRIM) and add that to the description of it, but otherwise it looks good. :)

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs