Linux dd Command Show Progress Copy Bar With Status

I am using dd command for block level copy and just found out that there’s no built in way to check the progress. How do I use the Linux or Unix dd command while coping /dev/sda to /deb/sdb and display a progress bar when data goes through a pipe? How do I monitor the progress of dd on Linux?

dd is a free and open source command-line tool for Linux, and Unix-like operating systems. It is mainly used to convert and copy files. Being a program mainly designed as a filter dd usually does not provide any progress indication. This page shows how to show progress copy bar on Linux operating system.

ADVERTISEMENTS

Linux dd Command Show Progress Copy Bar With Status

You need to use gnu dd command from coreutils version 8.24 or above to use the following option. The syntax is as follows to show progress copy bar with dd command:
dd if=/path/to/input of=/path/to/output status=progress
Let us pass the progress option to see periodic transfer statistics using GNU dd command:
# dd if=/dev/sda of=/dev/sdb bs=1024k status=progress

Linux monitor the progress of dd command

Gif.01: Linux monitor the progress of dd command

No need to use sudo. I used sudo because I was trying to read and clone a USB stick.

How do you monitor the progress of dd?

Here is another example. First, find out your USB device name using the grep command and hwinfo command:
grep -Ff <(hwinfo --disk --short) <(hwinfo --usb --short)
Sample outputs:

disk:
  /dev/sdc             SanDisk Ultra

Next, unmount the device under Linux:
sudo umount /dev/sdc
Finally, write an iso image to USB device named /dev/sdc and monitor the progress of dd:
sudo dd if=openSUSE-Leap-15.1-DVD-x86_64.iso of=/dev/sdc bs=4M status=progress
Sample outputs:

2684354560 bytes (2.7 GB, 2.5 GiB) copied, 1 s, 2.7 GB/s    
967+1 records in
967+1 records out
4056940544 bytes (4.1 GB, 3.8 GiB) copied, 361.614 s, 11.2 MB/s

Use pv command monitor the progress of dd command and see status

Another option is to use pv command which allows you to see the progress of data through a pipeline. You need to install pv command as described here.

Tutorial details
DifficultyIntermediate (rss)
Root privilegesYes
Requirementsdd and pv
TimeN/A
Once installed, type the following commands to see the status bar. Please note that if standard input is not a file and no size was given with the -s option, the progress bar cannot indicate how close to completion the transfer is, so it will just move left and right to indicate that data is moving. It will also show average MB/s rate:

WARNING! These examples may crash your computer and may result into data loss if not executed with care.

Copy /dev/sda to to /dev/sdb:
pv -tpreb /dev/sda | dd of=/dev/sdb bs=64M
OR
pv -tpreb /dev/sda | dd of=/dev/sdb bs=4096 conv=notrunc,noerror
Sample outputs:

Fig.01: pv and dd in action

Fig.01: pv and dd in action

You can create a progress bar and display using the dialog command as follows:

(pv -n /dev/sda | dd of=/dev/sdb bs=128M conv=notrunc,noerror) 2&gt;&amp;1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0

Sample outputs:

HowTo: Check The Status of dd Command In Progress under Unix like operating systems

Fig.02: Show the Status of dd Command in progress using pv and dialog command

Examples: Use gnu dd command from coreutils version 8.24 or above only

Here is another example from my Mac OS X/MacOS:
$ sudo gdd if=ZeroShell-3.6.0-USB.img of=/dev/disk5 bs=1024k status=progress
Sample outputs:

Fig.03: GNU dd displaying progress

Fig.03: GNU dd displaying progress

How do you monitor the progress of dd on Linux?

If you are using an older version of dd or cannot install the pv command, try the following simple one-liner bash shell while loop/command:

## 1. first start dd as usual ##
sudo dd if=/dev/sdc of=/tmp/demo.img bs=4M
 
## 2. Open another terminal or tab ##
## 3. find pid of dd command ##
pidof dd              ### &lt;--- say pid is 21145
ps aux | grep -w dd
 
## 4. Run bash/sh while loop as follows ##
while sudo kill -USR1 21145 ; do sleep 10 ; done
 
