5

So I've been reading that for SSDs, weekly TRIM is enabled by default only for some brands like Samsung and Intel,but not others like Hynix. What's the rationale for this? Should I not enable TRIM on SSDs by other brands because performance/lifespan may be negatively affected?

14

When it comes to low-level Disk I/O such as TRIM, Ubuntu doesn't have much control. It's really up to the Linux Kernel and the SSD manufacturer. Before running TRIM you have to make sure your SSD supports it or it could become an expensive paperweight.

To find out for sure use:

$ lsblk --discard
NAME        DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sdb                0        0B       0B         0
├─sdb4             0        0B       0B         0
├─sdb2             0        0B       0B         0
├─sdb5             0        0B       0B         0
├─sdb3             0        0B       0B         0
└─sdb1             0        0B       0B         0
sr0                0        0B       0B         0
sda                0        0B       0B         0
├─sda4             0        0B       0B         0
├─sda2             0        0B       0B         0
├─sda5             0        0B       0B         0
├─sda3             0        0B       0B         0
└─sda1             0        0B       0B         0
nvme0n1          512      512B       2T         0
├─nvme0n1p5        0      512B       2T         0
├─nvme0n1p3        0      512B       2T         0
├─nvme0n1p1        0      512B       2T         0
├─nvme0n1p6        0      512B       2T         0
├─nvme0n1p4        0      512B       2T         0
├─nvme0n1p2        0      512B       2T         0
└─nvme0n1p7        0      512B       2T         0

When DISC-GRAN DISC-MAX columns contain non-zero values it is safe to use TRIM. If you are unsure which disk is which in this display you can get the model name and number using:

$ lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL
NAME        FSTYPE  LABEL                  MOUNTPOINT          SIZE MODEL
sdb                                                           14.4G STORE N GO      
├─sdb4      iso9660 Ubuntu 18.04 LTS amd64 /media/rick/Ubunt   1.4G 
├─sdb2                                                           1M 
├─sdb5      ext4    casper-rw              /media/rick/caspe   6.4G 
├─sdb3      vfat    usbboot                                    244M 
└─sdb1      ntfs    usbdata                /media/rick/usbda   6.4G 
sr0                                                           1024M DVD+/-RW DW316  
sda                                                          931.5G HGST HTS721010A9
├─sda4      ntfs    WINRETOOLS                                 450M 
├─sda2                                                         128M 
├─sda5      ntfs    Image                                     11.4G 
├─sda3      ntfs    HGST_Win10             /mnt/d              919G 
└─sda1      vfat    ESP                                        500M 
nvme0n1                                                        477G Samsung SSD 960 PRO 512G
├─nvme0n1p5 ext4    NVMe_Ubuntu_16.0       /                  44.6G 
├─nvme0n1p3                                                     16M 
├─nvme0n1p1 ntfs                                               450M 
├─nvme0n1p6 swap    Linux Swap             [SWAP]              7.9G 
├─nvme0n1p4 ntfs    NVMe_Win10             /mnt/c            414.9G 
├─nvme0n1p2 vfat                           /boot/efi            99M 
└─nvme0n1p7 ntfs    Shared_WSL+Linux       /mnt/e                9G 

So in this case the SSD is a Samsung Pro 960 which does indeed support TRIM command.

For more details see this Arch Linux article.

  • But I thought all modern SSDs support TRIM? And presumably all that needs to be done is add fstrim-all --no-model-check to the weekly cron? – Sina Madani Apr 19 '18 at 10:33
  • @SinaMadani as my answer taken from the Arch Linux article highlights, always run lsblk --discard first to see if TRIM is supported. Failure to do so could ruin your SSD. – WinEunuuchs2Unix Apr 19 '18 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.