jingjihui 发表于 2018-5-6 13:34:53

在Ubuntu中为ssd固态硬盘开启trim

cd/ #or whatever part of the file system is on the SSD  sudo dd if=/dev/urandom of=tempfile count=100 bs=512k oflag=direct # you will not need sudo for these to work, if your SSD is in /home for example
  sudo hdparm --fibmap tempfile
From the output copy the number under "begin_LBA" and use it in the next command. Also check the system name of your SSD: System->Administration->Disk Utility (sda, sdb, or sdc ...)sudo hdparm --read-sector 2638848 /dev/sda #replace 2638848 with the number obtained before and /sda with your SSD driveyou should receive a a long string of characters for those sectorssudo rm tempfile  sync
  sudo hdparm --read-sector 2638848 /dev/sda
even after removing the file the sectors are still not empty. Wait a while then run the command againsudo hdparm --read-sector 2638848 /dev/sdaif you get only zeros, then automatic TRIM is working.
页: [1]
查看完整版本: 在Ubuntu中为ssd固态硬盘开启trim