最後更新: 2019-02-21


找出系上的 SSD


# To check if the kernel knows about SSDs try:

grep . /sys/block/sd?/queue/rotational



為 SSD 設定 Disk 的 scheduler


# 查看 scheduler 設定

grep . /sys/block/sd?/queue/scheduler

/sys/block/sda/queue/scheduler:noop [deadline] cfq
/sys/block/sdb/queue/scheduler:noop [deadline] cfq
/sys/block/sdc/queue/scheduler:noop deadline [cfq]

# Set deadline scheduler for non-rotating disks



ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"


echo "block/sdX/queue/scheduler = deadline" >> /etc/sysfs.conf


定期 trim (fstrim)


日子久了 => degradation of write operations on SSDs

原因: 刪除了的資料沒有真正進行資料清空(erase)

系統支援 erase

OS >= Windows 7

The util-linux package provides fstrim

fstrim - discard unused blocks on a mounted filesystem


# By default, fstrim will discard all unused blocks in the filesystem.

fstrim [-o offset] [-l length] [-m minimum-free-extent] [-v] mountpoint


-m, --minimum minimum-free-extent              # Minimum contiguous free range to discard (Default value is zero => ALL )
                                                                    # (Free ranges smaller than this will be ignored.)

-v, --verbose


(2^N) suffixes KiB, MiB, GiB


fstrim -v /ssd/xpenology

/ssd/xpenology: 6.4 GiB (6856876032 bytes) trimmed




The TRIM command should be translated from one layer to another until reaching the SSD.


ext4 -> lvm -> ssd

 * 每一層都要 support TRIM


FS: btrfs, ext4 的 trim (Continuous TRIM)



# ext4

# commit=nrsec ( Default value is 5 seconds)

# This means that if you lose your power, you will lose  as much as the latest 5 seconds of work

/dev/mapper/goofy-root /               ext4     discard,noatime,commit=600,errors=remount-ro 0       1

Using the discard mount option for continuous TRIM in device operations

# btrfs

# ssd => optimizations for SSD drives

/dev/mapper/goofy-chroot /srv/chroot   btrfs    ssd,discard,noatime 0       2

 * There is no need for the discard flag if you run fstrim periodically.




2015 HW:

Samsung SSD 850 EVO 250GB

Cache Memory

Samsung SSD 850 EVO 250GB: Samsung 512 MB Low Power DDR3 SDRAM

Total/Terrabytes Bytes Written (TBW)

Samsung SSD 850 EVO 250GB: 75 TBW


V = SMART attribute #241 (Total_LBAs_Written)

V X 512 / 1024^4 = N gb

Wear_Leveling_Count (ID 177)

Samsung V-NAND 3bit MLC

This attribute represents the number of media program and erase operations
(the number of times a block has been erased).
This value is directly related to the lifetime of the SSD.
The raw value of this attribute shows the total count of P/E Cycles.

SLC: 100,000
MLC: 3,000

 * The ssd will die from other reasons before wearing out.


A count of the number of sudden power off cases.

the firmware must recover all of the mapping and user data during the next power on




SATA Express     16Gb/s     1600MB/s
SATA 3.0         6Gb/s      600MB/s
SATA 2.0         3Gb/s      300MB/s
SATA 1.0         1.5Gb/s    150MB/s



Speed test


1. Seq

速度會接近 Sata Port 的理論值

  • SATA3 : 520 MB/S
  • 非原生 SATA3 : 380 MB/S
  • SATA2 : 270 MB/S
  • SATA1 : 130 MB/S

2. 4K

6 個速度中最低者

3. 4K-64Thrd

4k, 64隊列深度




Window 's tuning


 * 關閉 Superfetch 服務

win10: sc stop SysMain & sc config SysMain start= disabled

 * 關閉 Windows Search 服務

 * 關閉 contents index

right click on SSD Drive

Click "Properties" then uncheck “Allow files on this drive to have contents indexed in addition to file properties“.

 * 關閉休眠(hibernate)功能

powercfg -h off

 * Disable 碎片整理 (會認到係 SSD)[每更]

 * Turn Off the Page File

 * Verify TRIM is Functioning:

# If it’s set to “1”, TRIM is disabled and you need to enable it. This is rare, however.

NTFS DisableDeleteNotify = 0  (Disabled)
ReFS DisableDeleteNotify = 0  (Disabled)

fsutil behavior query DisableDeleteNotify





linux 認唔到 M.2 NVMe PCIe SSD 時  => uefi boot  -> legacy boot


Window 7 install on SSD





intelide(有開啟AHCI模式) < msahci < iastora ...

Intel Driver

  • iaStorA      驅動程式模組是 Intel SATA AHCI Driver
  • iaStorAC    驅動程式模組是 Intel SATA AHCI RAID Driver
  • iaStorAVC




If you are planning on doing a huge amount of writes (more than 40-50 GB per day), it is advised to avoid SSDs that use TLC NAND.