Advertisement
xe1phix

Xe1phix-[Foremost]+[ddrescue]+[gddrescue]-Cheatsheet-[v4.5.24].sh

Oct 7th, 2022
1,131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.07 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4. ##-=========================================-##
  5. ##   [+] Recover all known file types.
  6. ##-=========================================-##
  7. foremost -t all -i /$Dir/$File -o /$Dir/
  8.  
  9.  
  10. ##-====================================================================-##
  11. ##   [+] Clone a partition from physical disk /dev/sda, partition 1
  12. ##       to physical disk /dev/sdb, partition 1 with e2image
  13. ##-========================================================================-##
  14. e2image -ra -p /dev/sda1 /dev/sdb1
  15.  
  16.  
  17. ##-============================================================-##
  18. ##   [+] Clone a faulty or dying drive, run ddrescue twice.
  19. ##   [?] First round, copy every block without read error
  20. ##   [?] log the errors to $File.log.
  21. ##-============================================================-##
  22. ddrescue -f -n /dev/sda /dev/sdb $File.log
  23.  
  24.  
  25. ##-=======================================================-##
  26. ##   [+] Copy only the bad blocks and try 3 times
  27. ##       to read from the source before giving up.
  28. ##-=======================================================-##
  29. ddrescue -d -f -r3 /dev/sdX /dev/sdb $File.log
  30.  
  31.  
  32. ##-====================================================-##
  33. ##   [+] dd compression to an image file on the fly:
  34. ##-====================================================-##
  35. dd_rescue /dev/sda1 - | bzip2 > /$Dir/$File.img.bz2
  36.  
  37.  
  38. ##-================================================================-##
  39. ##   [+] List the files and directory names in a raw dd image:
  40. ##-================================================================-##
  41. fls $File.dd -r -f ext3 -i raw
  42.  
  43.  
  44. ##-=======================================================-##
  45. ##   [+] Write files to a specified output directory:
  46. ##-=======================================================-##
  47. foremost -t all -o /$Dir/ -i $File.dd
  48.  
  49.  
  50. ##-========================================================================-##
  51. ##   [+] Pass in one of the backup superblocks as an option to fsck:
  52. ##-========================================================================-##
  53. fsck -b 32768 /dev/sda2
  54.  
  55.  
  56. ##-=============================================================-##
  57. ##   [+] Passing the backup superblock into mount explicitly:
  58. ##-=============================================================-##
  59. mount sb=32768 /dev/sda2 /mnt
  60.  
  61.  
  62. ##-=============================================================-##
  63. ##   [+] Forensic backup of /dev/sda to a raw dd file:
  64. ##-=============================================================-##
  65. dd if=/dev/sda of=/mnt/$Dir/$File.dd
  66.  
  67.  
  68. ##-=====================================================================-##
  69. ##   [+] Forensic acquisition of sda using gddrescue output to raw:
  70. ##-=====================================================================-##
  71. gddrescue -n /dev/sda /mnt/$Dir/$File.raw $File.log
  72.  
  73.  
  74. ##-=======================================================-##
  75. ##   [+] Use ddrescue, skipping the dodgy areas
  76. ##       grab most of the error-free areas quickly
  77. ##-=======================================================-##
  78. gddrescue -n /dev/sda /mnt/$Dir/$File.raw $File.log
  79.  
  80.  
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement