# [SOLVED] Computer very slow and hard disk light staying on?

## pmam

Do not see any exceptional busy process in task manager but machine very slow with long hard disk activity - 

Does it mean that hard disk is near its end of life? Or something else could cause this problem?

I installed sys-apps/hdparm and get this info:

```
hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media

   Model Number:       Hitachi HDS721616PLA380                 

   Serial Number:      PVB300Z207TXGF

   Firmware Revision:  P22OA70A
```

Is there any way to test this hard disk?

----------

## asturm

You can use smartctl from smartmontools to check for its SMART status and any logged errors.

----------

## Myu

I second the SMART test. You could take a look at iostat ( part of app-admin/sysstat ) to check your I/O load.

----------

## NeddySeagoon

pmam,

Check your dmesg,  entries like 

```
[415793.256932] ata1.00: exception Emask 0x0 SAct 0xfff SErr 0x0 action 0x0

[415793.256938] ata1.00: irq_stat 0x40000008

[415793.256949] ata1.00: cmd 60/08:00:08:d4:f4/00:00:bd:00:00/40 tag 0 ncq 4096 in

[415793.256952]          res 41/40:00:08:d4:f4/00:00:bd:00:00/40 Emask 0x409 (media error) <F>

[415793.266757] ata1.00: configured for UDMA/133

[415793.266791] ata1: EH complete
```

are a bad sign.

This shows the error handler being invoked for a media error.

smartctl -a /dev/...  will tell you the contents of the drives error log. Put it onto a pastebin.

----------

## pmam

This is the first time I am using SMART - hope these outputs can help:

```
smartctl -i /dev/sda

smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.0.5-gentoo] (local build)

Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===

Model Family:     Hitachi Deskstar 7K160

Device Model:     Hitachi HDS721616PLA380

Serial Number:    PVB300Z207TXGF

LU WWN Device Id: 5 000cca 325c38c23

Firmware Version: P22OA70A

User Capacity:    164,696,555,520 bytes [164 GB]

Sector Size:      512 bytes logical/physical

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

ATA Version is:   ATA/ATAPI-7 T13/1532D revision 1

Local Time is:    Sun Feb  7 11:58:35 2016 IST

SMART support is: Available - device has SMART capability.

SMART support is: Enabled
```

```
smartctl -H /dev/sda

smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.0.5-gentoo] (local build)

Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

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

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

```
smartctl -c /dev/sda

smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.0.5-gentoo] (local build)

Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

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

General SMART Values:

Offline data collection status:  (0x00)   Offline data collection activity

               was never started.

               Auto Offline Data Collection: Disabled.

Self-test execution status:      (  33)   The self-test routine was interrupted

               by the host with a hard or soft reset.

Total time to complete Offline 

data collection:       ( 2865) 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:     (   1) minutes.

Extended self-test routine

recommended polling time:     (  48) minutes.

SCT capabilities:           (0x003f)   SCT Status supported.

               SCT Error Recovery Control supported.

               SCT Feature Control supported.

               SCT Data Table supported.
```

```
smartctl -A /dev/sda

smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.0.5-gentoo] (local build)

Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== 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     0x000b   100   100   016    Pre-fail  Always       -       0

  2 Throughput_Performance  0x0005   100   100   050    Pre-fail  Offline      -       42

  3 Spin_Up_Time            0x0007   120   120   024    Pre-fail  Always       -       164 (Average 168)

  4 Start_Stop_Count        0x0012   099   099   000    Old_age   Always       -       5153

  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       2

  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0

  8 Seek_Time_Performance   0x0005   100   100   020    Pre-fail  Offline      -       0

  9 Power_On_Hours          0x0012   098   098   000    Old_age   Always       -       18500

 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0

 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       3733

192 Power-Off_Retract_Count 0x0032   096   096   000    Old_age   Always       -       5477

193 Load_Cycle_Count        0x0012   096   096   000    Old_age   Always       -       5477

194 Temperature_Celsius     0x0002   181   181   000    Old_age   Always       -       33 (Min/Max 11/52)

196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       2

197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x000a   200   253   000    Old_age   Always       -       184
```

I have run: smartctl -t long /dev/sda - Here some outputs - 

Here smartctl -a /dev/sda: http://pastebin.com/rYn0Qz9X

Here dmesg: http://pastebin.com/ZenF8NXw

```
 iostat 

