# Poor hdparm results for Samsung HD204UI hard disk.

## trumee

Hi,

I am getting very poor hdparm results for my hard disk. It is a samsung HD204UI 2TB hard disk.

```

#hdparm -Tt /dev/sdd

/dev/sdd:

 Timing cached reads:   2652 MB in  2.00 seconds = 1325.80 MB/sec

 Timing buffered disk reads:   22 MB in  3.15 seconds =   6.99 MB/sec

#smartctl -i -q noserial /dev/sdd

smartctl 5.39.1 2010-01-28 r3054 [i686-pc-linux-gnu] (openSUSE RPM)

Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===

Device Model:     SAMSUNG HD204UI

Firmware Version: 1AQ10001

User Capacity:    2,000,398,934,016 bytes

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

ATA Version is:   8

ATA Standard is:  ATA-8-ACS revision 6

Local Time is:    Tue Aug 20 00:20:12 2013 IST

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

```

On the same system the Western Digital is working quite well.

```

#hdparm -Tt /dev/sda

/dev/sda:

 Timing cached reads:   2564 MB in  2.00 seconds = 1282.26 MB/sec

 Timing buffered disk reads:  306 MB in  3.00 seconds = 101.87 MB/sec

#smartctl -i -q noserial /dev/sda

smartctl 5.39.1 2010-01-28 r3054 [i686-pc-linux-gnu] (openSUSE RPM)

Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===

Model Family:     Western Digital Caviar Blue Serial ATA family

Device Model:     WDC WD1600AAJS-65M0A0

Firmware Version: 01.03E01

User Capacity:    160,041,885,696 bytes

Device is:        In smartctl database [for details use: -P show]

ATA Version is:   8

ATA Standard is:  Exact ATA specification draft version not indicated

Local Time is:    Tue Aug 20 00:22:01 2013 IST

SMART support is: Available - device has SMART capability.

SMART support is: Enabled

```

Is there any reason why the samsung drive is behaving so poorly?

----------

## NeddySeagoon

trumee,

Post the output of fdisk -l and smartctl -a  for the drive.

----------

## trumee

Here you go.

```

#fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x100f59dc

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1        3647    29294496   83  Linux

/dev/sda2            3648        4863     9767520   82  Linux swap / Solaris

/dev/sda3            4864       19457   117226305   83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x000a7c61

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1        3647    29292544    7  HPFS/NTFS

/dev/sdb2            3648        7294    29294527+  83  Linux

/dev/sdb3            7295      121601   918170977+  83  Linux

Disk /dev/sdc: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4958b5bd

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1   *           1       60801   488384001   83  Linux

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x9b80cd8b

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1      243201  1953512001   83  Linux

```

smartctl 

```

#smartctl -a /dev/sdd

smartctl 5.39.1 2010-01-28 r3054 [i686-pc-linux-gnu] (openSUSE RPM)

Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===

Device Model:     SAMSUNG HD204UI

Serial Number:    S2H7JD2B222108

Firmware Version: 1AQ10001

User Capacity:    2,000,398,934,016 bytes

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

ATA Version is:   8

ATA Standard is:  ATA-8-ACS revision 6

Local Time is:    Tue Aug 20 01:40:42 2013 IST

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:                 (20640) seconds.

Offline data collection

capabilities:                    (0x5b) SMART execute Offline immediate.

                                        Auto Offline data collection on/off support.

                                        Suspend Offline collection upon new

                                        command.

                                        Offline surface scan supported.

                                        Self-test supported.

                                        No 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:        ( 255) minutes.

SCT capabilities:              (0x003f) 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   051    Pre-fail  Always       -       27165

  2 Throughput_Performance  0x0026   252   252   000    Old_age   Always       -       0

  3 Spin_Up_Time            0x0023   069   067   025    Pre-fail  Always       -       9508

  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       819

  5 Reallocated_Sector_Ct   0x0033   252   252   010    Pre-fail  Always       -       0

  7 Seek_Error_Rate         0x002e   252   252   051    Old_age   Always       -       0

  8 Seek_Time_Performance   0x0024   252   252   015    Old_age   Offline      -       0

  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       17323

 10 Spin_Retry_Count        0x0032   252   252   051    Old_age   Always       -       0

 11 Calibration_Retry_Count 0x0032   252   252   000    Old_age   Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       834

181 Program_Fail_Cnt_Total  0x0022   100   100   000    Old_age   Always       -       15790642

191 G-Sense_Error_Rate      0x0022   252   252   000    Old_age   Always       -       0

192 Power-Off_Retract_Count 0x0022   252   252   000    Old_age   Always       -       0

194 Temperature_Celsius     0x0002   057   051   000    Old_age   Always       -       43 (Lifetime Min/Max 15/49)

195 Hardware_ECC_Recovered  0x003a   100   100   000    Old_age   Always       -       0

196 Reallocated_Event_Count 0x0032   252   252   000    Old_age   Always       -       0

197 Current_Pending_Sector  0x0032   252   100   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0030   252   252   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x0036   200   200   000    Old_age   Always       -       0

200 Multi_Zone_Error_Rate   0x002a   100   100   000    Old_age   Always       -       359

223 Load_Retry_Count        0x0032   252   252   000    Old_age   Always       -       0

225 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       838

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]

Note: selective self-test log revision number (0) not 1 implies that no selective self-test has ever been run

SMART Selective self-test log data structure revision number 0

Note: revision number not 1 implies that no selective self-test has ever been run

 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS

    1        0        0  Completed [00% left] (0-65535)

    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.

```

