UnixDroid

Lesson 3 of 8 · 8 min

Disk imaging & chain of custody

Make a bit-for-bit copy of a disk, prove it's identical with a hash, and record who touched the evidence.

You never investigate the original disk. You make a perfect bit-for-bit copy, called a forensic image, and analyse that instead. Then you prove the copy is identical, and you record who touched the evidence at every step.

Image vs normal copy

Drag-and-drop only copies the files you can see. A forensic image copies every sector: deleted files, unallocated space, slack space, partition tables, everything.

Normal copyForensic image
Visible files onlyEvery sector of the disk
Can change timestampsPreserves the original exactly
No proof it's identicalVerified with a hash

Step 1: Protect the original with a write blocker

A write blocker sits between the suspect disk and your machine. It lets data be read but never written. Hardware write blockers are the standard in real cases. For practice on Linux, you can at least set the device to read-only:

lsblk                            # find the suspect disk, e.g. /dev/sdb
sudo blockdev --setro /dev/sdb   # mark it read-only
sudo blockdev --getro /dev/sdb   # 1 = read-only

Tip: Software write-blocking is fine for practice. In a real case, use a hardware write blocker. It's much harder to argue against in court.

Step 2: Hash the original

A hash is a fingerprint of the data. Change a single bit and the hash changes completely.

sudo sha256sum /dev/sdb | tee original.sha256

Step 3: Create the image

sudo dd if=/dev/sdb of=/mnt/evidence/case01.img bs=4M conv=noerror,sync status=progress
  • if is the input (the suspect disk) and of is the output (an image file on a separate evidence drive).
  • conv=noerror,sync keeps going past bad sectors and pads them, so the rest of the image stays aligned.
  • dc3dd and dcfldd are forensic versions of dd that calculate the hash while they copy.

On Windows, the free FTK Imager does the same job with a GUI. It can save in the E01 format, which stores case notes and hashes inside the image.

Step 4: Verify the image

sha256sum /mnt/evidence/case01.img

If this hash matches original.sha256, you have mathematical proof that your copy is identical. Write both hashes in your notes.

Chain of custody

The chain of custody is a written record of everyone who handled the evidence, from the moment it was collected until the case closes. If there's a gap, someone can argue the evidence was tampered with.

A basic chain-of-custody log records:

FieldExample
Item IDCASE01-HDD-01
Description1 TB HDD, serial ZN1234AB
Collected by and whenR. Mehta, 2026-11-22 10:15 UTC
SHA-256 hashThe full hash of the original
Every transferFrom, to, date, time, reason, signature
StorageLocked evidence cabinet, room 2

An image with a matching hash and a clean chain of custody is evidence. Without them, it's just a copy of someone's disk.

Try it yourself
  1. Create a practice "suspect disk": dd if=/dev/zero of=suspect.img bs=1M count=50 and then mkfs.ext4 suspect.img
  2. Hash it: sha256sum suspect.img > original.sha256
  3. Image it: dd if=suspect.img of=case01.img bs=4M status=progress
  4. Run sha256sum case01.img and compare it with original.sha256. Do they match?
  5. Fill in a chain-of-custody table for suspect.img with every field from this lesson.
No Linux machine? Practise in the free online terminal

Quick check

What do you compare to prove a forensic image is identical to the original?

Need a hint?

SHA-256 produces one.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →