Regards failing Harddrives, there's one important rule - don't work too much with the original drive, but work on a copy of it. The way I deal with broken drives is:
1. use dd to make a binary equivalent copy of the original harddrive to a file on a good harddrive.
2. loop mount the file I just dd'd
3. do all the manipulations on the loop mounted copy.
1. DD
DD is a program to read a storage device sector by sector and to write the information onto another device / file. To dd a drive I would do something like:
Code:
dd if=<orig device node> of=/path/to/my/copy
Where <orig device node> is the specifier of the original storage device and /path/to/my/copy would be the file name of the binary equivalent copy on my known good storage device. For example, to copy the first partition of my first harddrive (/dev/sda1) to the file /home/user/dumps/myharddrive.img I would issue:
Code:
dd if=/dev/sda1 of=/home/user/dumps/myharddrive.img
where /home/user/dumps is located on the known good hardware. This would read the first partition of the drive sda sector by sector and write the data to the file myharddrive.img
The resulting file myharddrive.img would contain the entire partition sda1. Note that the original partition has to be unmounted before doing the dd copy. dd will run a while - maybe an hour or so (depending on the size of the original partition). Once finished, I would disconnect the original bad drive so it won't incur further damage.
2. Once the bad drive is copied with dd we can loop mount the copy. I would create a directory first:
Code:
mkdir /home/user/mymountpoint
And then I'd loop mount the copied image in read only mode:
Code:
mount -o loop,ro /home/user/dumps/myharddrive.img /home/user/mymountpoint
Now the entire partition will be accessible in /home/user/mymountpoint, i.e. I'd be able to read the files just as if I used the original bad harddrive.
Hope this helps! Sorry for any mistakes, I wrote this in a bit of a haste. Corrections welcome!