Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

[Solved] SSD slow according to hdparm

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
17 posts • Page 1 of 1
Author
Message
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

[Solved] SSD slow according to hdparm

  • Quote

Post by hoerbe » Thu Jan 06, 2011 1:45 pm

Hi,

I have a Thinkpad T61 and just installed Gentoo on "Crucial RealSSD C300 128GB". According to hdparm the SSD performs much worse than it should:

Code: Select all

hdparm  -t /dev/sda

/dev/sda:
 Timing buffered disk reads:  404 MB in  3.00 seconds = 134.63 MB/sec
What can I do to achieve better throughput?
Last edited by hoerbe on Fri Jan 07, 2011 12:07 am, edited 2 times in total.
Top
aderesch
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Sat Mar 06, 2010 10:58 am
Location: Hamburg, Germany

Re: SSD slow accodrding to hdparm

  • Quote

Post by aderesch » Thu Jan 06, 2011 2:57 pm

What kernel are you using, which IO scheduler, and what's the read_ahead_kb value? The latter two values can be read/modified inside /sys/block/sda/queue (replace sda with your device name if different). You might want to try with the deadline or noop scheduler and an increased read_ahead_kb value (up to 8192 seems reasonable). Also, what is the drive's firmware version?

ad
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Thu Jan 06, 2011 3:16 pm

Code: Select all

uname -a
Linux odin 2.6.36-gentoo-r5 #19 SMP PREEMPT Thu Jan 6 13:29:18 CET 2011 x86_64 Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz GenuineIntel GNU/Linux

Code: Select all

cat /sys/block/sda/queue/read_ahead_kb 
128
almost no improvement with:

Code: Select all

echo 8192 > /sys/block/sda/queue/read_ahead_kb
hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads:  412 MB in  3.01 seconds = 136.92 MB/sec
shall I set it back to 128?

Code: Select all

cat /sys/block/sda/queue/scheduler 
[noop] deadline cfq
I've the latest firmware - is is called 06 or so.

I just read something about trim and alignment. Can that be a reason too?
Currently I have:

Code: Select all

fdisk -lu /dev/sda

Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x26a344a5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63      112454       56196   83  Linux
/dev/sda2          112455     8514449     4200997+  82  Linux swap / Solaris
/dev/sda3         8514450   199366649    95426100   83  Linux
/dev/sda4       199366650   250067789    25350570    b  W95 FAT32
Top
aderesch
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Sat Mar 06, 2010 10:58 am
Location: Hamburg, Germany

  • Quote

Post by aderesch » Thu Jan 06, 2011 3:36 pm

hoerbe wrote:shall I set it back to 128?
Probably doesn't matter for now. When I got my SSD there was a significant improvement turning this up, but rechecking now I also only see a small difference. Keep this value in mind for further testing, though.
hoerbe wrote:I just read something about trim and alignment. Can that be a reason too?
Not for the hdparm read test, I'd say.

Another thing: What SATA controller do you have, and what mode is it running in? (AHCI? What speed?) Your transfer rate is suspiciously close to the theoretical maximum of SATA 1.5 Gb/s.

ad
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Thu Jan 06, 2011 3:52 pm

Thanks for your quick reply!

I think it is best to come back to the trim and alignment stuff later...

SATA controller from lspci -v

Code: Select all

00:1f.2 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 03) (prog-if 01 [AHCI 1.0])
	Subsystem: Lenovo ThinkPad T61
	Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 46
	I/O ports at 1c48 [size=8]
	I/O ports at 1c1c [size=4]
	I/O ports at 1c40 [size=8]
	I/O ports at 1c18 [size=4]
	I/O ports at 1c20 [size=32]
	Memory at fe226000 (32-bit, non-prefetchable) [size=2K]
	Capabilities: [80] MSI: Enable+ Count=1/4 Maskable- 64bit-
	Capabilities: [70] Power Management version 3
	Capabilities: [a8] SATA HBA <?>
	Kernel driver in use: ahci
how can I check in what mode it is running?

Edit:

Code: Select all

hdparm -i /dev/sda

