38

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?

53

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.

23

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    
  • 2
    Didn't know about coreutils, very handy. – SteveLambert 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
8

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.

  • What are the hardware specs of the machine you ran that command on? – user3439894 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. – user3439894 Apr 8 '16 at 5:56
4

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

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
2

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

  • I also found away to keep the machine awake so that you dont come back to it sleeping and have to constantly wake it up. – Don-Pierre Halfaway Jun 27 '18 at 23:54
  • The above script tells you the date, give you the statis of it copying and keeps it awake every 10 seconds – Don-Pierre Halfaway Jun 27 '18 at 23:56
  • It is best used for terminal on Mac when you are not in the full blow operating system. But within Firmaware/bios. Definitely a solution to remember – Don-Pierre Halfaway Jun 27 '18 at 23:57
  • What‘s the purpose of the $(...)? I know what they do in general, I just wonder why you are using them here? – nohillside Jul 7 '18 at 7:08
  • to escape spaces and cause the command to run all within one line. I am sure I could of doubled the "(" and ")" but I wanted people to see the options available in a layman approach – Don-Pierre Halfaway Jul 24 '18 at 5:53

You must log in to answer this question.

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