# Slow HDD Performance [solved]

## rahulthewall

Hi,

Now it seems to be that in the last couple of months, the performance of my hard drive has noticeably decreased. If I have concurrent downloads running or am compiling, my computer becomes extremely sluggish. I have the impression that it used to be more responsive before, I certainly do not know what the cause could be. Off the top of my head, I can think of either some configuration errors with the HDD after some upgrades or just old hard drive in general. Anyways, below are a couple of outputs from hdparm (these are with xorg and some other stuff running)

```

googly rahul # hdparm -tT /dev/sda5

/dev/sda5:

 Timing cached reads:   2288 MB in  2.00 seconds = 1144.63 MB/sec

 Timing buffered disk reads:   96 MB in  3.01 seconds =  31.86 MB/sec

```

```

googly rahul # hdparm -iI /dev/sda6                                  

/dev/sda6:

 Model=Hitachi HTS541060G9SA00                 , FwRev=MB3OC60R, SerialNo=      MPBCP0XGJHWD7M

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }                                       

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4                                        

 BuffType=DualPortCache, BuffSize=7538kB, MaxMultSect=16, MultSect=?8?                        

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117210240                           

 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}                             

 PIO modes:  pio0 pio1 pio2 pio3 pio4                                                         

 DMA modes:  mdma0 mdma1 mdma2                                                                

 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5                                             

 AdvancedPM=yes: mode=0x80 (128) WriteCache=enabled                                           

 Drive conforms to: ATA/ATAPI-7 T13 1532D revision 1:  ATA/ATAPI-2,3,4,5,6,7                  

 * signifies the current active mode

ATA device, with non-removable media

        Model Number:       Hitachi HTS541060G9SA00                 

        Serial Number:      MPBCP0XGJHWD7M                          

        Firmware Revision:  MB3OC60R                                

Standards:                                                          

        Used: ATA/ATAPI-7 T13 1532D revision 1                      

        Supported: 7 6 5 4                                          

Configuration:                                                      

        Logical         max     current                             

        cylinders       16383   16383                               

        heads           16      16                                  

        sectors/track   63      63                                  

        --                                                          

        CHS current addressable sectors:   16514064                 

        LBA    user addressable sectors:  117210240                 

        LBA48  user addressable sectors:  117210240                 

        Logical/Physical Sector size:           512 bytes           

        device size with M = 1024*1024:       57231 MBytes          

        device size with M = 1000*1000:       60011 MBytes (60 GB)  

        cache/buffer size  = 7538 KBytes (type=DualPortCache)       

Capabilities:                                                       

        LBA, IORDY(can be disabled)                                 

        Queue depth: 32                                             

        Standby timer values: spec'd by Vendor, no device specific minimum

        R/W multiple sector transfer: Max = 16  Current = 8               

        Advanced power management level: 128                              

        Recommended acoustic management value: 128, current value: 128    

        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5       

             Cycle time: min=120ns recommended=120ns                      

        PIO: pio0 pio1 pio2 pio3 pio4                                     

             Cycle time: no flow control=240ns  IORDY flow control=120ns  

Commands/features:                                                        

        Enabled Supported:                                                

           *    SMART feature set                                         

                Security Mode feature set                                 

           *    Power Management feature set                              

           *    Write cache                                               

           *    Look-ahead                                                

           *    Host Protected Area feature set                           

           *    WRITE_BUFFER command                                      

           *    READ_BUFFER command                                       

           *    NOP cmd                                                   

           *    DOWNLOAD_MICROCODE                                        

           *    Advanced Power Management feature set                     

                Power-Up In Standby feature set

           *    SET_FEATURES required to spinup after power up

                SET_MAX security extension

           *    Automatic Acoustic Management feature set

           *    48-bit Address feature set

           *    Device Configuration Overlay feature set

           *    Mandatory FLUSH_CACHE

           *    FLUSH_CACHE_EXT

           *    SMART error logging

           *    SMART self-test

           *    General Purpose Logging feature set

           *    WRITE_{DMA|MULTIPLE}_FUA_EXT

           *    Gen1 signaling speed (1.5Gb/s)

           *    Native Command Queueing (NCQ)

           *    Host-initiated interface power management

                Non-Zero buffer offsets in DMA Setup FIS

                DMA Setup Auto-Activate optimization

                Device-initiated interface power management

                In-order data delivery

           *    Software settings preservation

Security:

        Master password revision code = 65534

                supported

        not     enabled

        not     locked

                frozen

        not     expired: security count

        not     supported: enhanced erase

        40min for SECURITY ERASE UNIT.

Checksum: correct

```