/dev/sda:

 Model=C300-CTFDDAC128MAG, FwRev=0006, SerialNo=00000000104502FF0704
 Config={ Fixed DTR>10Mbs }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=250069680
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-3,4,5,6,7
Edit II:
BIOS is set to AHCI.
Top
aderesch
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Sat Mar 06, 2010 10:58 am
Location: Hamburg, Germany

  • Quote

Post by aderesch » Thu Jan 06, 2011 4:15 pm

hoerbe wrote:how can I check in what mode it is running?
All kernel log messages concerning drive and controller would be of interest. Also, your fdisk output shows a FAT partition -- can you get measurements from Windows?

ad
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Thu Jan 06, 2011 4:26 pm

Hmm, currently I have no Windows installed...

Code: Select all

dmesg | grep ahci
[    0.383098] ahci 0000:00:1f.2: version 3.0
[    0.383120] ahci 0000:00:1f.2: PCI INT B -> GSI 16 (level, low) -> IRQ 16
[    0.383811] ahci 0000:00:1f.2: irq 46 for MSI/MSI-X
[    0.383904] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 3 ports 1.5 Gbps 0x1 impl SATA mode
[    0.384729] ahci 0000:00:1f.2: flags: 64bit ncq sntf pm led clo pio slum part ccc 
[    0.385459] ahci 0000:00:1f.2: setting latency timer to 64
[    0.385597] scsi0 : ahci
[    0.386053] scsi1 : ahci
[    0.386495] scsi2 : ahci

Code: Select all

dmesg | grep sda
[    0.000000] Command line: root=/dev/sda3 rw rootfstype=ext4 vga=869
[    0.000000] Kernel command line: root=/dev/sda3 rw rootfstype=ext4 vga=869
[    1.023247] sd 0:0:0:0: [sda] 250069680 512-byte logical blocks: (128 GB/119 GiB)
[    1.068954] sd 0:0:0:0: [sda] Write Protect is off
[    1.114689] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.114712] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.162079]  sda: sda1 sda2 sda3 sda4
[    1.185830] sd 0:0:0:0: [sda] Attached SCSI disk
[    4.957898] PM: Checking image partition /dev/sda2
[    5.363231] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[    7.383781] EXT4-fs (sda3): re-mounted. Opts: discard
[    7.475749] EXT4-fs (sda3): re-mounted. Opts: discard
[    7.791782] EXT4-fs (sda1): mounted filesystem without journal. Opts: (null)
[    7.942693] Adding 4200992k swap on /dev/sda2.  Priority:-1 extents:1 across:4200992k SS
[   40.403646] EXT4-fs (sda3): re-mounted. Opts: discard,commit=0
any more?
Top
aderesch
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Sat Mar 06, 2010 10:58 am
Location: Hamburg, Germany

  • Quote

Post by aderesch » Thu Jan 06, 2011 4:44 pm

hoerbe wrote:

Code: Select all

[    0.383904] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 3 ports 1.5 Gbps 0x1 impl SATA mode
A few of the missing lines would have been interesting (especially those containing "SATA link up"), but the 1.5 Gbps in the above line does not look promising at all.
A quick google search for

Code: Select all

ich8m sata 3.0Gbps
leads me to the following:
http://forum.thinkpads.com/viewtopic.php?f=27&t=84953

So it seems your chipset is indeed artificially restricted to 1.5Gbps (~150MB/s) by the BIOS.

ad
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Thu Jan 06, 2011 5:21 pm

Indeed! SATA II seem to be locked to 1.5 Gbps on the Thinkpad T61 models!
There is a patched BIOS out there that removes the lock. It is reported to work!

What do you think about the alignment question. Is it worth doing it?
As far as I figured out, one could use fdisk -H 32 -S 32 /dev/sda, and start the first partition at cylinder 2 (link).
Top
aderesch
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Sat Mar 06, 2010 10:58 am
Location: Hamburg, Germany

  • Quote

Post by aderesch » Thu Jan 06, 2011 5:48 pm

