LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Recover Linux Hard Disk (http://www.linuxquestions.org/questions/linux-hardware-18/recover-linux-hard-disk-508433/)

yangontha 12-07-2006 11:58 PM

Recover Linux Hard Disk
 
I have installed Linux Fedora 5 on old IBM Notebook. It is working correctly, until one day the notebook can't start up.
I took out the hard disk with the intention of attaching to some working PC to get the data back from the Hard disk.

I tried to use the mini enclosure where the hard disk can put and attach with USB to a desktop. The desktop recognizes the hard disk. But it does not show as I expect like directories, such as /home/user1 ...
(I have used the mount command..)

Does it mean that the hard disk is also corrupted or is it my method of retrieval is wrong? Is there any other way to retrieve the data back from the 2.5inch hard disk?

Lenard 12-08-2006 06:39 AM

Taking a wild stab in the dark, maybe you have multiple partitions on the hard drive and only mounted one of them (the first one). Remove the drive from the system after un-mounting the partition wait for a few seconds then re-attach the hard drive to the system. Now have a look at the messages file as root, for example;

$ sudo tail /var/log/messages
Dec 8 07:29:31 Aspire5000 kernel: scsi 1:0:0:0: Direct-Access TOSHIBA MK1031GAS 0811 PQ: 0 ANSI: 0
Dec 8 07:29:31 Aspire5000 kernel: SCSI device sda: 195371568 512-byte hdwr sectors (100030 MB)
Dec 8 07:29:31 Aspire5000 kernel: sda: test WP failed, assume Write Enabled
Dec 8 07:29:31 Aspire5000 kernel: sda: assuming drive cache: write through
Dec 8 07:29:31 Aspire5000 kernel: SCSI device sda: 195371568 512-byte hdwr sectors (100030 MB)
Dec 8 07:29:31 Aspire5000 kernel: sda: test WP failed, assume Write Enabled
Dec 8 07:29:31 Aspire5000 kernel: sda: assuming drive cache: write through
Dec 8 07:29:31 Aspire5000 kernel: sda: sda1 sda2 sda3
Dec 8 07:29:31 Aspire5000 kernel: sd 1:0:0:0: Attached scsi disk sda
Dec 8 07:29:31 Aspire5000 kernel: sd 1:0:0:0: Attached scsi generic sg0 type 0

Yep, three partitions in this case. So each each partition may need mounting, lets check;

$ fdisk -l

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 7088 56829937+ 83 Linux
/dev/hda3 7089 7296 1670760 82 Linux swap / Solaris

Disk /dev/sda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 11945 95843790 83 Linux
/dev/sda3 11946 12161 1735020 82 Linux swap / Solaris

Hmmm.... partition 3 (sda3) is a swap partition no reason to mount it. Checking the first partition (mounting and list the contents);

$ sudo mount -t auto /dev/sda1 /media/usb1
[lenard@Aspire5000 ~]$ ls-al /media/usb1
bash: ls-al: command not found
[lenard@Aspire5000 ~]$ ls -al /media/usb1
total 9484
drwxr-xr-x 4 root root 1024 Dec 5 19:52 .
drwxr-xr-x 7 root root 4096 Oct 10 18:06 ..
-rw-r--r-- 1 root root 42093 Nov 21 13:56 config-2.6.19
drwxr-xr-x 2 root root 1024 Dec 5 20:01 grub
-rw------- 1 root root 1296359 Nov 30 07:24 initrd-2.6.19.img
-rw------- 1 root root 2908789 Dec 5 19:53 initrd-2.6.19lmc.img
drwx------ 2 root root 12288 Dec 3 04:35 lost+found
-rw-r--r-- 1 root root 23108 Oct 27 14:38 message
-rw-r--r-- 1 root root 21282 Oct 27 14:38 message.ja
lrwxrwxrwx 1 root root 20 Dec 5 19:52 System.map -> System.map-2.6.19lmc
-rw-r--r-- 1 root root 1034599 Nov 30 07:24 System.map-2.6.19
-rw-r--r-- 1 root root 1009496 Dec 5 19:52 System.map-2.6.19lmc
lrwxrwxrwx 1 root root 17 Dec 5 19:52 vmlinuz -> vmlinuz-2.6.19lmc
-rw-r--r-- 1 root root 1699569 Nov 30 07:24 vmlinuz-2.6.19
-rw-r--r-- 1 root root 1601164 Dec 5 19:52 vmlinuz-2.6.19lmc

This partition looks like a /boot partition(which it is BTW). I already know the other partition (sda2) is the root partition and does have the standard directory structure and I will not bore you with doing the mount and directory listing.

yangontha 12-17-2006 09:32 PM

Recover Linux Hard Disk
 
Hi,

[First of all, apologies for replying late. I got difficulties in log in and post.]

You are right in telling me that there are more partitions.

I looked at /var/log/messages as you mentioned and found that


Vendor: IBM Model: DARA-206000 Rev: AR2I
Type : Direct-Access ANSI SCSI revision: 02
SCSI device sda: 11733120 512-byte hdwr sectors (6007 MB)
Sda: Write Protect is off
Sda: assuming drive cache: write through
SCSI device sda: 11733120 512-byte hdwr sectors (6007 MB)
Sda: Write Protect is off
Sda: assuming drive cache: write through
Sda: sda1 sda2
Sd 3:0:0:0: Attached scsi disk sda
Sd 3:0:0:0: Attached scsi generic sg0 type 0


$ mount t auto /dev/sda1 /mnt/minidrive

$ ls

config-2.6.11-1.1369_FC4
grub
initrd-2.6.11-1.1369_FC4.img
lost+found
System.map-2.6.11-1.1369_FC4
vmlinuz-2.6.11-1.1369_FC4

$ umount /mnt/minidrive

$ mount t auto /dev/sda2 /mnt/minidrive

hsf:unable to find HFS+ superblock
mount: you must specify the file system type

Lenard 12-18-2006 05:15 AM

What filesystem is on the second partition?? With the drive attached and no partitions mounted check;

fdisk -l

If you know that the second partition is ext2/3 then change the partition type to 83 after making a raw backup of the partition using dd, example below;

dd if=/dev/dsa2 of=part2.img bs=32K

Use something like parted to delete and recreate the partition, make sure you use the exact same start and ending points. Also let parted first check the partition.

yangontha 12-19-2006 03:42 AM

Hi,

I checked the partition with fdisk -l and the result is:-

Disk /dev/sda: 6007 MB, 6007357440 bytes
15 heads, 63 sectors/track, 12416 cylinders
Units = cylinders of 945 * 512 = 483840 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 217 102501 83 Linux
/dev/sda2 218 12416 5764027+ 8e Linux LVM


I am not very sure about the second part of your message regarding the raw backup using dd.
Please tell me again what to do with the above data.

Sorry for asking details.

with best regards,

Lenard 12-19-2006 04:56 AM

The dd command can make an image of the data of the second partition (sda2) to someplace on another hard drive. Since the partition is LVM then use the proper tools to mount and hopefully read the partition;

http://www.linuxjournal.com/article/8874


All times are GMT -5. The time now is 06:17 AM.