----------

## rahulthewall

OK guys, I am getting worried here. KDE-4.2.1 has been compiling for the past 3 hours now and only 70 of the 151 packages have compiled by now and that seems abnormally slow to me.

If there is any way to check my hard drive while it is still mounted, I would like to do that. Otherwise, please point me to other ways of checking my hard disk, I live in abject fear of losing my data and am taking a back up right now.

----------

## NeddySeagoon

rahulthewall,

As hard drives are zoned, they are faster at the outside than near the spindle. Zones have a lower number of sectors per track as the track diameter decreases. You can detect this with hdparam -tT for each partition.

As drives wear through life, they remap failing sectors to spare sectors provided for this purpose. When the spares are all used, the drive is end of life. smartmontools can read the drives SMART data and tell you how its doing.

This remapping has the effect of slowing access, as sectors the are logically sequential may not be physically next to one another on the disk surface.  This incurrs extra head movement and/or waiting for the sector to come under the head, both of which reduce the data rate.

The on disk cache helps minimise this effect.

----------

## rahulthewall

So, I installed smartmontools and my HDD had smart mode enabled, so I ran few tests. Here is what I get:

```
googly yawp # smartctl -H /dev/sda

smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen

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

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

SMART overall-health self-assessment test result: PASSED
```

```

googly yawp # smartctl -l error /dev/sda

smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen

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

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

SMART Error Log Version: 1              

ATA Error Count: 82 (device log contains only the most recent five errors)

        CR = Command Register [HEX]                                       

        FR = Features Register [HEX]                                      

        SC = Sector Count Register [HEX]                                  

        SN = Sector Number Register [HEX]                                 

        CL = Cylinder Low Register [HEX]                                  

        CH = Cylinder High Register [HEX]                                 

        DH = Device/Head Register [HEX]                                   

        DC = Device Command Register [HEX]                                

        ER = Error register [HEX]                                         

        ST = Status register [HEX]                                        

Powered_Up_Time is measured from power on, and printed as                 

DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,                     

SS=sec, and sss=millisec. It "wraps" after 49.710 days.                   

Error 82 occurred at disk power-on lifetime: 11397 hours (474 days + 21 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH                              

  -- -- -- -- -- -- --                              

  40 51 01 32 78 9f e0  Error: UNC at LBA = 0x009f7832 = 10450994

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  40 00 01 32 78 9f e0 00      00:06:42.500  READ VERIFY SECTOR(S)

  c8 00 01 0a 62 90 e3 00      00:06:42.500  READ DMA             

  40 00 01 31 78 9f e0 00      00:06:42.500  READ VERIFY SECTOR(S)

  c8 00 01 6e 5f 30 e2 00      00:06:42.500  READ DMA             

  40 00 02 31 78 9f e0 00      00:06:38.300  READ VERIFY SECTOR(S)

Error 81 occurred at disk power-on lifetime: 11397 hours (474 days + 21 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH                              

  -- -- -- -- -- -- --                              

  40 51 01 32 78 9f e0  Error: UNC at LBA = 0x009f7832 = 10450994

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  40 00 02 31 78 9f e0 00      00:06:38.300  READ VERIFY SECTOR(S)

  c8 00 01 00 00 00 e0 00      00:06:38.300  READ DMA             

  40 00 02 2f 78 9f e0 00      00:06:38.300  READ VERIFY SECTOR(S)

  c8 00 01 00 00 00 e0 00      00:06:38.300  READ DMA             

  40 00 04 33 78 9f e0 00      00:06:38.300  READ VERIFY SECTOR(S)

Error 80 occurred at disk power-on lifetime: 11397 hours (474 days + 21 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH                              

  -- -- -- -- -- -- --                              

  40 51 01 32 78 9f e0  Error: UNC at LBA = 0x009f7832 = 10450994

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  40 00 04 2f 78 9f e0 00      00:06:34.100  READ VERIFY SECTOR(S)

  c8 00 01 0a 62 90 e3 00      00:06:34.100  READ DMA             

  40 00 08 37 78 9f e0 00      00:06:34.100  READ VERIFY SECTOR(S)

  c8 00 01 6e 5f 30 e2 00      00:06:34.100  READ DMA             

  40 00 08 2f 78 9f e0 00      00:06:29.900  READ VERIFY SECTOR(S)

Error 79 occurred at disk power-on lifetime: 11397 hours (474 days + 21 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH                              

  -- -- -- -- -- -- --                              

  40 51 05 32 78 9f e0  Error: UNC at LBA = 0x009f7832 = 10450994

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  40 00 08 2f 78 9f e0 00      00:06:29.900  READ VERIFY SECTOR(S)

  c8 00 01 00 00 00 e0 00      00:06:29.900  READ DMA             

  40 00 10 2f 78 9f e0 00      00:06:25.700  READ VERIFY SECTOR(S)

  c8 00 01 00 00 00 e0 00      00:06:25.700  READ DMA             

  40 00 10 1f 78 9f e0 00      00:06:25.700  READ VERIFY SECTOR(S)

Error 78 occurred at disk power-on lifetime: 11397 hours (474 days + 21 hours)

  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:

  ER ST SC SN CL CH DH

  -- -- -- -- -- -- --

  40 51 0d 32 78 9f e0  Error: UNC at LBA = 0x009f7832 = 10450994

  Commands leading to the command that caused the error were:

  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name

  -- -- -- -- -- -- -- --  ----------------  --------------------

  40 00 10 2f 78 9f e0 00      00:06:25.700  READ VERIFY SECTOR(S)

  c8 00 01 00 00 00 e0 00      00:06:25.700  READ DMA

  40 00 10 1f 78 9f e0 00      00:06:25.700  READ VERIFY SECTOR(S)

  c8 00 01 00 00 00 e0 00      00:06:25.700  READ DMA

  40 00 20 1f 78 9f e0 00      00:06:21.500  READ VERIFY SECTOR(S)
```

