User Tools

Site Tools


data_recovery

This is an old revision of the document!


Disk Information

Handy commands:

  • lsblk – Lists all attached drives, including partitions
    Ex:
    lsblk
  • udevadm – Gives detailed information about a drive
    Ex:
    udevadm info --query=all --name=/dev/sd<X> | grep ID_SERIAL_SHORT

Disk Testing

Handy Commands:

  • Checking a drive's SMART attributes:
    • GUI:
    1. Install gnome-disk-utility (If not already installed)
      apt-get install gnome-disk-utility
    2. Run:
      gnome-disks
    3. Select your drive and then select the menu button in the top-right corner:

    • Command Line:
      1. Install smartmontools
        apt-get install smartmontools
      2. Overall health report:
        smartctl -H /dev/sd<X>
      3. Detailed SMART information:
        smartctl -i /dev/sd<X>
  • Running SMART tests (non-destructive to data)
    • GUI:
      gnome-disks


      Open “SMART Data & Self-Tests”, click “Start Self-Test”, and select a test to run.

    • Command Line:
      smartctl --test=short /dev/sd<X>


      smartctl --test=long /dev/sd<X>
  • Thoroughly Testing Drive Media (CAUTION: DESTRUCTIVE TO DATA)
    badblocks -vws /dev/sd<X>

Data Recovery

If the hardware is suspect, then the first thing to do is get a byte-for-byte copy of the drive's contents into a disk image file. The less time spent using possibly faulty hardware the better.

ddrescue -A -f /dev/sd<X> broken.img

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.

cp broken.img work.img

Use testdisk to search for and repair disk partitions.

testdisk work.img

Using testdisk involves using the arrow, escape, and enter keys.

  1. Confirm that you want to use the disk image work.img, click “Proceed”

  2. Select the disk image partition table type. Ex: Intel

  3. Click: Analyse

  4. Click: Quick Search

  5. Click: Enter to continue

  6. Click: Deeper Search

  7. Click: Enter to continue

  8. Click: Write

  9. Click: Y

  10. Click: OK (You do not need to reboot)

  11. Click: Quit

  12. Click: Quit

data_recovery.1534953919.txt.gz · Last modified: 2018/08/22 16:05 by peek