2

I'm using dd to overwrite my hard drive with zeros (before I recycle my laptop).

Several minutes into running, the visual display was replaced with a black background and a flashing cursor in the top left of the screen.

No text is being written to the screen, so it's not clear to me whether dd is still running or how to tell when it stops.

sebasth
  • 14,872
abcd
  • 143
  • 7

2 Answers2

4

When dd has written the device full it will output a message:

dd: writing to '/dev/full': No space left on device

Sending USR1 signal to running dd process makes it output the current status. You can use kill to send the signal:

kill -USR1 $PID

More recent versions of GNU dd have an option status=progress which will show the current progress on terminal.

Wiping disk is likely faster with cat /dev/zero > /dev/sdX instead of dd when dd parameters aren't tuned:

cat /dev/zero > /dev/sdX

You can get a progress bar if you have pv installed:

pv /dev/zero > /dev/sdX
sebasth
  • 14,872
  • i mean literally there is nothing there but a single black screen with a flashing cursor. i'm not in a terminal window. i have no access to any programs, no ability to open a new terminal. – abcd Aug 31 '17 at 21:10
  • does this mean something has gone wrong? – abcd Aug 31 '17 at 21:10
  • 1
    Are you running dd from the disk your system installation is on? – sebasth Aug 31 '17 at 21:11
  • yeah, it's the only disk on my laptop. i'm trying to wipe the whole laptop. maybe this was a dumb way to do it -- i dunno, i'm not experienced in this. – abcd Aug 31 '17 at 21:11
  • 2
    You should have used live-cd/usb etc. instead. Kernel likely doesn't like the file system vanishing under it while in use. Its still likely a good idea to boot from live (usb/cd) media and run the wipe from there. – sebasth Aug 31 '17 at 21:14
  • cat is not faster. – user2497 Aug 31 '17 at 21:47
  • @user2497 reworded the sentence. Without tuning dd parameters, I've observed cat being always faster than dd. Default block size (bs) for dd is 512, increasing it has a significant impact. Related: https://unix.stackexchange.com/questions/322223/why-dd-takes-too-long – sebasth Aug 31 '17 at 21:53
0

How can I tell whether dd is done erasing my hard drive?

You can use the dcfldd tool

dcfldd - enhanced version of dd for forensics and security

dcfldd features

dcfldd was initially developed at Department of Defense Computer Forensics Lab (DCFL). This tool is based on the dd program with the following additional features:

  • Hashing on-the-fly: dcfldd can hash the input data as it is being transferred, helping to ensure data integrity.
    • Status output: dcfldd can update the user of its progress in terms of the amount of data transferred and how much longer operation will take.
    • Flexible disk wipes: dcfldd can be used to wipe disks quickly and with a known pattern if desired.
    • Image/wipe verify: dcfldd can verify that a target drive is a bit-for-bit match of the specified input file or pattern.
    • Multiple outputs: dcfldd can output to multiple files or disks at the same time.
    • Split output: dcfldd can split output to multiple files with more configurability than the split command.
    • Piped output and logs: dcfldd can send all its log data and output to commands as well as files natively.
GAD3R
  • 66,769