We'll look at how to try some effective data recovery using Linux. The tool we'll base our attempts around is called dd_rescue, written by one Kurt Garloff. This program tries to read all the data from one 'block device' and copy it to another. We'll explain this terminology more later.
IDE drives are given the prefix hd followed by a single letter, so you can see there are two distinct physical devices attached to this machine - one is set as a master device on the primary interface of the first IDE controller (hda); the other is also a master device on the secondary interface of the first IDE controller (hdc). So we have one IDE controller, two interfaces (primary and secondary) and two IDE devices connected - each one configured as a master device on its particular interface.> ls /proc/ide drivers hda hdc ide0 ide1
To get more of a clue, let's take a look at the contents of the file fstab.
The block devices are listed in the lefthand column, with the /dev prefix, i.e. /dev/hda. The next column describes the mount point, i.e. the directory you must access in order to see the access the device. In the case of the device /dev/hda, the mount point is /media/cdrom0, which makes it apparent that this device is a CDROM drive (rather than a hard disk drive).> cat /etc/fstab # /etc/fstab: static file system information. # #proc /proc proc defaults 0 0 /dev/hdc1 / ext3 defaults,errors=remount-ro 0 1 /dev/hdc6 /home ext3 defaults 0 2 /dev/hdc7 /recovery ext3 defaults 0 2 /dev/hdc5 none swap sw 0 0 /dev/hda /media/cdrom0 udf,iso9660 user,noauto 0 0
The other block device listed that also showed up in /proc/ide is /dev/hdc. Now however, numbers are appended giving hdc1, hdc5, hdc6 and hdc7. Strictly speaking, these new entries refer to partitions of the physical hard disk drive, hdc. Although they all exist on the same physical hard disk, they are distinct as far as Linux is concerned, and they are still 'block devices'. It is these block devices that we specify to dd_rescue as being either the source or destination of the data we are trying to recover.
The answer is that it needs another partition of sufficient size on hdc. This is the partition you specify as the 'destination' to dd_rescue. Naturally, this partition should be as big (and preferably bigger) than the size of the drive you are trying to recover.
To avoid conflicting with the CDROM entry in fstab (hda), I made the newly attached hard drive a slave by changing its jumper settings. Thus, after removing the CDROM and adding the damaged drive, plus changing the BIOS as described above, I get:
Note that hda - the CDROM, formerly - has gone, to be replaced by hdb. This is the block device corresponding to the damaged disk.> ls /proc/ide drivers hdb hdc ide0 ide1
> dd_rescue /dev/hdb /dev/hdc7