## 5. Switch back to terminal where dd was started ##

Sample outputs:
Linux dd Command Show Progress Copy Bar With Status

Conclusion

The dd command is wonderful, and there are various ways to display a progress indicator with dd. You learned how to monitor the progress of dd using the inbuilt status=progress option to the dd command. Another option is to use the pv tool. Finally, you learned that how to show dd progress in Linux without using pv or status= progress option. See GNU dd man page here for more info.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
12 comments… add one
  • Logicos Oct 20, 2012 @ 20:21

    $ tmux
    $ dd if=/dev/urandom of=/dev/null bs=16k count=100000
    +

    $ ps aux | grep dd
    (show pid)

    $ kill -SIGUSR1 (pid)

    $ tmux attach
    65260+0 enregistrements lus
    65259+0 enregistrements écrits
    267300864 octets (267 MB) copiés, 16,5587 s, 16,1 MB/s

  • Goofball James Hurley Oct 21, 2012 @ 0:00

    OR you could use dcfldd, if your distro/OS has it (Debian does). The awkward acronym stems from it being the Department of Defense Computer Forensics Lab’s version of dd.

  • Billy Larlad Oct 21, 2012 @ 0:02

    or try dcfldd, the Department of Defense Computer Forensics Lab’s dd.

  • mirodeniro Oct 22, 2012 @ 7:11

    killall -USR1 dd

  • Gaspar Fernandez Feb 10, 2013 @ 9:32

    And to make it beautiful, instead of running dialog, you can run zenity –progress –title “Working…”.

  • Tom Feb 20, 2013 @ 3:12

    watch -n 10 ‘killall -USR1 dd’

  • mioux Feb 2, 2014 @ 17:37

    I use this command to create my Raspberry Pi compressed images
    (pv -n /dev/sda | gzip -c | dd of=GentooV2.gz bs=128M conv=notrunc,noerror) 2>&1 | dialog –gauge “Dump running” 10 70 0

    It’s better looking than kill -USR1

  • Julian Jun 28, 2014 @ 8:19

    It may look nicer than kill -USR1 but it’s more complicated to set up. And just hitting up then enter in a second terminal after doing it once is much easier.

    • Julian Jun 28, 2014 @ 8:20

      *not much easier. Just simple. Typo. The point is you can just check up on it rather than having another process always polling the dd process (dd actually does stop to report the progress).

  • Rob Nov 5, 2014 @ 23:56

    You wrote:
    Copy /dev/sda to to /deb/sdb:

    Surely you meant Copy /dev/sda to to /dev/sdb:

    That’s dev, not deb. Please correct this, and try to heed your own warning about executing with care.

  • R Dec 30, 2015 @ 16:49

    New version of coreutils (8.24) adding a status progress to dd tool:

    Usage on Xubuntu 15.10:

    Open terminal shell and type these commands:

    wget ftp://ftp.gnu.org/pub/gnu/coreutils/coreutils-8.24.tar.xz
    tar -xf coreutils-8.24.tar.xz
    cd coreutils-8.24
    ./configure && make -j $(nproc)

    Run dd as root:

    sudo ./dd if=/dev/sdc of=/dev/sda conv=noerror status=progress

    You will see: Bytes, Seconds and Velocity (Bytes/seconds)

    To check versions of dd:

    Native:

    dd --version

    New (cd coreutils-8.24/src):

    ./dd --version
  • Raymond Day Nov 29, 2017 @ 15:34

    It be nice to have something that says what the numbers mean wile copying. I am copying a 6TB to a 6TB and it’s been over a day and I guess it only about 4th way because it shows like this:

    dd if=/dev/sdc1 of=/dev/sdh1 bs=64k conv=noerror,sync status=progress
    2211815555072 bytes (2.2 TB, 2.0 TiB) copied, 93833 s, 23.6 MB/s

    So I guess the 2.2TB means it copy that much so fair and maybe the 2.0 TiB is how much it has to go? Not sure. Been looking to find this answer and have not found it yet.

    -Raymond Day

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.