Announcement

Collapse
No announcement yet.

HOWTO: Rescue data from hard disk

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HOWTO: Rescue data from hard disk

    My 80G Seagate Barracuda crashed. Cpu load 100 % and kubuntu told that:
    Buffer I/O error on device sdb1...
    Unmounted sdb and checked smart log /2/

    Note
    smartmontools/smartctl does not work on SATA drives on Linux Kernel 2.6.20-15.27
    https://bugs.launchpad.net/ubuntu/+s...20/+bug/106821

    Code:
    :~$ sudo smartctl -d ata -l selftest /dev/sdb
    smartctl version 5.34 [i686-pc-linux-gnu] Copyright (C) 2002-5 Bruce Allen
    Home page is http://smartmontools.sourceforge.net/

    === START OF READ SMART DATA SECTION ===
    SMART Self-test log structure revision number 1
    Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
    # 1 Extended offline Completed: read failure 90% 2337 62964346
    # 2 Short offline Completed: read failure 90% 2337 62964346

    A moment of googling: I did find this: Ddrescue - Data recovery tool /3/. It's also in the repositories...


    HOW I RESCUED DATA FROM HARD DISK (two examples).


    From /1/
    Example 1: Rescue an ext2 partition in /dev/hda2 to /dev/hdb2
    ddrescue -r3 /dev/hda2 /dev/hdb2 logfile
    e2fsck -v -f /dev/hdb2
    mount -t ext2 -o ro /dev/hdb2 /mnt

    Rescuing ext partition from sata disk.

    Copying data from sdb to sda (you need empty partition, both partitions are unmounted).

    Code:
    :~$ sudo ddrescue -r3 /dev/sdb1 /dev/sda2 logfile
    Password:
    Press Ctrl-C to interrupt
    Initial status (read from logfile)
    rescued: 0 B, errsize: 0 B, errors: 0
    Current status
    rescued: 80023 MB, errsize: 147 kB, current rate: 0 B/s
    ipos: 32237 MB, errors: 291, average rate: 6055 kB/s
    opos: 32237 MB
    It did take 4 hours (-r3, tries three times)


    Checking rescued data.

    Code:
    :~$ sudo e2fsck -v -f /dev/sda2
    Password:
    e2fsck 1.38 (30-Jun-2005)
    Pass 1: Checking inodes, blocks, and sizes
    Inode 4374541, i_blocks is 104, should be 208. Fix<y>? yes

    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    Block bitmap differences: +(8757335--8757347)
    Fix<y>? yes

    Free blocks count wrong for group #267 (13, counted=0).
    Fix<y>? yes

    Free blocks count wrong (3708177, counted=3708164).
    Fix<y>? yes


    /dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****

    120565 inodes used (1%)
    6180 non-contiguous inodes (5.1%)
    # of inodes with ind/dind/tind blocks: 99879/1173/0
    15828876 blocks used (81%)
    0 bad blocks
    0 large files

    118969 regular files
    1587 directories
    0 character device files
    0 block device files
    0 fifos
    0 links
    0 symbolic links (0 fast symbolic links)
    0 sockets
    --------
    120556 files
    Mounting rescued data (read only)
    Code:
    sudo mount -t ext3 -o ro /dev/sda2 /media/sata/sat2
    Now i have 58 G rescued data.



    Rescuing fat partition from pata disk

    I have old 40G Maxtor DiamondMax (windows use). It died 2003. Plugged it in the computer (hdb).


    Checking partitions

    Code:
     :~$ sudo fdisk -l /dev/hdb
    Disk /dev/hda: 40.0 GB, 40037760000 bytes
    255 heads, 63 sectors/track, 4867 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hdb1 * 1 447 3590496 b W95 FAT32
    /dev/hdb2 448 4111 29431080 f W95 Ext'd (LBA)
    /dev/hdb5 448 1722 10241406 b W95 FAT32
    /dev/hdb6 1723 4111 19189611 b W95 FAT32
    Checking:

    Code:
     :~$ sudo smartctl -l selftest /dev/hdb
    Home page is http://smartmontools.sourceforge.net/

    === START OF READ SMART DATA SECTION ===
    SMART Self-test log structure revision number 0
    Warning: ATA Specification requires self-test log structure revision number = 1
    Num Test_Description Status Remaining LifeTime(hours) LBA _of_first_error
    # 1 Short offline Completed: servo/seek failure 60% 164 733 69121

    Trying to rescue data from hdb6

    Code:
    :~$ sudo ddrescue -r3 /dev/hdb6 /dev/sdb1 logfile
    Press Ctrl-C to interrupt
    Initial status (read from logfile)
    rescued: 0 B, errsize: 0 B, errors: 0
    Current status
    rescued: 19648 MB, errsize: 1978 kB, current rate: 0 B/s
    ipos: 19632 MB, errors: 3885, average rate: 3046 kB/s
    opos: 19632 MB
    It did take 3 hours.


    Checking rescued data (using dosfsck)

    Code:
    :~$ sudo dosfsck -v -f /dev/sdb1
    Password:
    dosfsck 2.11 (12 Mar 2005)
    dosfsck 2.11, 12 Mar 2005, FAT32, LFN
    Checking we can access the last sector of the filesystem
    Boot sector contents:
    System ID "MSWIN4.1"
    Media byte 0xf8 (hard disk)
    512 bytes per logical sector
    16384 bytes per cluster
    32 reserved sectors
    First FAT starts at byte 16384 (sector 32)
    2 FATs, 32 bit entries
    4796416 bytes per FAT (= 9368 sectors)
    Root directory start at cluster 2 (arbitrary size)
    Data area starts at byte 9609216 (sector 18768)
    1198764 data clusters (19640549376 bytes)
    63 sectors/track, 255 heads
    27663993 hidden sectors
    38379222 sectors total
    Reclaiming unconnected clusters.
    Checking free cluster summary.
    /dev/sdb1: 26773 files, 288001/1198764 clusters

    Mounting rescued data
    Code:
    sudo mount -t vfat -o ro /dev/sdb1 /media/sata/sat1
    Rescued 4,4 G


    Very good program ! wow !!


    If you are afraid of konsole :

    kdiskrescue
    http://www.kde-apps.org/content/show.php?content=49081
    Description:
    KDiskRescue is a KDE frontent to the gnu program ddrescue.

    It's written with korundum, the qt/kde ruby bindings. So it depends to korundum and ddrescue.

    It's still an alpha, so expect issues and report them if you can. Illustrations are alpha too
    Note :
    I have not tried it.



    /1/ man ddrescue, info ddrescue
    /2/ man smartctl
    /3/ www.gnu.org/software/ddrescue/ddrescue.html
    Before you edit, BACKUP !

    Why there are dead links ?
    1. Thread: Please explain how to access old kubuntu forum posts
    2. Thread: Lost Information
Working...
X