精简Ubuntu SSD,现在速度非常慢

分享于 

12分钟阅读

ubuntu

  繁體

问题


lptp [ blah ]: sudo hdparm -Tt /dev/sda



/dev/sda:


 Timing cached reads: 10202 MB in 2.00 seconds = 5103.20 MB/sec


 Timing buffered disk reads: 128 MB in 3.06 seconds = 41.88 MB/sec



请参见缓冲磁盘读取速度!非常慢,当我第一次设置笔记本电脑时,看到的速度超过了400MB/sec,这是一台较旧的笔记本电脑。

这是我的/etc/fstab。我已启用修剪,手动运行修剪,启用/禁用功能,重新启动等等。


/dev/mapper/ubuntu--gnome--vg-root / ext4 noatime,nodiratime,errors=remount-ro,barrier=0,discard 0 1




noatime,nodiratime,errors=remount-ro,barrier=0,discard




 lptp [ blah ]: lsb_release -a


No LSB modules are available.


Distributor ID: Ubuntu


Description: Ubuntu 16.04.1 LTS


Release: 16.04


Codename: xenial



Smartctl输出:


 lptp [ blah ]: sudo smartctl /dev/sda -a


smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-38-generic] (local build)


Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org



=== START OF INFORMATION SECTION ===


Device Model: Crucial_CT750MX300SSD1


Serial Number: XXXXXX


LU WWN Device Id: 5 XXXXX XXXXXXX


Firmware Version: M0CR011


User Capacity: 750,156,374,016 bytes [750 GB]


Sector Size: 512 bytes logical/physical


Rotation Rate: Solid State Device


Form Factor: 2.5 inches


Device is: Not in smartctl database [for details use: -P showall]


ATA Version is: ACS-3 T13/2161-D revision 5


SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)


Local Time is: Tue Nov 1 21:22:05 2016 CDT


SMART support is: Available - device has SMART capability.


SMART support is: Enabled



=== START OF READ SMART DATA SECTION ===


SMART overall-health self-assessment test result: PASSED



General SMART Values:


Offline data collection status: (0x00) Offline data collection activity


 was never started.


 Auto Offline Data Collection: Disabled.


Self-test execution status: ( 0) The previous self-test routine completed


 without error or no self-test has ever 


 been run.


Total time to complete Offline 


data collection: ( 1987) seconds.


Offline data collection


capabilities: (0x7b) SMART execute Offline immediate.


 Auto Offline data collection on/off support.


 Suspend Offline collection upon new


 command.


 Offline surface scan supported.


 Self-test supported.


 Conveyance Self-test supported.


 Selective Self-test supported.


SMART capabilities: (0x0003) Saves SMART data before entering


 power-saving mode.


 Supports SMART auto save timer.


Error logging capability: (0x01) Error logging supported.


 General Purpose Logging supported.


Short self-test routine 


recommended polling time: ( 2) minutes.


Extended self-test routine


recommended polling time: ( 10) minutes.


Conveyance self-test routine


recommended polling time: ( 3) minutes.


SCT capabilities: (0x0035) SCT Status supported.


 SCT Feature Control supported.


 SCT Data Table supported.



SMART Attributes Data Structure revision number: 16


Vendor Specific SMART Attributes with Thresholds:


ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE


 1 Raw_Read_Error_Rate 0x002f 100 100 000 Pre-fail Always - 0


 5 Reallocated_Sector_Ct 0x0032 100 100 010 Old_age Always - 0


 9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 52


 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 41


171 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 0


172 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 0


173 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 1


174 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 11


183 Runtime_Bad_Block 0x0032 100 100 000 Old_age Always - 0


184 End-to-End_Error 0x0032 100 100 000 Old_age Always - 0


187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0


194 Temperature_Celsius 0x0022 059 052 000 Old_age Always - 41 (Min/Max 21/48)


196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0


197 Current_Pending_Sector 0x0032 100 100 000 Old_age Always - 0


198 Offline_Uncorrectable 0x0030 100 100 000 Old_age Offline - 0


199 UDMA_CRC_Error_Count 0x0032 100 100 000 Old_age Always - 0


202 Unknown_SSD_Attribute 0x0030 100 100 001 Old_age Offline - 0


206 Unknown_SSD_Attribute 0x000e 100 100 000 Old_age Always - 0


246 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 138859820


247 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 4354463


248 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 1675456


180 Unused_Rsvd_Blk_Cnt_Tot 0x0033 000 000 000 Pre-fail Always - 3558


210 Unknown_Attribute 0x0032 100 100 000 Old_age Always - 0



SMART Error Log Version: 1


No Errors Logged



SMART Self-test log structure revision number 1


No self-tests have been logged. [To run self-tests, use: smartctl -t]