```

googly yawp # smartctl -l selftest /dev/sda

googly yawp # smartctl -l selftest /dev/sda

smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen

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

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

SMART Self-test log structure revision number 1

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error

# 1  Short offline       Completed without error       00%      5528         -                 

# 2  Short offline       Completed without error       00%         0         -                 

# 3  Short captive       Completed without error       00%         0         -                 
```

So, there are apparently 82 errors - are they recent and how do I check this?

Thanks

Rahul

----------

## NeddySeagoon

rahulthewall,

```
Error 82 occurred at disk power-on lifetime: 11397 hours (474 days + 21 hours) 
```

Only the last 5 errors are stored and they all occured within the same hour.

The table of parameters that smartmontools produces is useful too.

It has things like reallocated sector count.

----------

## rahulthewall

OK, 

Quick question, should I consider changing the HD? I have a three year complete warranty on my laptop and I think I can easily get a replacement for the HD. Would you say it is necessary at this point?

Cheers

Rahul

----------

## NeddySeagoon

rahulthewall,

If you can move your data off for a data destructive test, run the hard drive manufactuers test application.

Some of them even check your warranty and print a RMA if the test fails.

----------

## rahulthewall

 *NeddySeagoon wrote:*   

> rahulthewall,
> 
> If you can move your data off for a data destructive test, run the hard drive manufactuers test application.
> 
> Some of them even check your warranty and print a RMA if the test fails.

 

My point is that if I am moving the data entirely off the HDD anyways, I might as well get a replacement. The thing is that the University has a contract with the manufacturer and we get 3 years complete warranty + 3 years accidental damage insurance which includes pretty much any damage one can think of. So, if my HDD is in a questionable state, I might just ask for a new one.

----------

## Cyker

It might be tricky to get it replaced under warrenty for that sort of error, 'tho 82 seems a bit high.

