Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] PCie NVMe SSD & "trim" (Read 3595 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] PCie NVMe SSD & "trim"

I recently got a new laptop computer which is equipped with an PCIe NVMe SSD. It is the first SSD for me (I am behind the times and have been running old hardware for years). I have been doing some research and have succeeded in getting myself more confused instead of less.  ???
What I would like to know is whether it is necessary to "trim" my ssd periodically, and if so, what is the best method of implementing that process? Thanks in advance for any help.

Best regards.



Code: [Select]
angus-labtop:[angus]:~$ pinxi  
[sudo] password for angus:
System:    Host: angus-labtop Kernel: 5.9.14-artix1-1 x86_64 bits: 64 compiler: gcc v: 10.2.0
          parameters: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=c5a4dabe-4281-40a5-aca0-b9e1dae04dd6 rw net.ifnames=0 quiet
          Console: tty 1 wm: kwin_x11 DM: SDDM Distro: Artix Linux
Machine:  Type: Laptop System: Star Labs product: LabTop v: Mk IV serial: L400001
          Mobo: Star Labs Online Limited model: LabTop v: Mk IV serial: L40000 UEFI: American Megatrends v: 2.2.0
          date: 12/16/2020
Battery:  ID-1: BAT0 charge: 46.7 Wh condition: 46.5/45.6 Wh (102%) volts: 8.7/7.6 model: GDPT CN6613-2S3P type: Unknown
          serial: 6UA3 status: Unknown
          Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M187 serial: 4019-03-e8-c0-b4
          charge: 55% (should be ignored) rechargeable: yes status: Discharging
Memory:    RAM: total: 15.51 GiB used: 1.36 GiB (8.8%)
          Array-1: capacity: 32 GiB slots: 2 EC: None max module size: 16 GiB note: est.
          Device-1: ChannelA-DIMM0 size: 8 GiB speed: 2667 MT/s type: DDR4 detail: synchronous bus width: 64 bits
          total: 64 bits manufacturer: Micron part-no: 4ATF51264HZ-2G3BZ serial: B300F747
          Device-2: ChannelB-DIMM0 size: 8 GiB speed: 2667 MT/s type: DDR4 detail: synchronous bus width: 64 bits
          total: 64 bits manufacturer: Micron part-no: 4ATF51264HZ-2G3BZ serial: B300F747
PCI Slots: Slot: 0 type: x16 PCI Express J6B2 status: In Use length: Long
          Slot: 1 type: x1 PCI Express J6B1 status: In Use length: Short
          Slot: 2 type: x1 PCI Express J6D1 status: In Use length: Short
          Slot: 3 type: x1 PCI Express J7B1 status: In Use length: Short
          Slot: 4 type: x1 PCI Express J8B4 status: In Use length: Short
CPU:      Info: Dual Core model: Intel Core i3-10110U socket: BGA1528 (U3E1) note: check bits: 64 type: MT MCP
          arch: Kaby Lake note: check family: 6 model-id: 8E (142) stepping: C (12) microcode: D6 L1 cache: 128 KiB
          L2 cache: 4 MiB L3 cache: 3.9 MiB bogomips: 16807
          Speed: 900 MHz min/max: 400/4100 MHz base/boost: 1980/8300 volts: 0.8 V ext-clock: 100 MHz Core speeds (MHz):
          1: 900 2: 900 3: 900 4: 900
          Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2
          bts clflush clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64 dtherm dts epb ept ept_ad erms
          est f16c flexpriority flush_l1d fma fpu fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs
          ibrs_enhanced ida intel_pt invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor movbe mpx msr mtrr
          nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pts rdrand rdseed
          rdtscp rep_good sdbg sep smap smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc
          tsc_adjust tsc_deadline_timer vme vmx vnmi vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
          Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
          Type: l1tf status: Not affected
          Type: mds status: Not affected
          Type: meltdown status: Not affected
          Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp
          Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
          Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB filling
          Type: srbds mitigation: TSX disabled
          Type: tsx_async_abort status: Not affected