SMART Selective self-test log data structure revision number 1


 SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS


 1 0 0 Not_testing


 2 0 0 Not_testing


 3 0 0 Not_testing


 4 0 0 Not_testing


 5 0 0 Not_testing


Selective self-test flags (0x0):


 After scanning selected spans, do NOT read-scan remainder of disk.


If Selective self-test is pending on power-up, resume after 0 minute delay.



测试了特定的设备(/dev/sda1 ),但速度很慢:


lptp [ ~ ]: sudo hdparm -Tt /dev/sda1



/dev/sda1:


 Timing cached reads: 13130 MB in 2.00 seconds = 6568.77 MB/sec


 Timing buffered disk reads: 128 MB in 3.06 seconds = 41.79 MB/sec



在逻辑分区上也进行了测试:


 lptp [ ~ ]: sudo hdparm -Tt /dev/mapper/ubuntu--gnome--vg-root 



/dev/mapper/ubuntu--gnome--vg-root:


 Timing cached reads: 11468 MB in 2.00 seconds = 5736.85 MB/sec


 Timing buffered disk reads: 178 MB in 3.04 seconds = 58.47 MB/sec



这个测试表明,它甚至比hdparm显示的速度慢。


 lptp [ blah ]: dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc status=progress


1024+0 records in


1024+0 records out


1073741824 bytes (1.1 GB, 1.0 GiB) copied, 35.0156 s, 30.7 MB/s


 lptp [ blah ]: sudo bash -c"echo 3 > /proc/sys/vm/drop_caches"


 lptp [ blah ]: dd if=tempfile of=/dev/null bs=1M count=1024 status=progress


1066401792 bytes (1.1 GB, 1017 MiB) copied, 34.0193 s, 31.3 MB/s


1024+0 records in


1024+0 records out


1073741824 bytes (1.1 GB, 1.0 GiB) copied, 34.256 s, 31.3 MB/s



以下是笔记本电脑的分区对齐方式:


lptp [ ~ ]: sudo parted


GNU Parted 3.2


Using /dev/sda


Welcome to GNU Parted! Type 'help' to view a list of commands.


(parted) p 


Model: ATA Crucial_CT750MX3 (scsi)


Disk /dev/sda: 750GB


Sector size (logical/physical): 512B/512B


Partition Table: msdos


Disk Flags: 



Number Start End Size Type File system Flags


 1 1049kB 512MB 511MB primary ext2 boot


 2 513MB 750GB 750GB extended


 5 513MB 750GB 750GB logical



(parted) align-check opt 1 


1 aligned


(parted) align-check opt 2


2 not aligned


(parted) align-check opt 5


5 aligned


(parted)



另外,这里是fdisk -l的分区


Device Boot Start End Sectors Size Id Type


/dev/sda1 * 2048 999423 997376 487M 83 Linux


/dev/sda2 1001470 1465147391 1464145922 698.2G 5 Extended


/dev/sda5 1001472 1465147391 1464145920 698.2G 83 Linux



UPDATE :fixed =i将调度程序更改为noop调度程序(而不是最后期限),这有效(通过将/etc/default/grub更改为有行来这样做:


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"



然后使用sudo update-grub2更新grub,并重新启动。


 lptp [ ~ ]: sudo hdparm -Tt /dev/sda



/dev/sda:


 Timing cached reads: 12388 MB in 2.00 seconds = 6197.19 MB/sec


 Timing buffered disk reads: 1454 MB in 3.00 seconds = 484.59 MB/sec



fstab中的选项是:


noatime,nodiratime,errors=remount-ro,barrier=0




答案1

快速答案:


sudo hdparm -B254 /dev/sda



以下是我对MX300 SSD在电池供电时启动的经验:


root@ubuntu:~# hdparm -B /dev/sda



/dev/sda:


 APM_level = 128



root@ubuntu:~# hdparm -t /dev/sda



/dev/sda:


 Timing buffered disk reads: 94 MB in 3.02 seconds = 31.11 MB/sec



root@ubuntu:~# hdparm -B254 /dev/sda



/dev/sda:


 setting Advanced Power Management level to 0xfe (254)


 APM_level = 254



root@ubuntu:~# hdparm -t /dev/sda



/dev/sda:


 Timing buffered disk reads: 1466 MB in 3.00 seconds = 488.44 MB/sec




答案2

回答:引导时插入。


答案3

检查/etc/hdparm.conf,在那里你可以为电源和电池模式配置apm级别。

添加


apm = 254


apm_battery = 254



到/etc/hdparm.conf


答案4

请使用足够新的内核(v4.15 +),尝试使用med_power_with_dipm.



ext  fast  Ubuntu  slow  TRIM  
相关文章