You are not logged in.

#1 2020-05-15 10:07:51

vityafx
Member
Registered: 2015-11-01
Posts: 40

[SOLVED] discard/fstrim option for nvme drives

The ArchWiki's section for ssds leaves an unclear message of enabling/disabling the discard or fstrim for NVMe drives:

Discards
Note: Although continuous TRIM is an option (albeit not recommended) for SSDs, NVMe devices should not be issued discards.

I have three SSD's: two nvme and one sata. According to this, don't know what based on, text, I shouldn't specify anywhere any discard/fstrim options for nvmes, but only for sata ssds. Is that correct? If it is correct, I'd like to know what this is based on. All the information in the internet is mostly saying to enable it for any ssd devices (either it is an NVMe or SATA), only archwiki and a few other articles are either in doubts or say not to enable. So I don't know what to do now.

Last edited by vityafx (2020-05-15 10:52:31)

Offline

#2 2020-05-15 10:13:45

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 629

Re: [SOLVED] discard/fstrim option for nvme drives

What filesystem(s) are we taking about here?

Offline

#3 2020-05-15 10:14:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] discard/fstrim option for nvme drives

I just use fstrim.timer that ships with util-linux.  No discard mount options on any SSD (ext4 and f2fs).

Last edited by graysky (2020-05-15 10:14:48)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2020-05-15 10:30:35

vityafx
Member
Registered: 2015-11-01
Posts: 40

Re: [SOLVED] discard/fstrim option for nvme drives

I am using ext4 filesystem. But would like to know the question in the topic for all the filesystems, if possible.

Offline

#5 2020-05-15 10:30:52

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 629

Re: [SOLVED] discard/fstrim option for nvme drives

Red Hat recommends that you use batch or periodic discard.

Use online discard only if:

    the system’s workload is such that batch discard is not feasible, or
    online discard operations are necessary to maintain performance.

This would support what graysky said.

https://access.redhat.com/documentation … ge-devices


EDIT:
https://en.wikipedia.org/wiki/Trim_(computing)

Linux     2.6.28–25 December 2008[22]     Initial support for discard operations was added for FTL NAND flash devices in 2.6.28. Support for the ATA TRIM command was added in 2.6.33.[23]

Not all filesystems make use of trim. Among the filesystems that can issue trim requests automatically are Ext4,[24] Btrfs,[25] FAT, GFS2, JFS,[26], XFS[27], and NTFS-3G. However, in some distributions, this is disabled by default due to performance concerns,[28] in favor of scheduled trimming on supported SSDs.[29] Ext3, NILFS2 and OCFS2 offer ioctls to perform offline trimming. The TRIM specification calls for supporting a list of trim ranges, but as of kernel 3.0 trim is only invoked with a single range that is slower.[30]

Last edited by Zod (2020-05-15 10:43:12)

Offline

#6 2020-05-15 19:33:16

Pse
Member
Registered: 2008-03-15
Posts: 413

Re: [SOLVED] discard/fstrim option for nvme drives

vityafx wrote:

The ArchWiki's section for ssds leaves an unclear message of enabling/disabling the discard or fstrim for NVMe drives:

Discards
Note: Although continuous TRIM is an option (albeit not recommended) for SSDs, NVMe devices should not be issued discards.

I have three SSD's: two nvme and one sata. According to this, don't know what based on, text, I shouldn't specify anywhere any discard/fstrim options for nvmes, but only for sata ssds. Is that correct? If it is correct, I'd like to know what this is based on. All the information in the internet is mostly saying to enable it for any ssd devices (either it is an NVMe or SATA), only archwiki and a few other articles are either in doubts or say not to enable. So I don't know what to do now.

I believe the wiki article refers specifically to "continuous TRIM", i.e. the "discard" option for your filesystem of choice. This option is usually not recommended for any type of drive, be it SATA or NVMe.

What is recommended is to enable "periodic TRIM", i.e. fstrim.timer for example. This applies to both NVMe and SATA.

Offline

Board footer

Powered by FluxBB