Graphics:  Device-1: Intel UHD Graphics driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:9b41
          Device-2: Realtek USB Camera type: USB driver: uvcvideo bus ID: 1-7:4 chip ID: 0bda:3031 serial: 200901010001
          Display: server: X.Org 1.20.10 compositor: kwin_x11 driver: intel unloaded: fbdev,modesetting,vesa display ID: :0
          screens: 1
          Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9")
          OpenGL: renderer: Mesa Intel UHD Graphics (CML GT2) v: 4.6 Mesa 20.3.1 direct render: Yes
Audio:    Device-1: Intel vendor: Realtek driver: snd_hda_intel v: kernel alternate: snd_soc_skl,snd_sof_pci bus ID: 00:1f.3
          chip ID: 8086:02c8
          Sound Server: ALSA v: k5.9.14-artix1-1
Network:  Device-1: Intel Wireless-AC 9462 driver: iwlwifi v: kernel port: 3000 bus ID: 00:14.3 chip ID: 8086:02f0
          IF: wlan0 state: up mac: cc:d9:ac:ee:0a:de
          IP v4: 192.168.2.17/24 type: dynamic noprefixroute scope: global broadcast: 192.168.2.255
          IP v6: fe80::647f:993b:a178:f2f3/64 type: noprefixroute scope: link
          WAN IP: 159.2.173.76
Logical:  Message: No LVM data was found.
RAID:      Message: No RAID data was found.
Drives:    Local Storage: total: 447.13 GiB used: 64.02 GiB (14.3%)
          ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Seagate model: Star Drive PCIe SSD size: 447.13 GiB block size:
          physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 serial: 288E0707025302348469 rev: ECFM22.6 temp: 25.9 C
          SMART: yes health: PASSED on: 18d 4h cycles: 243 read-units: 446,806 [228 GB] written-units: 638,122 [326 GB]
          Message: No Optical or Floppy data was found.
Partition: ID-1: / raw size: 446.83 GiB size: 438.82 GiB (98.21%) used: 64.02 GiB (14.6%) fs: ext4 block size: 4096 B
          dev: /dev/nvme0n1p2 maj-min: 259:2 label: N/A uuid: c5a4dabe-4281-40a5-aca0-b9e1dae04dd6
          ID-2: /boot/efi raw size: 300 MiB size: 299.4 MiB (99.80%) used: 280 KiB (0.1%) fs: vfat block size: 512 B
          dev: /dev/nvme0n1p1 maj-min: 259:1 label: N/A uuid: 9E1B-7DB4
Swap:      Alert: No Swap data was found.
Unmounted: Message: No Unmounted partitions found.
USB:      Hub: 1-0:1 info: Full speed (or root) Hub ports: 12 rev: 2.0 speed: 480 Mb/s chip ID: 1d6b:0002
          Device-1: 1-4:2 info: Realtek RTS5129 Card Reader Controller type: <vendor specific>
          driver: rtsx_usb,rtsx_usb_ms,rtsx_usb_sdmmc interfaces: 1 rev: 2.0 speed: 480 Mb/s chip ID: 0bda:0129
          serial: 20100201396000000
          Device-2: 1-6:3 info: Logitech Unifying Receiver type: Mouse,HID driver: logitech-djreceiver,usbhid interfaces: 2
          rev: 2.0 speed: 12 Mb/s chip ID: 046d:c52f
          Device-3: 1-7:4 info: Realtek USB Camera type: Video driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s
          chip ID: 0bda:3031 serial: 200901010001
          Device-4: 1-10:5 info: Intel type: Bluetooth driver: btusb interfaces: 2 rev: 2.0 speed: 12 Mb/s chip ID: 8087:0026
          Hub: 2-0:1 info: Full speed (or root) Hub ports: 6 rev: 3.1 speed: 10 Gb/s chip ID: 1d6b:0003