----------

## NeddySeagoon

trumee,

```
Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

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

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x9b80cd8b

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1               1      243201  1953512001   83  Linux 
```

The drive lies about its physical sector size.  As its a 2Tb drive, it will use 4kB physical sectors.

I expected it to show the correct values in the smartctl output but the data is missing.

For best performace, you need to align partitions on physical sector boundaries.  This avoids the very slow read modify writes that the disk does to fake the appearance of 512b secores.

Your sdd1 starts at sector 63 (512B sectors) and it needs to be a multiple of 8, so your partition is misaligned. 

While this is all very interesting, and needs to be addressed for the real world case, it doesn't really answer your hdparm question as the timing is based on sequential reads with total disregard to any partitions or filesystems on the drive.

What answers do you get using dd to read things to /dev/null with various block sizes?

Thats a more realistic test of raw drive throughput.

----------

## trumee

 *NeddySeagoon wrote:*   

> trumee,
> 
> For best performace, you need to align partitions on physical sector boundaries.  This avoids the very slow read modify writes that the disk does to fake the appearance of 512b secores.
> 
> Your sdd1 starts at sector 63 (512B sectors) and it needs to be a multiple of 8, so your partition is misaligned. 
> ...

 

Is there any way to realign without losing data? What is the best tool to align the partition?

 *NeddySeagoon wrote:*   

> 
> 
> While this is all very interesting, and needs to be addressed for the real world case, it doesn't really answer your hdparm question as the timing is based on sequential reads with total disregard to any partitions or filesystems on the drive.
> 
> What answers do you get using dd to read things to /dev/null with various block sizes?
> ...

 

Here are some stats.

```

#dd if=/dev/sdd1 of=/dev/null count=100 bs=256k

100+0 records in

100+0 records out

26214400 bytes (26 MB) copied, 13.0921 s, 2.0 MB/s

#dd if=/dev/sdd1 of=/dev/null count=100 bs=512k

100+0 records in

100+0 records out

52428800 bytes (52 MB) copied, 10.6606 s, 4.9 MB/s

#dd if=/dev/sdd1 of=/dev/null count=100 bs=1024k

100+0 records in

100+0 records out

104857600 bytes (105 MB) copied, 31.7512 s, 3.3 MB/s

```

----------

## NeddySeagoon

trumee,

Using if=/dev/sdd1 makes sure reads are misaligned, as /dev/sdd1 itself is misaligned.

Can you repeat the same set of tests using the raw device /dev/sdd  which will produce a set of aligned read results.

Its backup, data destroy the filesystem and repartition.

New fdisk works as does (g)parted.

----------

## trumee

Here they are:

```

# dd if=/dev/sdd of=/dev/null count=100 bs=256k

100+0 records in

100+0 records out

26214400 bytes (26 MB) copied, 16.9083 s, 1.6 MB/s

# dd if=/dev/sdd of=/dev/null count=100 bs=512k

100+0 records in

100+0 records out

52428800 bytes (52 MB) copied, 13.2321 s, 4.0 MB/s

# dd if=/dev/sdd of=/dev/null count=100 bs=1024k

100+0 records in

100+0 records out

104857600 bytes (105 MB) copied, 20.5749 s, 5.1 MB/s

# dd if=/dev/sdd of=/dev/null count=25 bs=4096k

25+0 records in

25+0 records out

104857600 bytes (105 MB) copied, 28.6642 s, 3.7 MB/s

```

