This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
data_recovery [2018/08/22 16:07] peek |
data_recovery [2018/08/22 17:22] (current) peek |
||
|---|---|---|---|
| Line 26: | Line 26: | ||
| ====== Data Recovery ====== | ====== Data Recovery ====== | ||
| - | If the hardware is suspect, then the first thing to do is get a byte-for-byte copy of the drive' | + | If the hardware is suspect, then the first thing to do is get a byte-for-byte copy of the drive' |
| - | < | + | < |
| + | apt-get install gddrescue | ||
| + | ddrescue -A -f / | ||
| + | </ | ||
| This copy will remain unchanged while we work. Make a copy of this file, and only alter the copy. This way, if anything goes awry then we can go back to square one without having to rely on possibly faulty hardware again. | This copy will remain unchanged while we work. Make a copy of this file, and only alter the copy. This way, if anything goes awry then we can go back to square one without having to rely on possibly faulty hardware again. | ||
| Line 36: | Line 39: | ||
| Use testdisk to search for and repair disk partitions. | Use testdisk to search for and repair disk partitions. | ||
| - | < | + | < |
| + | apt-get install testdisk | ||
| + | testdisk work.img | ||
| + | </ | ||
| Using testdisk involves using the arrow, escape, and enter keys. | Using testdisk involves using the arrow, escape, and enter keys. | ||
| Line 53: | Line 59: | ||
| - Click: Quit\\ {{ : | - Click: Quit\\ {{ : | ||
| - | {{ : | + | Use photorec to recover deleted files. |
| + | < | ||
| + | < | ||
| + | |||
| + | - Confirm that you want to use the disk image work.img, click " | ||
| + | - Select partition, click: Search\\ {{ :: | ||
| + | - Select the filesystem type\\ {{ :: | ||
| + | - Select directory to save recovered files. | ||
| + | - Select: RECOVERY\\ {{ :: | ||
| + | - Select: DELETED\\ {{ :: | ||
| + | - Press: C\\ {{ :: | ||
| + | - photorec will process for a while. | ||
| + | - Select: Quit\\ {{ :: | ||
| + | - Select: Quit\\ {{ :: | ||
| + | |||
| + | Files that the filesystem thinks have been deleted are now stored in '' | ||
| + | |||
| + | Recover other files: | ||
| + | |||
| + | - Find a list of partitions: | ||
| + | < | ||
| + | fdisk -lu work.img | ||
| + | Disk work.img: 1.9 GiB, 2055208960 bytes, 4014080 sectors | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: dos | ||
| + | Disk identifier: 0x00000000 | ||
| + | |||
| + | Device | ||
| + | work.img1 | ||
| + | work.img5 | ||
| + | </ | ||
| + | - Find the offset from the beginning of the disk image file to the partition that you want to work with:\\ \\ '' | ||
| + | - Attach the partition to a loopback device:\\ < | ||
| + | - Attempt to fix the partition: | ||
| + | - Mount the fixed partition read-only: | ||
| + | - Copy files into '' | ||
| + | - Optional: Get a list of files for which tar failed:\\ < | ||
| + | - Optional: Find a list of files of size 0 bytes:\\ < | ||
| + | - Unmount the filesystem: | ||
| + | - Detach the loopback file:\\ < | ||
| + | |||
| + | Final contents of '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * fsck.log -- A log of all the changes that fsck made while fixing the filesystem. | ||
| + | * tar.log -- A log of all the files copied from the disk image into '' | ||
| + | * zero-size.log -- A log of all the files in '' | ||