Ohhh! Mammy! Where is all files I wrote this week?!?! Or: another way how to extract deleted data from big HDD.

Huh, hate to code without VCS support. Just recover several hundreds of code from 0.5T on which system currently run.

How to do that? undelete? unrm? All that is too much complicated ways for me :) so I need another way.

  • Which?
  • Simple!

Simple script: #!/bin/sh

500GB HDD, 488386584K

MAX=$((488386584 / 1024))

i=0 while true; do dd if=/dev/ad7 bs=1m count=1 skip=${i} 2> /dev/null |
tee ./blk.${i} |
echo “BLK ${i} match” || rm ./blk.${i}; i=$(( ${i} + 1 )); if [ $(( ${i} % 0x400 )) -eq 0 ]; then if [ $(( ${i} % 0x4000 )) -eq 0 ]; then echo ; echo “H{${i}}”; else echo -n “.”; fi fi if [ ${i} -ge ${MAX} ]; then exit 0; fi done Replace LONG_KEY_TO_SEARCH with some unique string, but remember: 1. less long and unique - more false matches; 2. more long - more time to grep; And dot forget to replace MAX with your HDD/partition size. Good luck!

Oleksandr Rybalko a.k.a. Ray
Oleksandr Rybalko a.k.a. Ray
SRE/DevOps/Engineer SW/HW

The man who love HW and SW. And know!