This filesystem has my zoneminder video files which are small but large number of files.

----------

## NeddySeagoon

trumee,

Thats even worse!

I expected improved transfer rates.

How is the drive connected to the system?

If its external, how is it powered?

Are there a large number of errors in dmesg related to sdd and if so, what are they ?

----------

## trumee

It is an internal drive. I found the following error in dmesg

```

[50235.716730] ata5.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

[50235.716735] ata5.00: irq_stat 0x40000008

[50235.716739] ata5.00: failed command: READ FPDMA QUEUED

[50235.716746] ata5.00: cmd 60/00:00:ef:51:02/02:00:00:00:00/40 tag 0 ncq 262144 in

[50235.716748]          res 41/40:00:50:53:02/00:00:00:00:00/40 Emask 0x409 (media error) <F>

[50235.716751] ata5.00: status: { DRDY ERR }

[50235.716753] ata5.00: error: { UNC }

[50235.728903] ata5.00: configured for UDMA/133

[50235.728917] ata5: EH complete

[56171.802252] ata5.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

[56171.802260] ata5.00: irq_stat 0x40000008

[56171.802269] ata5.00: failed command: READ FPDMA QUEUED

[56171.802285] ata5.00: cmd 60/00:00:00:53:02/02:00:00:00:00/40 tag 0 ncq 262144 in

[56171.802288]          res 41/40:00:50:53:02/00:00:00:00:00/40 Emask 0x409 (media error) <F>

[56171.802295] ata5.00: status: { DRDY ERR }

[56171.802300] ata5.00: error: { UNC }

[56171.814623] ata5.00: configured for UDMA/133

[56171.814647] ata5: EH complete

```

----------

## NeddySeagoon

trumee,

The interface is being reset to recover from errors - thats why the data rate is so low.  The drive is spending most of its time off line.

Google says the drive has a SATA 3Gb/s interface - thats SATA2

If the motherboard is SATA1, the drive may need to be jumpered to force it to use SATA 1 speeds.

Fallback is supposed to be automatic but it often doesn't work properly.

Post your lspci output if you are not sure.

Internal SATA data cables have very poor quality connectors, try a replacement data cable. 

It might really be a (media error), as dmesg suggests but if that were true the SMART data

```
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE 

  5 Reallocated_Sector_Ct   0x0033   252   252   010    Pre-fail  Always       -       0 

196 Reallocated_Event_Count 0x0032   252   252   000    Old_age   Always       -       0

197 Current_Pending_Sector  0x0032   252   100   000    Old_age   Always       -       0 
```

whould be showing non zero values in at least one of these fields.

Much more rarely, it can be an inadequate PSU or the way the drives are arranged on the available drive power connectors.

As a rule of thumb, two drives on the same power wire works, more than that might work or might not.

----------

## eccerr0r

I actually was a bit concerned about this field:

```
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE

  3 Spin_Up_Time            0x0023   069   067   025    Pre-fail  Always       -       9508 

```

