show status rate of dd command

Sarath Pillai's picture

Hi all..People involved in linux, might be familier with the dd command, which is very powerful and helpful at times.

With the dd command, you can do the following things.

  1. take exact copy/backup of a harddrive
  2. take backup of MBR
  3. make partition copy
  4. dump junk data to make a file with required size
  5. Make iso files from dvd/cd
  6. backup flopy disk

and much more.

The main problem with dd command is it does not show the status of the command when its running. It shows the details only when the command has finished executing.

Now imagine a situation where you want to know the speed of read write when you are backing up the whole hard disk.

dd if=/dev/sda of=/home/sarath/hardisk.img

in the above case, the command is going to take a very long time to complete(depends on the size of the disk).

this command will make the exact copy of the hard drive,block by block.

in that case we can look at the status,read speed,write and all by the following method.

open another terminal when the above command is running. The first thing we need to do is identify the PID of the dd command process.which can be done by the following method.

pgrep -l "^dd"

or 

lsof -c "dd"

the output of the above command will be the pids,of the process that started with dd in command.

Now there is one kill signal called USR1 which is reserved for the developers to specify what the effect of the signal will be.

In other words, USR1 is one of the kill signal reserved for developers. And developers can define what will be the effect of this signal on a process.

DD command responds to this signal by showing the stats of the process.

Now we just need to do the following to get the stats.

Kill -USR1 <PID>

Thank You all!!!

Rate this article: 
Average: 3.5 (2202 votes)

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.