Disk Recovery in Linux

Recovery instructions


You use a combination of parted, ddrescue, and mount.

Parted will give you the offset to get to the filesystem.
ddrescue will recover the data from the disk and make an imagefile.
mount will allow you to mount the filesystem


These were based from Andre Miller’s website.

---
# ddrescue -v /dev/sdh imagefile.dd imagefile.log
---
# parted /dev/sdh
GNU Parted 1.8.1
Using /dev/sdh
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) unit                                                             
Unit?  [compact]? B                                                       
(parted) print                                                            

Model: WDC WD12 00JB-75CRA0 (scsi)
Disk /dev/sdh: 119999999999B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End            Size           Type     File system  
Flags
 1      32256B     32901119B      32868864B      primary  fat16             
 2      32901120B  119998609919B  119965708800B  primary  ntfs         
boot 

(parted) quit                       
---
# mount -o loop,ro,offset=32901120 imagefile.dd /mnt/raid/tempmount
---


You need to determine the offset and count:
Skip is 64260 (32901120/512) and Count is 29991427200 (119965708800/4)

#dd if=imagefile.dd of=image_part read the article.dd bs=512 skip=64260 count=29991427200
---


To mount a partition where you don’t know the offsets, you can use:

#fdisk -ul disk.iso
last_lba(): I don't know how to handle files with mode 81a4

Disk usbkey.dd: 0 MB, 0 bytes
229 heads, 32 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes

    Device Boot      Start         End      Blocks   Id  System
usbkey.dd1   *          32     7929855     3964912    c  W95 FAT32 (LBA)


Take the start value and multiply by 512 to get the offset.
i.e.
32*512=16384
63*512=32256

Posted in Knowledge and tagged , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.