hoerbe wrote:What do you think about the alignment question. Is it worth doing it?
As far as I figured out, one could use fdisk -H 32 -S 32 /dev/sda, and start the first partition at cylinder 2 (link).
I don't see any drawbacks (discounting waste of a negligible amount of disk space), so I wouldn't (and didn't) take any chances.
Since I couldn't get any reliable information about the erase block size of my drive (it was very new at the time), I actually went with -H 64 and aligned everything to multiples of 1MB. Be careful about your units (e.g. cylinder 2), as fdisk's default units are actually sectors (not cylinders) nowadays.

ad
Top
albright
Advocate
Advocate
User avatar
Posts: 2588
Joined: Sun Nov 16, 2003 6:36 pm
Location: Near Toronto

  • Quote

Post by albright » Thu Jan 06, 2011 6:18 pm

I just tried the modified BIOS (1.10-1.01) you linked to on my thinkpad
x300 -- hdparm went from 133 MB/sec to 186 MB/sec !!! (I have the
standard 128gb samsung ssd - not a real speed demon but this is excellent
read performance)

thanks for pointing this out.
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Thu Jan 06, 2011 7:18 pm

Me either! Works great.

Code: Select all

hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads:  790 MB in  3.00 seconds = 263.27 MB/sec
Currently on my not-aligned ext4 partition I observed the following speeds:
Write:

Code: Select all

dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 8.36605 s, 128 MB/s
Read:

Code: Select all

echo 3 > /proc/sys/vm/drop_caches
dd if=tempfile of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.89939 s, 275 MB/s
As soon as I have some time left I'll re-align the disk partitions and report the results.
Whats the best way of doing that? A fresh install (stage4)?
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Fri Jan 07, 2011 12:05 am

I now aligned the partitions using fdisk -H 32 -S 32 /dev/sda.
The read/write tests on ext4 reported more or less the same results.

Using echo 8192 > /sys/block/sda/queue/read_ahead_kb and/or hdparm -W 0 /dev/sda brings no improvement as well.
I think thats it! Approx. 270 MB/s read and 130 MB/s write seems to be what I can get out of the disk.

Thanks for the help.
Top
marwat208
n00b
n00b
User avatar
Posts: 3
Joined: Mon Oct 31, 2005 5:59 am
Location: Merritt Island, Florida

  • Quote

Post by marwat208 » Sat Jan 08, 2011 7:10 pm

Someone more knowledgeable than me correct me if I'm wrong...

Code: Select all

/dev/sda2          112455     8514449     4200997+  82  Linux swap / Solaris 
Swap on an SSD is not so good for the drive life and performance.
Of all sad words of tongue and pen, the saddest are these; it might have been
Top
hoerbe
n00b
n00b
Posts: 51
Joined: Sat Sep 04, 2004 1:02 pm
Location: Switzerland
Contact:
Contact hoerbe
Website

  • Quote

Post by hoerbe » Sat Jan 08, 2011 10:14 pm

Sure. But one does not have much choise with a laptop. In addition swap space is rarely used if you have enough memory.
Top
pigeon768
l33t
l33t
Posts: 683
Joined: Mon Jan 02, 2006 1:13 pm

  • Quote

Post by pigeon768 » Mon Jan 10, 2011 10:16 pm

Setting swappiness to 0 is also a good idea with swap on SSD.
Top
Tolstoi
l33t
l33t
User avatar
Posts: 678
Joined: Thu May 20, 2004 8:06 am

  • Quote

Post by Tolstoi » Sun Apr 17, 2011 7:14 am

aderesch wrote:
hoerbe wrote:

Code: Select all

[    0.383904] ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 3 ports 1.5 Gbps 0x1 impl SATA mode
A few of the missing lines would have been interesting (especially those containing "SATA link up"), but the 1.5 Gbps in the above line does not look promising at all.
A quick google search for

Code: Select all

ich8m sata 3.0Gbps
leads me to the following:
http://forum.thinkpads.com/viewtopic.php?f=27&t=84953

So it seems your chipset is indeed artificially restricted to 1.5Gbps (~150MB/s) by the BIOS.

ad
There's a BIOS around for some Thinkpad models like the T61 which disables the 1.5 Gbps limitation. I've just flashed my BIOS last week with it.
Top
Post Reply

17 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy