# Samsung HM160HC: unload cycles and smartctl ATA bus reset

## LiquidAcid

Hi there,

I managed to replace my laptop harddisk to a new 160GB samsung drive. The drive is working yes, but I have noticed some major problems.

The first thing I noticed was a repeated clicking noise from the drive. Further investigation revealed that this had to be the unload/load cycle noise when the drive parks the head to save power. As everyone knows repeated unloading/loading cycles reduces the lifetime of the drive. And I'm using this laptop most of the time with external AC power, so I don't need the drive to go into standby all the time. I analyzed this problem even further, but first I want to mention the other one.

Because I was kind of worried when hearing the clicking noises, and I suspected to have bought an already half-dead harddisk I wanted to make a check with smartctl. I was also interested in the unload/load cycle count which SMART should track.

So I ran: smartctl -d ata --all /dev/sda and experienced some serious system hang for about 5 to 10 seconds. The kernel log contains this after executing the call to smartctl:

```
Dec 16 14:27:25 leena ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen

Dec 16 14:27:26 leena ata1.00: cmd 35/00:08:48:d9:30/00:02:02:00:00/e0 tag 0 cdb 0x1e data 266240 out

Dec 16 14:27:26 leena res 40/00:00:09:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)

Dec 16 14:27:26 leena ata1: soft resetting port

Dec 16 14:27:26 leena ata1.00: configured for UDMA/100

Dec 16 14:27:26 leena ata1.01: configured for UDMA/33

Dec 16 14:27:26 leena ata1: EH complete

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] Write Protect is off

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] Write Protect is off

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

Dec 16 14:27:26 leena sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
```

I can always reproduce this with smartctl. Everytime I request the SMART information from the drive the port hangs and the kernel resets it. The system does recover from that, but I don't think I can ignore this problem just because the system recovers.

I suspect this to be some major problem with the libata layer, after doing some google searches. And I'm not sure how to fix this.

I have found something about issues when using a TSSTcorp drive. I have a "TSSTcorp DVD+/-RW TS-L532B" (the laptop is from Dell), but I can't apply the newest firmware patch from the dell support website. I simply won't work with my drive. I've already tried booting the system from a DOS bootdisc but the drive won't accept the firmware. So if that problem is dependent on the optical drive I think I can't do anything but replace the drive.

But reading more posts about the TSSTcorp problem I saw that the problem already appeared without smartctl. smartctl wasn't even mentioned in these posts, so I'm not quite sure if my problem is directly related to that one.