Sensors:  System Temperatures: cpu: 33.0 C mobo: N/A
          Fan Speeds (RPM): N/A
Repos:    Packages: pacman: 1103 lib: 228
          Active pacman repo servers in: /etc/pacman.conf
          1: https://universe.artixlinux.org/$arch
          Active pacman repo servers in: /etc/pacman.d/mirrorlist
          1: http://mirror1.artixlinux.org/repos/$repo/os/$arch
          2: https://mirrors.dotsrc.org/artix-linux/repos/$repo/os/$arch
          3: http://mirrors.redcorelinux.org/artixlinux/$repo/os/$arch
          4: https://eu-mirror.artixlinux.org/repos/$repo/os/$arch
          5: https://artix.rw-net.de/repos/$repo/os/$arch
          6: https://artix.unixpeople.org/repos/$repo/os/$arch
          7: https://quantum-mirror.hu/mirrors/pub/artix-linux/$repo/os/$arch
          8: https://ftp.sh.cvut.cz/artix-linux/$repo/os/$arch
          9: http://ftp.ntua.gr/pub/linux/artix-linux/$repo/os/$arch
          10: https://ftp.cc.uoc.gr/mirrors/linux/artixlinux/$repo/os/$arch
          11: https://mirror.linux.pizza/artix-linux/$repo/os/$arch
          12: https://artix.cccp.io/$repo/os/$arch
          13: https://mirror.clarkson.edu/artix-linux/repos/$repo/os/$arch
          14: https://mirrors.tuna.tsinghua.edu.cn/artixlinux/$repo/os/$arch
          15: https://mirror.maakpain.kro.kr/artix/$repo/os/$arch
          16: https://us-mirror.artixlinux.org/$repo/os/$arch
          17: https://artix.wheaton.edu/repos/$repo/os/$arch
          18: https://mirrors.cloud.tencent.com/artixlinux/$repo/os/$arch
          19: http://www.nylxs.com/mirror/repos/$repo/os/$arch
          20: https://mirrors.nettek.us/artix-linux/$repo/os/$arch
          Active pacman repo servers in: /etc/pacman.d/mirrorlist-arch
          1: http://mirror.sergal.org/archlinux/$repo/os/$arch
          2: http://mirror.cedille.club/archlinux/$repo/os/$arch
          3: https://mirror.scd31.com/arch/$repo/os/$arch
          4: http://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/$arch
          5: https://mirror.sergal.org/archlinux/$repo/os/$arch
          6: http://mirror2.evolution-host.com/archlinux/$repo/os/$arch
          7: http://mirror.scd31.com/arch/$repo/os/$arch
          8: http://mirror.its.dal.ca/archlinux/$repo/os/$arch
          9: https://mirror2.evolution-host.com/archlinux/$repo/os/$arch
          10: https://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/$arch
          11: https://muug.ca/mirror/archlinux/$repo/os/$arch
          12: http://archlinux.mirror.colo-serv.net/$repo/os/$arch
          13: http://archlinux.mirror.rafal.ca/$repo/os/$arch
          14: http://muug.ca/mirror/archlinux/$repo/os/$arch
Processes: CPU top: 5 of 190
          1: cpu: 10.5% command: vivaldi-bin pid: 3774 mem: 161.7 MiB (1.0%)
          2: cpu: 8.5% command: vivaldi-bin pid: 3059 mem: 127.1 MiB (0.8%)
          3: cpu: 7.5% command: vivaldi-bin pid: 3101 mem: 129.4 MiB (0.8%)
          4: cpu: 3.9% command: vivaldi-bin pid: 3100 mem: 147.4 MiB (0.9%)
          5: cpu: 3.2% command: vivaldi-bin pid: 3026 mem: 239.5 MiB (1.5%)
          Memory top: 5 of 190
          1: mem: 239.5 MiB (1.5%) command: vivaldi-bin pid: 3026 cpu: 3.2%
          2: mem: 200.8 MiB (1.2%) command: plasmashell pid: 2818 cpu: 0.9%
          3: mem: 161.7 MiB (1.0%) command: vivaldi-bin pid: 3774 cpu: 10.5%
          4: mem: 147.4 MiB (0.9%) command: vivaldi-bin pid: 3100 cpu: 3.9%
          5: mem: 129.4 MiB (0.8%) command: vivaldi-bin pid: 3101 cpu: 7.5%
