# [saved] HD heading to a crash

## meranto

First off, I'm not sure it this is the right subforum, but this seemed best to me.

I have a Dell Inspiron 1150 (warranty expired) with an "ata-TOSHIBA_MK3021GAS_14QH0789T" 30GB HD (according to "/dev/disk/by-id"). Since a while this HD is making strange noises and it's performing weird.

1 - The HD is creating a constant "rrrrrrrrrrrrrrrrr" sound, even when it's not doing anything at all. I have laptop-mode enabled and when it stops the HD due to inactivity the "rrrrrrrr"-sound is gone, so that's why I'm sure it's the HD and not the fan or whatever else.

2 - When I perform HD-intense tasks, like emerging, it seems like the HD gets out of sync or something like that every 0.5 to 15 seconds. When that happens it makes a small "beep" sound.

3 - After a while, when my laptop starts using the swap, it tends to slow down extremely much. A simple task like starting firefox will than take at least 2 minutes. During this the system almost freezes and the ratteling and beeping keeps going on constant. Only a reboot (clearing the memory) will eliminate the problem (for a while). 

4 - The same problem exists when my girlfriend uses Windows, so actually it's not gentoo-related, but the community here is much more helpful than the standard tech-forum community.

Having these problems I think it would be wise to buy a new HD (60 GB, 120 euro) and replace the old (which is almost as simple as switching the battery).

My questions are:

1 - How do I find out if my HD is really broken (or starting to brake down)?

2 - How do I switch HD without losing any data (if possible)? This will include all partitions (win + lin) + mbr.

----------

## fuzzythebear

Hi 

Basically  it  "sounds" like the drive's flocking south for winter .. 

This is what i found : 

Attach a new drive as slave to the Linux machine. Get a "parted" boot-diskette from

http://www.gnu.org/software/parted/parted.html

http://ftp.gnu.org/gnu/parted/bootdisk/

(It is complete FREE)

Start the machine with the boot-diskette and follow its instruction. You will be on your way. It takes about 15 minutes to clone a 40G HD.

So .. that should be a relatively painless process.

Since i want to make a clone of my hard drive to be used as a complete

backup ot the whole kit ill be trying this myself this weekend.

Two birds, one stone .. 

Happy hacking   :Smile: 

Fuzzy

----------

## meranto

 *fuzzythebear wrote:*   

> Attach a new drive as slave to the Linux machine. Get a "parted" boot-diskette from
> 
> http://www.gnu.org/software/parted/parted.html
> 
> http://ftp.gnu.org/gnu/parted/bootdisk/
> ...

 

I can only use one HD at the same time because it's a laptop, and I don't have a floppy-drive   :Sad: 

So actually i'm looking for a ghost-like feature for transferring data onto a set of cd's or a HD of someone else in the network. Can "dd" do this in combination with samba?

----------

## halfgaar

DD can by quite risky. If you should try it, you of course have to boot from a CD or something, because you can't do it on a live system.

Another idea, is to use G4u (you can find it on the ultimate boot cd). It can create images and send them over FTP. I guess it actually uses DD, but it's a safer way.

Also, you can use the UBCD for testing if you harddrive is failing. It contains all the disk-diagnoses tools of all manufacturers. I recommend the newest version of seatools (by seagate). The UBCD contains two versions of seatools, so be sure to use the newer one. It is the most interactive, you can immediatly see if something is wrong, instead of having to wait 2 hours.

----------

## meranto

I've tried the ultimate boot cd, but hardly any of the diagnostics tools worked on my laptop, including the ones from seagate, they all crashed without a message. I did a memory +cpu check and everything was fine.

I decided to buy a new HD (not from Dell off cource, I like to save some money) with 60GB of space. 

My current partition table:

hdc1, 5GB win (fat32)

hdc2, 5GB linux (reiserfs)

hdc3, 19.75GB share (ext3)

hdc4, 0.25GB swap (swap)

really... my cdrom is hda for some odd reason   :Confused: 

What I want is this:

hdc1, 7GB win (fat32)

hdc2, 7GB linux (reiserfs)

hdc3, 45GB share (ext3)

hdc4, 1GB swap (swap)

Transfer all data to new partitions (same basic layout, but partitions sized different) without having Linux or Windows crash (assuming both kernels support the new disk). I can fix the mbr with the gentoo installation cd when using it as a recovery disk.

Is this achievable? Is it easier than making an image, transfer it and resize the partitions afterwards? Does g4u have the capabilities of creating an image from a 5 GB partition and move it to a 7GB partition?