Coming back to problem number one. So I wanted to reduce the unload/load cycle count and thought it would be best to disable the power management from the drive completly, setting the parameter with hdparm to 255. Setting the param worked, but the drive continued to go into standby (judging from the clicking noise, I really didn't want to call smartctl to watch the cycle count). I'm currently trying some combination of -M128 (acoustic management to quiet) and -B1 (PM to 1) and this way the noise from the drive is barely audible. Also clicking seemed to have disappeared. At least the clicking noise it made before. Now it sounds more like some faint spinup/spindown noise (if I listend closely).

Anyone who experienced something similar?

Thanks,

liquid

EDIT:

Noticed something interesting. When calling "smartctl -i" which gives only basic information the drive does not hang. Also not when only calling "smartctl -A" which requests the SMART attributes. This is wonderful, because now I can watch the load/unload cycle count without hanging the system each time for 10 seconds. What I noticed was that the drive was still going into standby when PM was set to 1 (the spinup/spindown noises).

I have now set PM to 254 (last setting before 255, which is disable PM).

I currently have a status of:

```
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen

Home page is http://smartmontools.sourceforge.net/

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

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     0x000f   100   100   051    Pre-fail  Always       -       2

  3 Spin_Up_Time            0x0007   252   252   025    Pre-fail  Always       -       2125

  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       41

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

  7 Seek_Error_Rate         0x000e   252   252   051    Old_age   Always       -       0

  8 Seek_Time_Performance   0x0024   252   252   015    Old_age   Offline      -       0

  9 Power_On_Hours          0x0032   252   252   000    Old_age   Always       -       89

 10 Spin_Retry_Count        0x0032   252   252   051    Old_age   Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       10

191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       89

192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       2

194 Temperature_Celsius     0x0022   133   106   000    Old_age   Always       -       35 (Lifetime Min/Max 18/44)

195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       378

196 Reallocated_Event_Count 0x0032   252   252   000    Old_age   Always       -       0

197 Current_Pending_Sector  0x0012   252   252   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   0x000a   100   100   000    Old_age   Always       -       0

201 Soft_Read_Error_Rate    0x0032   252   252   000    Old_age   Always       -       0

223 Load_Retry_Count        0x0032   100   100   000    Old_age   Always       -       193

225 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       4310
```

and the load cycle count hasn't changed in the last minute (which it did with B1, there it increaed every two seconds).

----------

## Merlum

Hi,

I experienced the same behavior on my brand new Samsung hard drive.

The Load_Cycle_Count ceased to increment with the trick mentioned on this page about samsung hard drives:

http://www.thinkwiki.org/wiki/Problem_with_hard_drive_clicking

I did:

#smartctl -o on /dev/hda

smartctl version 5.36 [i486-slackware-linux-gnu] Copyright (C) 2002-6 Bruce Allen

Home page is http://smartmontools.sourceforge.net/

=== START OF ENABLE/DISABLE COMMANDS SECTION ===

SMART Automatic Offline Testing Enabled every four hours.

What was frightened me was the incredibly high amount of Hardware_ECC_Recovered (15860 in just one week of normal usage).

Hope this helps

----------

## hug0

Same problem here, with the difference that it started with an upgrad from Samsung 160GB to Samsung 250GB and I do not have a TSST drive.

```
Mar 11 22:21:01 nils ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen

Mar 11 22:21:01 nils ata1.00: cmd c8/00:28:fb:89:d3/00:00:00:00:00/e6 tag 0 cdb 0x0 data 20480 in

Mar 11 22:21:01 nils res 40/00:fe:00:00:00/00:00:00:00:00/40 Emask 0x4 (timeout)

Mar 11 22:21:08 nils ata1: port is slow to respond, please be patient (Status 0xd0)

Mar 11 22:21:31 nils ata1: port failed to respond (30 secs, Status 0xd0)

Mar 11 22:21:31 nils ata1: soft resetting port

Mar 11 22:21:31 nils ata1.00: configured for UDMA/133

Mar 11 22:21:31 nils ata1: EH complete

Mar 11 22:21:31 nils SCSI device sda: 488397168 512-byte hdwr sectors (250059 MB)

Mar 11 22:21:31 nils sda: Write Protect is off

Mar 11 22:21:31 nils sda: Mode Sense: 00 3a 00 00

Mar 11 22:21:31 nils SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
```

Any ideas?

----------

## Merlum

Hello,

I suspect smartmontools + libata driver combination to be the problem :

http://www.mail-archive.com/linux-ide@vger.kernel.org/msg11248.html

On my first message, I was telling about my solution for the bad sound my drive did.

But I was running old ATA drivers (/dev/hdX), not libata (/dev/sdX even for PATA drives).

Now I am running a new kernel, with the new libata based drivers and the exception like hug0 occurs when doing a smartctl -a -d ata /dev/sda

On other forums, I saw that I should put 'combined_mode=libata' as kernel parameter and options libata atapi_enabled=1 for libata driver parameter (in modprobe.conf) but same behavior with smartctl -a.

My version of smartmontools is 5.38

This does not help but here are my investigations.

----------

## Merlum

OK, responding to myself:

since the libata driver is loaded in initrd, the /etc/modprobe.conf is not read and so setting the option in this configuration file is useless.

To pass the parameter to the driver at boot prompt, just add something like this to /etc/lilo.conf (as I use lilo to boot):

append = "combined_mode=libata libata.atapi_enabled=1"

tells to the libata driver to set atapi_enabled to 1.

Now I can do smartctl -a /dev/sda1, no more exception error.

Problem solved!

----------

## hans_da

I think the right setup for samsung harddisk is:

hdparm -B 254

If you set -B 255 the the power management is completely off, thus the default BIOS of the harddisk is in charge, which will incease the Load_Cycle_Count even about 10 times every 10 minutes. This is totally stupid.

I use hdparm -B 254 -S120, this will spin down my hard disc if the computer is idle for 10 minutes. This setting gives me a maximun temperature about 47 °C, an average increase rate of 20 per day (24 h up-time, normal working during the day).

And the strange click sound from the harddisc is not a sign of spin-up/down. When there is a click there is not necessarily an increase in Load_Cycle_Count.

----------

## hans_da

The click sound of Samsung hard disc is related to the Load_Retry_Count. Every time it clicks, this count increases by one. Any idea what is that? Is that critical?

----------

## dizcrypt

The problem itself is connected with too agressive power saving settings. This leads to continuous parking and unparking of a hard drive's heads. Manufacturers claim that modern drives can survive something about 600,000 load cycles. So it is better do not allow your drive to click-clack often.   :Very Happy: 

----------