Info:      Processes: 190 Uptime: 7m wakeups: 5 Init: N/A v: N/A rc: OpenRC v: 0.42.1 runlevel: default Compilers: gcc: 10.2.0
          Shell: Bash (sudo) v: 5.1.4 running in: konsole pinxi: 3.2.01-1


Edit: The link in @aliums post Here: https://blog.100tb.com/how-to-keep-your-ssds-fast-with-trim-on-linux
doesn't work for me.
We should try to be kind to everyone.....we are all fighting some sort of battle.

Re: PCie NVMe SSD & "trim"

Reply #1
Please check this article carefully: https://wiki.archlinux.org/index.php/Solid_state_drive#TRIM
Incorrect trimming can cause data loss. And there are different characteristics and tools for some file systems.
That said, it's usually recommenden to trim periodically, ie using cronie.
Continuous trim is an also an option, but less recommended.


 

Re: PCie NVMe SSD & "trim"

Reply #3
Thanks for you reply @alium.....however the link you provided will not load for me.

Best regards.
We should try to be kind to everyone.....we are all fighting some sort of battle.

Re: PCie NVMe SSD & "trim"

Reply #4
Thanks for you reply @alium.....however the link you provided will not load for me.

Best regards.
i understant now :-)

How To Schedule TRIM To Erase SSD Data Blocks

This is where TRIM comes in. TRIM is a command built into the ATA command set for SSDs that is part of how the disk interfaces with the computer. The operating system is able to send TRIM commands to the disk to let it know which blocks are part of deleted files, and allow the SSD to erase the blocks in advance of needing to write to them. While the operating system is capable of signaling the drive to erase these sections every time they delete a file on the file system, this can also have an impact on performance and slow things down. So the recommendation is to run TRIM on a schedule to clear the blocks intermittently.

To activate the TRIM function you need to use the fstrim command at the command line. It needs to be run with root privileges to work and should be already installed. You can test it with the following command:

sudo fstrim -a -v

The -a flag tells fstrim to check all available valid partitions and the -v flag provides a verbose output showing you what fstrim has done. You should see the output from the command to see how things went and if you get a positive output you can then look to adding the command to your cron entries. Note that for Ubuntu systems from 14.10 onwards fstrim is already configured to run for you and you should find a script for scheduling at /etc/cron.weekly/fstrim that activates it for you.

If that file doesn’t exist on your system then you will need to create it with the following command:

sudo nano /etc/cron.weekly/fstrim

Then paste in the following code:

Code: [Select]
#!/bin/bash

/usr/bin/fstrim -av > /var/log/trim.log || true

Save and exit the file, then make it executable with the following command:

Code: [Select]
sudo chmod +x /etc/cron.weekly/fstrim

The fstrim command will now be run on a weekly basis by cron on your system. If your system has lots of file deletions taking place then it may be that you will see more benefit by running the fstrim command daily. To do this, move the file from the /etc/cron.weekly directory to the /etc/cron.daily directory.

(text copied and edited from this blog, which now not works )

Re: PCie NVMe SSD & "trim"

Reply #5
Thanks @alium:)
I am going to follow the instructions to create the cron entry.

Best regards.
We should try to be kind to everyone.....we are all fighting some sort of battle.

Re: PCie NVMe SSD & "trim"

Reply #6
I used archive, the blog really not works...  ;D 
You are welcome...
Regards,