Module 2 · Risk Management · Lesson 17 of 42
Lab: wiping a disk partition with dd
Hands-on: create, format and mount a partition in Linux, add files, then overwrite it with random data using dd and prove the data is gone.
In this lesson · about 20 minutes
- List disks and partitions with fdisk -l
- Create a partition, an ext4 file system and a mount point
- Overwrite a partition with random data using dd
- Unmount a file system and recognise the 'target is busy' error
Wiping media you no longer need is part of most security policies. Linux has a built-in tool that can do it: dd, which copies raw data from an input (if=) to an output (of=). Point the input at /dev/urandom (an endless stream of random bytes) and the output at a partition, and every byte of that partition is overwritten.
In this lab you'll build a test partition on a spare 5 GB disk (/dev/sdb) in Kali Linux, put files on it, wipe it, and prove the data is gone. Linux names disks sda, sdb, sdc in order, and partitions get a number: sdb1 is the first partition on the second disk.
Hands-on lab (simulated terminal)
Wipe /dev/sdb1 with dd
You're logged in to Kali as the kali user. Commands that change disks need sudo, and the first time you use it, sudo asks for your password: on the default Kali image it's kali. Like a real terminal, nothing appears while you type it.
Step 1 of 14. Type each command and press Enter. Nothing runs on your computer.
1. List all disks and partitions so you can identify the spare disk.
Check your understanding0 of 5 correct
Quiz score: 0 of 5
Noviq Academy is free and for learning. This course is independent and is not affiliated with or endorsed by CompTIA. CompTIA and Security+ are trademarks of CompTIA, Inc. Exam details such as price and policies change; confirm them on CompTIA's website before you book.