Usually Value should be around 100 or whatever most of your other fields are.  Since it has dropped to 69 (but above 25 - meaning it hasn't failed yet) means there may be issues with either power or the spindle motor.  Definitely try another power cable.

Next cold powerup check the VALUE (higher is better) and RAW_VALUE (usually lower is better) of Spin_Up_Time again and see if it has changed.

----------

## trumee

Unfortunately, it is a remote machine which i wont have access until later in the year.

lspci is

```

00:00.0 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a2)

00:01.0 ISA bridge: nVidia Corporation MCP78S [GeForce 8200] LPC Bridge (rev a2)

00:01.1 SMBus: nVidia Corporation MCP78S [GeForce 8200] SMBus (rev a1)

00:01.2 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a1)

00:01.3 Co-processor: nVidia Corporation MCP78S [GeForce 8200] Co-Processor (rev a2)

00:01.4 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller (rev a1)

00:02.0 USB Controller: nVidia Corporation MCP78S [GeForce 8200] OHCI USB 1.1 Controller (rev a1)

00:02.1 USB Controller: nVidia Corporation MCP78S [GeForce 8200] EHCI USB 2.0 Controller (rev a1)

00:04.0 USB Controller: nVidia Corporation MCP78S [GeForce 8200] OHCI USB 1.1 Controller (rev a1)

00:04.1 USB Controller: nVidia Corporation MCP78S [GeForce 8200] EHCI USB 2.0 Controller (rev a1)

00:06.0 IDE interface: nVidia Corporation MCP78S [GeForce 8200] IDE (rev a1)

00:07.0 Audio device: nVidia Corporation MCP72XE/MCP72P/MCP78U/MCP78S High Definition Audio (rev a1)

00:08.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Bridge (rev a1)

00:09.0 SATA controller: nVidia Corporation MCP78S [GeForce 8200] AHCI Controller (rev a2)

00:0a.0 Ethernet controller: nVidia Corporation MCP77 Ethernet (rev a2)

00:0b.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1)

00:10.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1)

00:12.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express Bridge (rev a1)

00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor HyperTransport Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Miscellaneous Control

00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Link Control

01:06.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent mode) (rev 11)

01:07.0 PCI bridge: Hint Corp HB6 Universal PCI-PCI bridge (non-transparent mode) (rev 11)

02:08.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

02:09.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

03:08.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

03:09.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

04:00.0 VGA compatible controller: nVidia Corporation C77 [GeForce 8300] (rev a2)

```

----------

## NeddySeagoon

trumee,

Your 

```
00:09.0 SATA controller: nVidia Corporation MCP78S [GeForce 8200] AHCI Controller (rev a2) 
```

 supports Up to 6 Serial ATA 3.0 Gbit/s drives, according to Google.

So its SATA2 on the motherboard and on the HDD. Thats as good as it gets.

I suspect the SATA data cable or the power arrangements for the drive.

The drive spin motor is powered from the +12v.  What does lm-sensors have to say about the PSU voltages?

The sensor is on the motherboard - not where you need it on the HDD and if you have a split 12v rail it won't even be looking at the the right 12v supply.

It will need hards on the hardware to fix.

----------

## trumee

I copied files over from the harddisk, re-created the filesystem.

```

#mkfs.ext4 -b 4096 /dev/sdd1

#fdisk -lu /dev/sdd

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 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: 0x000f1710

   Device Boot      Start         End      Blocks   Id  System

/dev/sdd1            2048  3907028991  1953513472   83  Linux

#/opt/parted/sbin/parted /dev/sdd

GNU Parted 3.1

Using /dev/sdd

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

(parted) align-check 

alignment type(min/opt)  [optimal]/minimal? 

Partition number? 1                                                       

1 aligned

```

Reading speeds

```

#dd if=/dev/sdd of=/dev/null count=100 bs=256k

100+0 records in

100+0 records out

26214400 bytes (26 MB) copied, 0.100812 s, 260 MB/s

#dd if=/dev/sdd of=/dev/null count=100 bs=512k

100+0 records in

100+0 records out

52428800 bytes (52 MB) copied, 3.86653 s, 13.6 MB/s

#dd if=/dev/sdd of=/dev/null count=100 bs=1024k

100+0 records in

100+0 records out

104857600 bytes (105 MB) copied, 13.9418 s, 7.5 MB/s

#dd if=/dev/sdd of=/dev/null count=25 bs=4096k 

25+0 records in

25+0 records out

104857600 bytes (105 MB) copied, 13.1108 s, 8.0 MB/s

```

lm_sensors

```

#sensors

k10temp-pci-00c3

Adapter: PCI adapter

temp1:       +32.5°C  (high = +70.0°C, crit = +115.5°C)  

atk0110-acpi-0

Adapter: ACPI interface

Vcore Voltage:     +1.07 V  (min =  +0.80 V, max =  +1.80 V)

 +3.3 Voltage:     +3.25 V  (min =  +2.97 V, max =  +3.63 V)

 +5 Voltage:       +4.92 V  (min =  +4.50 V, max =  +5.50 V)

 +12 Voltage:     +11.97 V  (min = +10.20 V, max = +13.80 V)

CPU FAN Speed:    1785 RPM  (min =  600 RPM)

CHASSIS FAN Speed:1683 RPM  (min =  600 RPM)

POWER FAN Speed:  1056 RPM  (min =  600 RPM)

CPU Temperature:   +43.0°C  (high = +60.0°C, crit = +95.0°C)  

MB Temperature:    +43.0°C  (high = +45.0°C, crit = +95.0°C)

```

Unfortunately, i guess will have to live with this for next few months before i have physical access. Is there any way i can check if PSU power is adequate?

----------

## NeddySeagoon

trumee,

If you know the PSU make and model number, you can do the analysis provided you also know what else is installed.

----------

