Skip to content

Instantly share code, notes, and snippets.

@coolacid
Created January 4, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolacid/5755ee502ccb7427fe65dd5ee3d8d99c to your computer and use it in GitHub Desktop.
Save coolacid/5755ee502ccb7427fe65dd5ee3d8d99c to your computer and use it in GitHub Desktop.
Non-Forensic backup of an HDD

Expectation of you doing this on a linux box.

First, mount the drive, clean any non-required files that you don't want (Swap/Hibernate etc).

Next: Write zero's to the free space, this makes the compression better:

cd [drive root]
dd if=/dev/zero of=zero
rm zero

Unmount the drive, and move to a directory where you want to store the image

(https://unix.stackexchange.com/questions/31669/is-it-possible-to-mount-a-gzip-compressed-dd-image-on-the-fly/75590#75590)

mkdir empty-dir
mksquashfs empty-dir squash.img -p 'sda_backup.img f 444 root root sudo dd if=/dev/sda bs=4M'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment