# Intel X25-E - slow "hdparm -t /dev/sda"

## seVes

Hey!

I've bought a ThinkPad Edge 13 one year ago and has upgraded with a Intel X25-E 32GB SSD.

Because i'm a beginner in Linux, i've read a lots of manuals and howto's to improve the performance.

Now - 1 year later - i found out by chance, that the "Timing buffered disk reads" is getting slower than 1 year ago. Last year, i mean it was 270 MB/sec.

```
edge alex # hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:   2686 MB in  2.00 seconds = 1343.92 MB/sec

 Timing buffered disk reads: 454 MB in  3.01 seconds = 151.05 MB/sec
```

The SSD doesn't support TRIM, fstrim doesn't work aswell.

System facts:

```
edge alex # uname -a

Linux edge 2.6.39-gentoo-r3 #9 SMP PREEMPT Wed Aug 31 22:41:08 CEST 2011 x86_64 Genuine Intel(R) CPU U7300 @ 1.30GHz GenuineIntel GNU/Linux

```

```
# /etc/fstab: static file system information.

#

# <fs>            <mountpoint>                    <type>    <opts>                                      <dump/pass>

/dev/sda1                       /                       ext3      data=journal,noatime                        0 0

shm                             /dev/shm                tmpfs     nodev,nosuid,noexec                         0 0

/dev/rootvg/usr                 /usr                    ext3      data=journal,acl,noatime                    0 0

/dev/rootvg/src                 /usr/src                reiserfs  notail,acl                                  0 0

/dev/rootvg/portage             /usr/portage            reiserfs  notail,acl                                  0 0

/dev/rootvg/distfiles           /usr/portage/distfiles  ext3      data=journal,acl,noatime                    0 0

/dev/rootvg/var                 /var                    ext3      data=journal,acl,noatime                    0 0

/dev/rootvg/opt                 /opt                    reiserfs  acl,notail                                  0 0

tmpfs                           /var/tmp/portage        tmpfs     rw,noatime,nosuid,nodev,size=3000M          0 0

tmpfs                           /tmp                    tmpfs     rw,noatime,noexec,nosuid,nodev,size=500M    0 0

obexfs#-b30:38:55:7D:61:43      /media/nokia-c5-00      fuse      noauto,uid=1000,gid=1007,allow_other        0 0

```

Does anybody could help me? Where i've to look!? Maybe this are a failed configuration or something like that. Or is the SSD damaged because by too many reads/writes!?

Thanks for each suggestions...

----------

## Hypnos

First to get a reasonable measurement, do the cached read first, and do it three times:

```
# hdparm -Tt /dev/sda; hdparm -Tt /dev/sda; hdparm -Tt /dev/sda
```

from a text console (no X session active), or even better from single user mode.

Second, while writing does wear down an SSD (esp. w/o TRIM), it should not affect read performance.  On my Samsung I still get 210 MiB/s, same as when I first bought my laptop.  However, i suppose in principle if the sectors on your disk are highly fragmented since you don't have TRIM, depending on the controller you might lose read performance.

To test this, you need to backup your system and do a secure delete of the disk, which will return it to a virgin state, apart from the physical wear and tear on the blocks.

----------

## seVes

Some days later, after doing a lots of tests, i found out:

In a live-system (e.g. gentoo live-cd) the SSD gets 261 MB/sec. Looks like the SSD is okay - not damaged.  :Smile: Booting into console and doing 3-times hdparm -Tt ( i'll mark: the cached reads are always the first, doesn't matter -tT or -Tt ), i got 180-189 MB/sec. With X11: 154-165 MB/sec.The Partition alignment is okay, after checking some howto (german)'s. 

```
edge alex # fdisk -l -u /dev/sda

Disk /dev/sda: 32.0 GB, 32000000000 bytes

255 heads, 63 sectors/track, 3890 cylinders, total 62500000 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: 0x18d15351

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048      206847      102400   83  Linux

/dev/sda2          206848    62499999    31146576   8e  Linux LVM
```

What else can i do? AHCI enabled, SATA2 enabled.

I'll make a backup anywhere.

----------

## Hypnos

FWIW, I just got *higher* performance when booted-up and logged into X (~230 MiB/s) than I do off a boot USB stick (~206 MiB/s).  Always I get at least 210 MiB/s from my X session.

It's difficult to tease apart the impact of the SSD itself (because of on-disk caching and controller logic),  kernel IO mounted/unmounted, and the filesystem (caching, preallocation, etc. etc.).

To understand the performance of the SSD itself, you have to boot up from livecd/USB stick, do a secure erase on the disk, then do something like this:

```
# dd if=/dev/zero of=/dev/sda bs=1M count=1024 conv=fdatasync,notrunc

# echo 3 > /proc/sys/vm/drop_caches

# dd if=/dev/sda of=/dev/null bs=1M count=1024
```

Last time I did this I got ~140 MiB/s for the write, then ~220 MiB/s for the uncached read.

Then, after formatting, you can do the following on a mounted disk:

```
# dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc

# echo 3 > /proc/sys/vm/drop_caches

# dd if=tempfile of=/dev/null bs=1M count=1024
```

I still got ~140 MiB/s for the write.

Finally, repeat the above after restoring your data.  On this step, my write performance dropped to ~50 MiB/s -- not sure why.

----------

