86

I am using the following command to create a bootable SD Card

sudo dd bs=4m if=en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso of=/dev/disk2

Is there a way to track the progress?

1

7 Answers 7

135

The same information, displayed every second by in klanomath's answer, can displayed using your command. You just need to enter a controlT character from the keyboard while the dd command is executing.

By pressing the controlT character, you are sending the same SIGINFO signal to the dd command that the command pkill -INFO -x dd sends.

3
  • 1
    Worked like a charm! So much easier (and less hair-raising) than the other methods
    – derrylwc
    Dec 5, 2020 at 23:43
  • wow!!!! that's great!
    – Michael A.
    Mar 23, 2022 at 13:01
  • in a separate terminal: while true; do pkill -INFO -x dd; done
    – reukiodo
    Aug 11 at 4:38
58

As of coreutils 8.24, dd added a status options. Install coreutils with Homebrew to update dd.

brew install coreutils
# All commands have been installed with the prefix 'g'
sudo gdd if=XXXX.iso of=/dev/diskX bs=1 status=progress 

> example:
> 139648967 bytes (140 MB, 133 MiB) copied, 304 s, 459 kB/s    
4
  • 3
    Didn't know about coreutils, very handy. Jan 20, 2017 at 1:34
  • 1
    Although this works, you nullify the speed increase of using the Raw Disk
    – eyoung100
    Jun 13, 2018 at 2:22
  • 3
    You can still use raw disk as follows: sudo gdd if=XXXX.iso of=/dev/rdiskX bs=1M and check progress via CTRL + T
    – Elad Nava
    Apr 29, 2020 at 21:41
  • @eyoung100: How? If I point my if... and/or of... options directly at the raw version/s, does coreutils' dd ignore this and use the buffered version/s anyway? This seems completely nonsensical to me, which makes me question the source of your beliefs (especially since your link is now dead).
    – Kenny83
    Dec 30, 2021 at 8:28
22

You can press Control + t while the dd command is running or for a nice progress bar you can install pv (pipe viewer) via Homebrew:

brew install pv

and then execute:

sudo dd if=disk-image.img | pv | sudo dd of=/dev/disk2

or (knowing size of the image, 16GB in this example):

dd if=disk-image.img | pv -s 16G | dd of=/dev/disk2


Example output 2:

(data transferred, elapsed time, speed, progress bar and estimated time):

    1.61GiB 0:12:19 [2.82MiB/s] [===>                 ] 10% ETA 1:50:25
1
  • 1
    The best answer is the one without added dependencies.
    – Sandwich
    May 31 at 14:58
13

dd itself doesn't provide a progress bar. You may estimate the progress of the dd copy process by adding a pkill -INFO command though.

Example:

dd if=/dev/zero of=/dev/null bs=64m count=1000 & while pkill -INFO -x dd; do sleep 1; done

Result:

[1] 37691
0+0 records in
0+0 records out
0 bytes transferred in 0.028923 secs (0 bytes/sec)
275+0 records in
275+0 records out
18454937600 bytes transferred in 1.029698 secs (17922667819 bytes/sec)
553+0 records in
553+0 records out
37111201792 bytes transferred in 2.048291 secs (18118129881 bytes/sec)
829+0 records in
829+0 records out
55633248256 bytes transferred in 3.068911 secs (18128009214 bytes/sec)
1000+0 records in
1000+0 records out
67108864000 bytes transferred in 3.720346 secs (18038339571 bytes/sec)
[1]+  Done                    dd if=/dev/zero of=/dev/null bs=64m count=1000

Which translates to a whopping 18.1 GB/s.

4
  • What are the hardware specs of the machine you ran that command on? Apr 8, 2016 at 5:12
  • @user3439894 3.5 GHz i7 iMac. Why?
    – klanomath
    Apr 8, 2016 at 5:24
  • Was just curious because of the bytes/sec output, which by the way is actually 16.8 GB/s (rounded-up) as those are base 2, not base 10 calculations. Apr 8, 2016 at 5:56
  • @user3439894 the very high speed in this example is because dd copies between the zero and null devices. The speed measures how fast the kernel can generate zeros and then throw them away. When used to zero a drive this'll obviously be bottlenecked by the drive's write performance.
    – Adam
    Apr 15, 2022 at 2:13
8

First of all, install Homebrew Package Manager. Then you have to install pv and dialog with this command:

brew install pv dialog

You can then run this command to get a progress bar with the command:

dd if=disk.img bs=1m | pv disk.img | dd of=/dev/diskX bs=1m

but make sure to replace disk.img with the path to the image and diskX with your SD card's disk identifier. If you want something more graphical, you can try this:

(dd if=disk.img bs=1m | pv -n disk.img | dd of=/dev/diskX bs=1m conv=notrunc,noerror) 2>&1 | dialog --gauge "Writing image to SD card..." 10 70 0

Source: https://askubuntu.com/a/516724/765767

4

That is easy! For macOS High Sierra and below, just run a while loop and it will run until it is finished. Just make sure to do the code below in another window:

The code below will work out of box while in a firmware boot or within the full blown OS

while kill -0 $PID; do
    caffeinate -t 10 
    kill -INFO $PID
    echo "still copying file" "$(date)"
done

^ To keep the machine awake (caffeinate) without the use of “homebrew” or tools not available in standard Mac OS X since homebrew requires internet and an actual OS to install it on.

NOTE: The above needs you to substitute the PID with your process ID and it will constantly show the progress

1
  • To find the actual PID run command: pgrep -l '^dd$' Apr 16, 2022 at 17:09
3

progress can track progress of data transfer processes. Install with

brew install progress

Then launch dd, get its PID with

ps aux | grep "dd"

and use the tool to track progress

sudo progress -mp 95413
4
  • Does this work with the standard dd on macOS or only with the GNU coreutils version?
    – nohillside
    Dec 4, 2020 at 14:47
  • It works with standard dd, I didn’t install GNU coreutils.
    – MickGe
    Dec 4, 2020 at 14:57
  • Super thanks, It worked like a charm
    – enpith
    Jun 4, 2021 at 3:11
  • @enpi Glad to help you!!!
    – MickGe
    Jun 12, 2021 at 6:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .