Some of you may have noticed my server was not responding yesterday night.This is because recently, I noticed some bad log messages:
Jul 7 20:09:45 kinder kernel: hda: dma_intr: status=0x51 { DriveReady SeekComplete Error }
Jul 7 20:09:45 kinder kernel: hda: dma_intr: error=0x40 { UncorrectableError }, LBAsect=98274971, sector=86507576
Jul 7 20:09:45 kinder kernel: end_request: I/O error, dev 03:03 (hda), sector 86507576
And of course the disk was also making some strange noise, which was a good indication it is dying.I'm now used to that since it is the 3rd system disk I have to replace on my server, this is what happens when you have a computer on all day...
But this time, since the disk is still almost working, instead of installing the whole system again and restore backups, I was able to copy the old disk to a new one.
I bought a new desktop recently so I have my previous 120gb hard drive which is empty, so I used this one to replace the dying 60gb hard drive on my server.
This is how I copied the whole disk (including the partitions tables):
dd if=/dev/hda of=/dev/hdd conv=noerror,notrunc,sync bs=512This took a long time but I managed to obtain an exact copy, with some small holes on the broken sectors.
Running
fsck on this new disk allowed me to repair these defects.But now since I copied a 60gb image on a 120gb disk I have another 60gb unused part at the end.
I used
parted to enlarge the ext3 partition... in fact since it was very late and I had no time and will to read the man pages, I booted a Ubuntu live CD and run gparted, which was easier ;-)I then removed the buggy drive, and moved the new one to replace it, and the system just booted as before, except that now I have no more errors and much more space.
Victory!