In this section
LX1.7 Disk Imaging and Verification
Disk Imaging: Capturing the Complete Filesystem State
When You Need a Disk Image
A disk image captures the complete state of the filesystem — every file (including deleted files whose data blocks have not been overwritten), every directory, every inode, the journal, the superblock, and the unallocated space. Live response and UAC triage collect specific artifacts; a disk image captures everything. You need a disk image when:
The investigation requires deleted file recovery — files the attacker deleted from the filesystem may have their data blocks intact in unallocated space. The UAC triage cannot collect deleted files because they are not visible to userspace commands. A disk image preserves the unallocated space where deleted file data resides, enabling recovery with extundelete, photorec, and Sleuth Kit.
# Identify block devices and partitions
lsblk -f
# Example output:
# NAME FSTYPE MOUNTPOINT
# sda
# ├─sda1 ext4 /boot
# ├─sda2 crypto_LUKS
# │ └─sda2_crypt LVM2_member
# │ ├─vg0-root ext4 /
# │ ├─vg0-swap swap [SWAP]
# │ └─vg0-home ext4 /home
# └─sda3
# For a full disk image (captures everything including partition table):
# Target: /dev/sda
# For individual partition/LV images:
# Target: /dev/mapper/vg0-root (root filesystem)
# Target: /dev/mapper/vg0-home (home directories)
# Target: /dev/sda1 (boot partition)# Full disk image — local output
sudo dc3dd if=/dev/sda \
hash=sha256 \
log=~/cases/IR-2026-0402/disk/acquisition.log \
of=~/cases/IR-2026-0402/disk/bastion-nge01-sda.raw
# Full disk image — remote output (pipe over SSH)
sudo dc3dd if=/dev/sda hash=sha256 \
log=/tmp/acquisition.log | \
ssh forensics@workstation \
"dc3dd of=/cases/IR-2026-0402/disk/bastion-nge01-sda.raw hash=sha256 log=/cases/IR-2026-0402/disk/acquisition-recv.log"
# Split image (for large disks, media size limits)
sudo dc3dd if=/dev/sda \
hash=sha256 \
log=~/cases/IR-2026-0402/disk/acquisition.log \
ofs=~/cases/IR-2026-0402/disk/bastion-nge01-sda.raw \
ofsz=4G
# Individual logical volume
sudo dc3dd if=/dev/mapper/vg0-root \
hash=sha256 \
log=~/cases/IR-2026-0402/disk/acquisition-root.log \
of=~/cases/IR-2026-0402/disk/bastion-nge01-root.raw# AWS — create volume from snapshot, attach to forensic VM
aws ec2 create-volume \
--snapshot-id snap-0abc123 \
--availability-zone eu-west-2a \
--volume-type gp3 \
--tag-specifications "ResourceType=volume,Tags=[{Key=Case,Value=IR-2026-0402}]"
# Attach to forensic VM
aws ec2 attach-volume \
--volume-id vol-0xyz789 \
--instance-id i-forensicvm \
--device /dev/xvdf
# On the forensic VM — mount read-only
sudo mount -o ro,noexec,nosuid /dev/xvdf1 /mnt/evidence# Determine partition offsets in the image
mmls bastion-nge01-sda.raw
# Output shows partition start sectors
# Mount a specific partition (e.g., root at sector 2048, 512-byte sectors)
sudo mount -o ro,noexec,nosuid,loop,offset=$((2048*512)) \
bastion-nge01-sda.raw /mnt/evidence
# For LVM-based images — set up loop device first
sudo losetup -rP /dev/loop0 bastion-nge01-sda.raw
sudo vgchange -ay
# The logical volumes appear as /dev/mapper/vg0-root etc.
sudo mount -o ro,noexec,nosuid /dev/mapper/vg0-root /mnt/evidence
# When done — clean up
sudo umount /mnt/evidence
sudo vgchange -an vg0
sudo losetup -d /dev/loop0Myth: "A disk image of a live system is just as good as a disk image from a powered-off system."
Reality: A live disk image is acquired while the system continues writing — files may be in an inconsistent state because they were being modified during acquisition. The journal may contain transactions that were in progress. The filesystem metadata may not match the file contents for recently modified files. A powered-off disk image captures a consistent state. For most investigations, a live image is sufficient. For legal proceedings where the defense may challenge evidence integrity, a powered-off image is stronger — but it requires taking the system offline and loses all volatile evidence.
Try it yourself
Create a small test disk image on your forensic workstation.
Create a small test disk image on your forensic workstation. Create a 1GB virtual disk: dd if=/dev/zero of=/tmp/test-disk.raw bs=1M count=1024. Format it: mkfs.ext4 /tmp/test-disk.raw. Mount it, create some test files, unmount it. Then image it with dc3dd: dc3dd if=/tmp/test-disk.raw hash=sha256 of=/tmp/test-disk-image.raw log=/tmp/acquisition.log. Verify the hash: compare the hash in the log with sha256sum /tmp/test-disk-image.raw. Mount the image read-only and verify the test files are present: sudo mount -o ro,loop /tmp/test-disk-image.raw /mnt/test && ls /mnt/test.
Beyond This Investigation
Disk images are the evidence source for LX2 (Filesystem Forensics) — inode analysis, deleted file recovery, and timeline generation all work against disk images or cloud snapshots. The imaging techniques in this subsection produce the raw material that LX2's analysis tools consume.
Check your understanding:
1. The target server uses LUKS full disk encryption. The system is powered off. What do you need before you can acquire a forensically useful disk image? 2. Why is a cloud disk snapshot actually better evidence integrity than a live dc3dd image of the running VM? 3. What mount options should you use when mounting a disk image for analysis, and what does each option prevent? 4. The acquisition log shows dc3dd transferred 500GB but the hash does not match when you verify the image on your workstation. What are the possible causes?
You are investigating a Linux server and discover evidence of both a cryptominer (resource abuse) and an SSH key theft (lateral movement preparation). The cryptominer is consuming 95% CPU and impacting production. Which do you address first?
Address the lateral movement first. The cryptominer is visible, noisy, and contained to this server — it is causing performance impact but not spreading. The SSH key theft is silent, potentially already exploited, and may have given the attacker access to additional servers. Contain the lateral movement risk: rotate the stolen SSH keys, check the target servers for unauthorized access, and apply network restrictions. Then address the cryptominer: kill the process, remove the binary and persistence mechanisms. Prioritizing the noisy but contained threat over the silent but spreading threat is the most common Linux IR prioritization mistake.
Get weekly detection and investigation techniques
KQL queries, detection rules, and investigation methods — the same depth as this course, delivered every Tuesday.
No spam. Unsubscribe anytime. ~2,000 security practitioners.