If it had bad sectors that wouldn't go away, or the SMART test Failed, then the procedure would be easier. The only sure way is if the drive is totally dead, or if the OEM's drive fitness/diagnostic tool (e.g. PowerMax with Maxtor, DFT for IBM/Hitachi, SeaTools for Seagate, Data Lifeguard tools for Western Digital etc.) certifies that the drive needs replacement (Easiest option as the tools usually produce an error code).

I would try running such a tool on the drive.

The problem with these tools is the diagnostics only work in DOS which is a real PITA, esp. if your controller doesn't work in DOS (Ah for the days of BIOS standard hardware protocols!).

----------

## rahulthewall

Am gonna try running the DFT, anyways the extended offline test fails with a read error ...

```

googly rahul # smartctl -l selftest /dev/sda

smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen

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

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

SMART Self-test log structure revision number 1

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error

# 1  Extended offline    Completed: read failure       80%     13392         10450994

# 2  Short offline       Completed without error       00%      5528         -

# 3  Short offline       Completed without error       00%         0         -

# 4  Short captive       Completed without error       00%         0         -

```

----------

## NeddySeagoon

rahulthewall,

Thats a bad sign, the data in LBA 10450994 (if any) has been lost.

smartmontools may show that all the spare sectors have been used and that this sector is waiting for remapping, which will never happen.

The disk vendor tools (well some) have been stand alone for a while now. Follow the instructions on the website.

----------

## rahulthewall

Ran an extended test with DFT (HDD is Hitachi) and it told me that I have a defective device. So, I called up the service center and they are going to give me a replacement hard drive.

Thanks for the tip guys.  :Smile: 

Cheers

Rahul

----------

## rahulthewall

And now, a more pertinent question. I would rather not reinstall windows and Gentoo when I get a new hard drive. So what I would like to know is what is the best wawy to clone my entire hard drive so that it can be replicated on the new hard drive.

Cheers

Rahul

----------

## NeddySeagoon

rahulthewall,

As the drive is faulty, there are two thing to try.

1. read the filesystems to backup files with something like tar.  If the faults in in unused areas of the filesysem, this will work. It also has the advantage of only copying used space. You will need to reinstall grub to the MBR after you have restored from backup.

This even works for windows as ntfs-3g reads and writes windows files correctly.

2. You can use ddrescue (not dd_rescue) to make an image of the faulty drive to a file, including all the empty space. Then restore it to the new drive.  ddrescue will never complete as the drive is faulty, it will leave 'holes' where data is missing. It works in the same way as dd until it hits an error, then does a recursive binary search on the remaining space.

This means it recovers easy to read data first and approaches problem areas by stepping the head in both directions to have the best chance of reading.  

Hint: Drive failures are often caused by failure of the platter bearings. You can often get one more read (and thats all you want) by operating the drive in an orientation is not normally used in. i.e. in a laptop, on edge.

----------

## pappy_mcfae

Ghost will work for that. I use the version that comes with Hiren's Boot CD. It can move all partitions in one operation. Once done, you'll have to chroot and setup grub/lilo, and that's it. And yes, definitely try to orient that hard drive outside it's normal operating position while doing the deed. Upside down would be best.

Blessed be!

Pappy

----------

## rahulthewall

 *NeddySeagoon wrote:*   

> rahulthewall,
> 
> As the drive is faulty, there are two thing to try.
> 
> 1. read the filesystems to backup files with something like tar.  If the faults in in unused areas of the filesysem, this will work. It also has the advantage of only copying used space. You will need to reinstall grub to the MBR after you have restored from backup.
> ...

 

If I use tar,  will it preserve the file permissions and everything?

----------

## NeddySeagoon

rahulthewall,

Yes.  When you restore, you must use the p option.

I don't think p is needed when you make the tarball, tar saves the information anyway but it would do no harm to use p both times

----------

## rahulthewall

In stead of tar, I used fsarchiver to backup my data. It was faster and looks like a nice option to me.

Plus, I must say I am really impressed with the DELL service. Granted, it took them a week to get the stuff that I wanted (I wanted a new keyboard a new casing for my laptop as well) these guys got the stuff and replaced everything. Even gave me a small 20GB HDD upgrade.

DELL service really rocks, am restoring my data as I type.

----------

