When using the dd command on Linux, it can be frustrating to not see any output. This is especially true in cases where the process can take many hours (which can be quite common with dd).
In this post, we’ll start a dd process, then after the fact, we will monitor its progress with a kill signal.
After double and triple checking we’ve got the right output destination, let’s start wiping the /dev/sdd drive.
By default here, dd will not show any output until it is finished copying data.
In a separate terminal, let’s find the PID or Process ID of the dd command we’ve just run:
We can now issue a USR1 signal to the process with the kill command:
As long as you only have one dd process running on your machine, this can also be combined into one command:
In the terminal with dd running, you’ll now see the current status of dd printed out like so:
The output on the last line here is:
You can run the kill command as often as you like and dd will just append its latest status output each time:
If you you want this output to be constantly updated, one way to do that is to call the kill command with the watch command
In this case, the -n flag to watch calls the kill command every 30 seconds.
Now your output will keep ticking away, every 30 seconds:
The beauty of using kill signals here is that you can check on a dd process at any point, so even if you’ve started a lengthy copy process, you don’t need to stop and restart it just to see the progress, as you would if you were to pipe the data through pv.
Just as a reference for how long this hard drive wiping (zeroing) process takes, this was a 1TB hard drive, connected over USB in a dock, and the whole dd process took 22320.4 seconds. That’s about 6 hours and 12 minutes.
Tags: Linux
Posted on 19 June 2018. blog comments powered by DisqusRecent Posts:
How to monitor the progress of a dd process, even after it has started.
Monitoring frequency drift on the RTL SDR dongle
High entropy passwords are serious business! Here some little helpers to create better ones.
Running Linux and need to look busy quick? Try this little bit of command line fun :)
Bash scripts and command line examples are often littered with ampersands. Here's what they do.