70

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
106

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.

1
  • 1
    Worked like a charm! So much easier (and less hair-raising) than the other methods
    – derrylwc
    Dec 5 '20 at 23:43
50

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    
3
  • 3
    Didn't know about coreutils, very handy. Jan 20 '17 at 1:34
  • 1
    Although this works, you nullify the speed increase of using the Raw Disk
    – eyoung100
    Jun 13 '18 at 2:22
  • 1
    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 '20 at 21:41
14

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
11

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.

3
  • What are the hardware specs of the machine you ran that command on? Apr 8 '16 at 5:12
  • @user3439894 3.5 GHz i7 iMac. Why?
    – klanomath
    Apr 8 '16 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 '16 at 5:56
9

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

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 '20 at 14:47
  • It works with standard dd, I didn’t install GNU coreutils.
    – MickGe
    Dec 4 '20 at 14:57
  • Super thanks, It worked like a charm
    – enpi_
    Jun 4 at 3:11
  • @enpi Glad to help you!!!
    – MickGe
    Jun 12 at 6:21
3

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

0

You must log in to answer this question.

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