Linux 4.0.5-gentoo (mg_6300)    02/07/2016    _x86_64_   (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          33.11    0.06    4.11   18.26    0.00   44.45

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn

nullb0            0.00         0.00         0.00         12          0

nullb1            0.00         0.00         0.00         12          0

sda             190.68      1579.99      1825.05    5394015    6230613
```

Thanks

----------

## Myu

There's definitely an issue. Did you mesure your iowait while idling ? 18% of iowait is huge.

Here's my while light browsing with a few programs opened :

```
Linux 4.1.15-gentoo-r1_noPS/2 (Dwarf)    02/07/2016    _x86_64_   (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

           7.29    0.13    1.73    0.79    0.00   90.06

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn

sda               7.64       235.38        78.16     402406     133619

sdb              10.03       506.17        24.64     865361      42120

sdc               0.16         1.29         0.01       2201         12

```

To me, the smartctl looks clean even if 18500 power-on hours is a respectable number.

Could there be a process sucking your io ? sys-process/iotop could tell you which process is using it.

----------

## pmam

 *Quote:*   

> Could there be a process sucking your io ? sys-process/iotop could tell you which process is using it.

 

The problem comes and goes.. At the moment, it is working ok (though iowait is 10%)

Quite frustrating - when it happens the computer becomes very slow and sometimes getting stuck

I will run iotop when the problem occurs again

----------

## pmam

Myu,

Here two problematic process - when machine becomes slow this process (and also seamonkey) has high 'SWAPIN' in iotop data:  

```
plugin-container /usr/lib64/nsbrowser/plugins/li~omni.ja -appdir /usr/lib64/seamonkey 3202 plugin
```

```
 iostat 

Linux 4.0.5-gentoo (mg_6300)    02/08/2016    _x86_64_   (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          25.11    0.03    3.21   17.33    0.00   54.32

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn

nullb0            0.00         0.00         0.00         12          0

nullb1            0.00         0.00         0.00         12          0

sda             108.11      1056.85       960.54    3258936    2961949
```

BTW: How to copy or screenshot iotop output (it is running on screen...)?

Thanks

----------

## Myu

SWAPIN doesn't looks good, it may means that you're running out of memory (RAM) so your system use your swap file / partition to avoid crashing; this has terrible influence on responsiveness and performance ( disk i/o is extremely slow compared to RAM )

Could you confirm this by running htop when your system is under such a load a look at the RAM and swap used ? 

You can run iotop with the -b flag so it run in batch mode  :Smile: 

----------

## pmam

Myu,

After you pointed out this RAM/swap issue I decided to open the machine -

cleaned all RAM and Hard Disk contacts with spray.

So far so good - may be it is only for a moment but let's be optimistic... 

Take a look at this output - iowait 1.93! 

```
iostat 

Linux 4.0.5-gentoo (mg_6300)    02/08/2016    _x86_64_   (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          28.58    0.05    2.00    1.93    0.00   67.45

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn

nullb0            0.00         0.00         0.00         12          0

nullb1            0.00         0.00         0.00         12          0

sda               6.59       141.71       402.84     415211    1180293
```

iotop -b it is a good idea - after stopping this service we can copy results...   :Smile: 

Hope it will last long time and always remember: If you can't beat them spray them...    :Wink: 

Thanks

----------

## Myu

Nice, I hope it solves your issue once and for all :]

----------

## NeddySeagoon

pmam,

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

  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       2

194 Temperature_Celsius     0x0002   171   171   000    Old_age   Always       -       35 (Min/Max 11/52)

196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       2

197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
```

Your drive has two relocated sectors.  That's what drives do so that they look error free to the operating system.

At 18,500 hours 2 is OK.  They may nave been there since the drive was made.

Current_Pending_Sector is a count of sectors that the drive would like to relocate but can't as it can no longer read them.

Zero is a good number here. So far, so good ... but 

```
 40 51 18 e7 fd 2a ea  Error: UNC 24 sectors at LBA = 0x0a2afde7 = 170589671
```

There is a sequence of 24 sectors, starting at LBA = 0x0a2afde7 that look like they may be problematic.

However, that error was at disk power-on lifetime: 3623 hours and the drive is now at 

```
9 Power_On_Hours          0x0012   098   098   000    Old_age   Always       -       18500
```

so nothing has happened for a long time.

Lastly,

```
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error

# 1  Extended offline    Interrupted (host reset)      10%     18499 
```

The long test is not complete but the first 90% of the drive is OK.

In short, its unlikely that this drive is the cause of the slowdown issues.

----------

## pmam

NeddySeagoon,

 *Quote:*   

> In short, its unlikely that this drive is the cause of the slowdown issues.

 

Thanks for your advise -I was worry my Hard Disk is going to... BTW I learned some nice tools of HD's analysing

Finally, I cleaned RAM's contacts and exchanged their slots - so far machine working nicely!    :Smile: 

Thanks

----------

## NeddySeagoon

pmam,

Boot into memtest and run a few cycles - it will tell you a thing or two about your RAM subsystem.

Its not useful to run it within Linux, since the virtual memory management will get in the way.

It needs to be run on the bare hardware.

'Wiping the contacts' as you have done fixes many problems.

The effect may not last though.

----------

## pmam

NeddySeagoon,

Sorry but I do not know how to run memtest - 

I do not have it in boot screen - just current kernel and Advanced option has only old kernels.

Should I install it? Do not find any relevant wiki...

----------

## Tony0945

 *pmam wrote:*   

> Sorry but I do not know how to run memtest - .

 

https://www.system-rescue-cd.org/SystemRescueCd_Homepage

Memtest is one of the boot options. This CD is invaluable for repairing Gentoo problems as Gentoo is it's operating system.The Memtest is a standalone boot also on the CD. Memtest can't run in RAM because it's writing all over RAM.

If you don't have CD drive, the website has instructions on how to put the ISO on a USB stick. It's easy to do.

----------

## pmam

Tony0945,

I am trying to put  the ISO on a USB stick but system do not detect USB  

Do not know what have happened? It was ok month ago...

Here dmesg:

```
 new high-speed USB device number 15 using ehci-pci

[12828.863320] usb 1-8: New USB device found, idVendor=125f, idProduct=c08a

[12828.863328] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3

[12828.863334] usb 1-8: Product: ADATA USB Flash Drive

[12828.863337] usb 1-8: Manufacturer: ADATA

[12828.863342] usb 1-8: SerialNumber: 147120015215004C

[12828.863624] usb-storage 1-8:1.0: USB Mass Storage device detected

[12828.864957] scsi host13: usb-storage 1-8:1.0

[12829.867631] scsi 13:0:0:0: Direct-Access     ADATA    USB Flash Drive  0.00 PQ: 0 ANSI: 4

[12829.868482] sd 13:0:0:0: Attached scsi generic sg2 type 0

[12829.869737] sd 13:0:0:0: [sdb] 30341120 512-byte logical blocks: (15.5 GB/14.4 GiB)

[12829.870504] sd 13:0:0:0: [sdb] Write Protect is off

[12829.870513] sd 13:0:0:0: [sdb] Mode Sense: 23 00 00 00

[12829.871406] sd 13:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA

[12829.881877] sd 13:0:0:0: [sdb] Attached SCSI removable disk
```

----------

## Tony0945

 *pmam wrote:*   

> Tony0945,
> 
> I am trying to put  the ISO on a USB stick but system do not detect USB  
> 
> Do not know what have happened? It was ok month ago...
> ...

 

Is it just that USB or all USB's?

Was this before or after putting the ISO on?

I actually used Windows, but the Linux instructions looked easier.

----------

## pmam

 *Quote:*   

> Is it just that USB or all USB's? 

 

I have another USB disk on key and also not detected. But MP3 USB is ok.

 *Quote:*   

> Was this before or after putting the ISO on? 

 

Before. I downloaded ISO file wanted to plug in USB and burn this ISO file, but not detected.

I think that at the moment this USB has windows xp instillation package

Really wird... Is there any way to see the files inside?

Here lsusb:

```
lsusb

Bus 001 Device 023: ID 125f:c08a A-DATA Technology Co., Ltd. C008 Flash Drive

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 016: ID 046d:c03e Logitech, Inc. Premium Optical Wheel Mouse (M-BT58)

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
```

----------

## NeddySeagoon

pmam,

```
[12829.881877] sd 13:0:0:0: [sdb] Attached SCSI removable disk
```

is good but the partition table is not detected.

That may or may not matter.  Some USB sticks have a partition table, others appear like big floppy drives where the filesystem is the whole volume.

What does fdisk say about /dev/sdb ?

Can you mount /dev/sdb ?

----------

## pmam

NeddySeagoon,

I just see your reply - Maybe it is due to windows xp files on it?

Anyway - Can I go ahead with these commands:

```
mkdir -p /tmp/cdrom

mount -o loop,exec /path/to/systemrescuecd-x86-x.y.z.iso /tmp/cdrom
```

EDIT: 

```
Disk /dev/sdb: 14.5 GiB, 15534653440 bytes, 30341120 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

Disklabel type: dos

Disk identifier: 0x006ad29c

Device     Boot Start      End  Sectors  Size Id Type

/dev/sdb1        2048 30341119 30339072 14.5G  7 HPFS/NTFS/exFAT
```

EDIT2:

```
mount -o loop,exec systemrescuecd-x86-4.7.1.iso /tmp/cdrom

mount: /dev/loop0 is write-protected, mounting read-only
```

----------

## NeddySeagoon

pmam,

That clearly works.  There is a partition table on /dev/sdb.

 *Quote:*   

> Anyway - Can I go ahead with these commands: 

 You just did  :)

----------

## pmam

OK - I have done the previous commands and now looks that it is ok and burning...

EDIT: Just finished SystemRescueCD installation and now going to memtest...

----------

## pmam

memtest run few times and RAM is ok - no errors - hope it will last for long time...

For whom who do not find memetest in SystemRescueCd's (like me...):

It is in a submenu of 'floppy disk'...

Now after burning with SystemRescueCd's ISO , sytem detects USB stick

Thanks you all

----------

## NeddySeagoon

pmam,

That's as good an assurance as you can get for you RAM subsystem.

Even when it finds errors, it does not mean its the RAM itself.

----------

