# Clicking Hardrive

## snakeo2

Hello,

Recently the hardrive where I have gentoo has been making a clicking noise which is followed by a period of "freezing". The first times it happened, the system would freeze after  a few clicks and would return to normal after a few seconds. Today it did again....it clicked for a few times and then froze and didnt come back.  I had to do a hard reboot. I've had this drive for almost 4 years now and I have a feeling it may be going bad. Is there a way to check the health of the disk? Or a program similar to Norton's Ghost to copy/transfer the entire drive a new one? I know of "DD" but not very familiar with it. Thanks in advance.

----------

## NeddySeagoon

snakeo2,

Thats the click of death.

smartmontools will show you the drive internal log file but the clicking you describe is the head recalibrating after a failed seek.

Total failure is immenent.

dd is not the best tool to image a broken drive.  ddrescue (without the hyphen/underscore) is much better.

It needs an output drive of file at least as big at the partition/drive you want to image and some space for a log.  The log can grow quite large.

It starts off like dd, reading from the front of the drive towards the back, when it hits an error, it continues from half way down the drive and comes back to the skipped blocks later. It only quits if it can image the whole drive.

Failures like this are often due to bearing problems so running the drive in unusual positions helps. e.g. on edge, upside down, on its side ...

The idea is to use gravity to make the spin motor bearings operate on an unworn bearing area ... just once, while you get the data back.

----------

## d2_racing

Maybe he could try a Stage 5 backup and see if he can backup what he needs.

----------

## snakeo2

Thank you both for your suggestions. I think I will give ddrescue a try. Neddy, in your opinion, do you think I will be able to image the entire drive, so that the only changes I'll  have to make will be to edit fstab & grub? I've read some of documentation of ddrescue and it's alot to digest. I probably wont be able till the weekend, but I want to prepare so I minimize my problems. I have a new drive that I picked up a few weeks ago which I will be using. 

gentoo right now is on /dev/sdb

The new drive is /dev/sdd. They are both sata drives.

From one of the examples posted at the ddrescue website, it looks like the following is the one that would apply to my situation:

"Example 1: Rescue a whole disc with two ext2 partitions in /dev/hda to /dev/hdb

Note: you do not need to partition /dev/hdb beforehand.

     ddrescue -n /dev/hda /dev/hdb logfile

     ddrescue -dr3 /dev/hda /dev/hdb logfile

     fdisk /dev/hdb

     e2fsck -v -f /dev/hdb1

     e2fsck -v -f /dev/hdb2"

I would probably modify a few lines, and also I only have one ext2 partitiion, not sure if that makes a difference or not. So I would probably do the following:

ddrescue -n /dev/sdb /dev/sdd logfile

ddrescue -dr3 /dev/sdb /dev/sdd logfile

fdisk /dev/sdd

e2fsck -v -f /dev/sdd1

----------

## NeddySeagoon

snakeo2,

ddrescue works on whole drives or whole partitions. If your old and new drives are identical sizes, then 

```
ddrescue -n /dev/hda /dev/hdb logfile
```

won't work as the log file cannot fit on either drive - you don't want to write it to the dying drive anyway. You need somewhere else for the log ... and you will need the log.

Take note of the warnings in the man page - do not have the dying drive mounted read/write. 

In the example

```
     ddrescue -n /dev/hda /dev/hdb logfile

     ddrescue -dr3 /dev/hda /dev/hdb logfile
```

has two goes at recovering hda no matter how many partitions it has.

The first pass gets all the easy to read data and the second pass tries a lot harder. If there is nothing to do because you got lucky and the first pass recovered everything, the second pass will exit after its read the log file from the first pass. The logfile needs to be the same file in every run to prevent attempts to recover data thats already been read.

If your drives are different sizes, you have a few choices.

1. Recover the dying drive to a file on the new bigger drive, then unpick the data from the file.

2. Partition the new drive so it has partitions the same size as the partitions you want to recover, then recover each partition in turn, with something like 

```
     ddrescue -n /dev/hda1 /dev/hdb1 logfile1

     ddrescue -dr3 /dev/hda1 /dev/hdb1 logfile1
```

These approaches have the advantage you can put the log file onto the output disk in some of its free space.

You only need 

```
fdisk /dev/hdb
```

to look at the partition table or to remake it if it was lost. A whole drive copy would copy it too.

```
     e2fsck -v -f /dev/hdb1

     e2fsck -v -f /dev/hdb2
```

I would add a -n into e2fsck because I don't want it to fix things until I know what the errors are. Even then, it might be better to try read only mounts with alternate superblocks before allowing any filesystem changes.

----------