----------

## halfgaar

G4u doesn't copy into a partition, it creates one. Therefore, it can only create partitions as big as the orignal one.

I think the best way to go is something like partimage, but I don't think the target partitions can be of a different size. Perhaps resizing with parted afterwards is the only sollution.

You could also try seagates discwizzard. I've never used it, but perhaps it offers some advanced features. However, there is something about letting a non-gnu tool touch my ext3 (or reiser) partition that makes me uneasy. Perhaps it's better to stay with parted/partimage.

Smal swap space BTW. You sure you don't want 1 GB?

----------

## meranto

I tried g4u, but somewhere around 3GB it gives an error message and stops (I wasn't there, I used a frieds pc and left it overnight). The other cloning utilities don't offer FTP functionality or something similar, only disk to disk.

I also tried putting both of the disks in a regular pc, and use one of the other cloning utilities for disk to disk cloning, but the IDE-cables were sized different   :Evil or Very Mad:  so nu luck here.

I am now trying to ghost the HD to a set of CD-R's using some famous Windows-software, but again, no luck here. When creating the first cd the program quits, saying a sector is damaged   :Confused:   so I run a surface scan, but no errors were found. 

I don't trust Windows much, so I wonder if there is a ghost like program that can write the images to CD-R (with a bootable cd for restoring the image when I put the other disk in.

My computer knowlegde is not so great and I feel I'm running out of options for what I want. I know I can always just burn my important data to a cd, reinstall gentoo and windows etc, but that will be my last option, way behind any other alternative.

----------

## halfgaar

 *Quote:*   

> I tried g4u, but somewhere around 3GB it gives an error message and stops (I wasn't there, I used a frieds pc and left it overnight). The other cloning utilities don't offer FTP functionality or something similar, only disk to disk. 

 

Hmm, that G4u crashes is kind of strange. Wasn't it just that the HD of the target machine was full? Or, it suffered from bad clusters, as did the other tool you tried.

 *Quote:*   

> I also tried putting both of the disks in a regular pc, and use one of the other cloning utilities for disk to disk cloning, but the IDE-cables were sized different  so nu luck here. 

 

There are extension cards for running laptop HD's in normal computers. You could try to borrow one from someone, if someone near you has one. A friend of mine used one a long time ago. It worked fine, but he had only one problem. There was no indication what way the HD should be connected (e.g. what was pin 1). The power is included in the connector with laptop discs if I'm not mistaken, so a reversed plug my result in smoke. He guessed and was lucky  :Smile: 

 *Quote:*   

> I am now trying to ghost the HD to a set of CD-R's using some famous Windows-software, but again, no luck here. When creating the first cd the program quits, saying a sector is damaged  so I run a surface scan, but no errors were found. 

 

It is of course very possible that sectors are damaged on a disc which makes strange noises. It's also possible that software surface scans don't detect them. I did some experiments with bad block scanners a while ago, and each time I run them, they detect different blocks. It's not something that can be fully trusted.

 *Quote:*   

> I don't trust Windows much, so I wonder if there is a ghost like program that can write the images to CD-R (with a bootable cd for restoring the image when I put the other disk in. 

 

Doesn't norton ghost provide this functionality? I'm not sure that it does, but I can vaguely remember something about it.

I'm also kind of running out of ideas. Back up your important files at least, so when the drive suddenly goes bust, you still l have them. I'd backup /etc as well, because it's always convinient to have your old configs at hand.

My best suggestion is to try g4u a few times, perhaps it will succeed eventually. Also, doesn't the partimage bootcd provide network functionality? It can at least burn to CD, and because partimage itself is a boot CD, you can easily read those CDs back when you've got a new HD.

----------

## halfgaar

Topic starter, you being dutch, you might appreciate this link.

----------

## meranto

An update live from my new HD:

I managed to clone the partitions to my new HD, but the way in which it has been accomplished is not "from the books".

First I thought that Norton Ghost would be OK to just clone the Windows partition, which is indeed true, only one problem, Norton Ghost uses a bootdiskette, which I don't have in my laptop.

I found my rescue in the higly illegal "Hiren's boot CD", which is DOS based and carries almost all disk-related commercial software. I imaged the Win-partition to CD-RW and put it on the new HD. After this I used Partition Magic to grow the partition to 7GB. After this I imaged my Gentoo-partition (reiserfs) but I wasn't sure if Norton Ghost could handle this. I found out that I had to use the -ia option (clone all, sector by sector). 

Now things started to get easy, I put the Gentoo-partition on the new HD, ran the systemrescue CD x86 to boot into Gentoo, ran Lilo and my pc was bootable again. Next I used QTParted from that same cd to resize the reiserfs partition.

Then I cloned my ext3-partition, which went fine but costed me 26 CD-R's (ran out of CD-RW's). Now I only need to resize my ext3-partition, but this gives me some final headaches. parted/qtparted can't resize ext3, cfdisk can't maximize and partition magic can do no better.

How can I resize my ext3-partition?

Thanks for the link btw, a good dutchman always ends up at tweakers.net

----------

## linuxtuxhellsinki

 *meranto wrote:*   

> 
> 
> How can I resize my ext3-partition?

 

resize2fs   :Cool: 

& if the problem is with the journal, then take it away with tune2fs for a while   :Wink: 

----------

## halfgaar

Resize2fs can't do it directly, but here's a quote from the manpage:

 *Quote:*   

> The resize2fs program does not manipulate the size of partitions.  If you wish to enlarge a filesystem, you must first
> 
>        make  sure you can expand the size of the underlying partition first.  This can be done using fdisk( by deleting the
> 
>        partition and recreating it with a larger size.  When recreating the partition, make sure you create it with the  same
> ...

 

So, be careful with resizing the partition!

----------

## meranto

Finally, everything is fine now.

I used tune2fs to remove the ext3 journal first, then I used fdisk to remove and recreate the ext3-partition so that 1 GB for my swap was left. After that I used resize2fs to maximize the filesystem to the partition size and used fdisk to create the last partition and parted to change the type to "linux-swap". In the end my partition table looks like this:

```
Number  Start   End     Size    Type      File system  Flags

1       32kB    7345MB  7345MB  primary   fat32        boot

2       7345MB  15GB    7337MB  primary   reiserfs

3       15GB    59GB    44GB    primary   ext3

4       59GB    60GB    1028MB  primary   linux-swap

```

So thanks everyone who helped me out here, I'm safe for a few more years now.

----------

## halfgaar

 *Quote:*   

> I'm safe for a few more years now.

 

Don't throw away your backups yet. Throwing them away is a bad idea in any event, but what I mean is, that you want to be sure your new HD doesn't have infancy failure. Most electronic devices either fail when they're relatively new, or at the expected end of their life. So, if it survives two months, it will probably last longer.

----------

## meranto

Oke, here is a little reopening of this topic.

Nothing is wrong yet, but I bought an external USB2.0-case for my old HD, just for making backups for as long as it lasts (it was only 8 euro's anyway).

How do I find out if, and how severely the HD is damaged yet? I did come across the "badblocks" app, but it's not in portage. What kind of apps are there available which can check for damaged parts of the HD and somehow "blacklist" the damaged parts so that the HD can still function?

----------

## halfgaar

The badblocks tool is part of e2fsprogs, or some other filesystem utils package, and should be used by giving mke2fs an option. But, don't use it. Let me explain.

Hard drives have bad sector management of their own. Unfortunatly, in an USB case, you can't check it's status. You can still make use of it, but you can't check it's status. I'm talking about a technology called SMART (self monitoring and analysis reporting technology). With SMART you can ask the drive a lot of things, like spin up times, seek-errors, age, errors at certain ages, blablabla. One important attribute is the "reallocated sector count". The drive reallocates sectors when they become unwritable. A good way to let this sytem work, is by zeroing the drive. You can either do that with DD, or use darik's boot and nuke (can be found on the ultimate boot cd) with it's zeroing method (but with a USB disk, that would be difficult...). Sectors are automaticly reallocated when writing to them fails. Once this is done, the drive should appear to the OS as without bad sectors. The reallocation happens transparantly. You can check how many reallocated sectors a drive has with SMART (install the smartmontools), but as I said, that's not possible when it's in an USB-case. 

When you can still detect badblocks with a software tool, the harddrive is so damaged, that it's beyond use. 

As an example, here's the SMART output of my drive:

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

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

=== START OF INFORMATION SECTION ===

Device Model:     ST3120026A

Serial Number:    5JT1CLQM

Firmware Version: 3.06

User Capacity:    120,034,123,776 bytes

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

ATA Version is:   6

ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 2

Local Time is:    Fri Jan  6 21:51:00 2006 CET

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:  (0x82) Offline data collection activity

                                        was completed without error.

                                        Auto Offline Data Collection: Enabled.

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

                                        No General Purpose Logging support.

Short self-test routine

recommended polling time:        (   1) minutes.

Extended self-test routine

recommended polling time:        (  85) minutes.

SMART Attributes Data Structure revision number: 10

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   054   048   006    Pre-fail  Always       -       25030990

  3 Spin_Up_Time            0x0003   096   096   000    Pre-fail  Always       -       0

  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       4

  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0

  7 Seek_Error_Rate         0x000f   084   060   030    Pre-fail  Always       -       274989286

  9 Power_On_Hours          0x0032   085   085   000    Old_age   Always       -       13547

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

 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       275

194 Temperature_Celsius     0x0022   041   051   000    Old_age   Always       -       41

195 Hardware_ECC_Recovered  0x001a   054   048   000    Old_age   Always       -       25030990

197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0

198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0

199 UDMA_CRC_Error_Count    0x003e   200   199   000    Old_age   Always       -       1

200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline      -       0

202 TA_Increase_Count       0x0032   100   253   000    Old_age   Always       -       0

SMART Error Log Version: 1

No Errors Logged

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%     12046         -

# 2  Extended offline    Completed without error       00%     10472         -

# 3  Short offline       Completed without error       00%     10471         -

# 4  Short offline       Completed without error       00%     10471         -

# 5  Short offline       Completed without error       00%      6770         -

# 6  Extended offline    Aborted by host               90%      5958         -

# 7  Extended offline    Aborted by host               90%      5951         -

# 8  Short offline       Completed without error       00%      5024         -

# 9  Extended offline    Aborted by host               80%      5024         -

#10  Short offline       Completed without error       00%      3697         -

#11  Short offline       Completed without error       00%       237         -

#12  Short offline       Completed without error       00%       145         -

#13  Short offline       Completed without error       00%        69         -

#14  Extended offline    Completed without error       00%        68         -

#15  Short offline       Completed without error       00%        66         -

#16  Short offline       Completed without error       00%        49         -

#17  Short offline       Completed without error       00%        29         -

#18  Short offline       Completed without error       00%        29         -

SMART Selective self-test log data structure revision number 1

 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS

    1        0        0  Not_testing

    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.
```

I've typed this in somewhat of a rush, so if anything is unclear, just ask  :Smile: 

----------

## meranto

Thank you very much for your educational reply. I'm still surprised that while we probably only live 10 km apart we didn't speak a single word in our language.

I tried zeroing the drive first before I wanted to partition it using 

```
dd if=/dev/zero of=/dev/sda
```

unfortunately the following message appeared after 30 minutes:

```
dd: writing to `/dev/sda': Input/output error

10932169+0 records in

10932168+0 records out

```

so I guess the disk really is too damaged to use. Would there be any last resort for still being able to use this, for example excluding a part of the disk from usage?

----------

## halfgaar

I've got a broken hard drive here I used with that trick for a while; creating a partition that is outside of the damaged area. If you specify blocksize to dd (like 1024 bytes, or 1k), you know how many bytes correspond to dd's reported records. You can then create two partitions, one from beginning to that area, and one from a little over that area to the end. If, BTW, running dd again gives an IO error on a different location, the sector reallocation may have worked correctly after all. You can try that as well.

You could also try to use the badblocks anyway (with the -c -c options to mke2fs, read manpage. Also don't forget -j). What I said still holds true, that the HD shouldn't be considered stable when you got it working like that, but it's worth a go. The reason why I suspect it doesn't work, is because the drive can do unpredictable things when the bad sectors are encountered. It won't act like a floppy, that the head will stay where the OS tells it to. On modern drives, the way the drive is represented to the OS is completely different from the actual geometry. As an example, when you've got a Maxtor disc which suffers from "click of death", the drive will lockdown or restart as soon as the bad clusters are reached.

BTW, that broken disc of mine was a maxtor with click of death. And it failed on me later, even after using that partition trick. I'm guessing there's also a part on the end that is broken.

But, the partition trick might fail in any case, because the head of the drive is constantly moved around when idle, to make sure a specific spot on the HD isn't warmed up too much. Because the drives internal electronics does that, it doesn't care about paritions, and might put itself on damaged sectors, possible causing problems. Not per definition, but possibly.

I'm getting very good at writing incomprehensible posts... I don't like rewriting it  :Wink: 

 *Quote:*   

> I'm still surprised that while we probably only live 10 km apart we didn't speak a single word in our language. 

 

Forum policy of course. 

If there's something that appears to hold true every time BTW, is that no one lives close to me... You live about 200 km away... I live near Groningen.

----------

