Adding a large buffer will speed things up significantly. The default size is small; like 512 bytes. You increase the size by using the bs option. I'm only using sudo because you did.
sudo dd if=/dev/disk bs=4096m | sudo dd of=/Volumes/Path/To.iso bs=4096m
This scary looking command will ask the dd commands to report back their status. The -s says to signal.
sudo kill -s siginfo $(pgrep ^dd) # get dd info
I did testing with various buffer sizes, the larger the buffer the faster will be the copy. Don't want to get so big a buffer as the buffer needs to be paged.
If I got the syntax above wrong, these are the actual commands that have worked for me. I assume you know that you need to unmount the partition/drive before using dd. For some dd commands, I needed to use sudo.
dd if=/dev/disk0s10 bs=4096m | gzip | dd of=~/disk0-s10 bs=4096m
dd if=~/disk0-s10 bs=4096m | gunzip | dd of=/dev/disk0s10 bs=4096m
sudo kill -s siginfo $(pgrep ^dd) # get dd info
Edit: Jan 18,2019 I did timings using one or two dd commands. It was a toss-up of which form was faster. The time in my test varied typically by 0.3 of a second between the commands. However, in one case the two dd commands were slower by over a second. The difference seemed to be which command was run first. The second test was always faster. I'm guess that the one dd command build a second process to output the data and communicates to the second process via a pipe. This is about the same as using two dd commands.
dd if=InstallESD.dmg bs=801920k of="/Volumes/--Mojave--/mojave2.dmg"
5+1 records in
5+1 records out
4719681368 bytes transferred in 28.887363 secs (163382216 bytes/sec)
Show_Time
date +%s
Elapsed time in seconds since start of processing: 84 Time of this step: 29
dd if=InstallESD.dmg bs=801920k | dd of="/Volumes/--Mojave--/mojave.dmg" bs=801920k
5+1 records in
5+1 records out
4719681368 bytes transferred in 27.383548 secs (172354633 bytes/sec)
0+72017 records in
0+72017 records out
4719681368 bytes transferred in 27.459524 secs (171877757 bytes/sec)
Show_Time
date +%s
Elapsed time in seconds since start of processing: 112 Time of this step: 28
rm "/Volumes/--Mojave--/mojave.dmg"
rm "/Volumes/--Mojave--/mojave2.dmg"
Show_Time
date +%s
Elapsed time in seconds since start of processing: 112 Time of this step: 0
dd if=InstallESD.dmg bs=801920k of="/Volumes/--Mojave--/mojave2.dmg"
5+1 records in
5+1 records out
4719681368 bytes transferred in 26.754509 secs (176406950 bytes/sec)
Show_Time
date +%s
Elapsed time in seconds since start of processing: 139 Time of this step: 27
dd if=InstallESD.dmg bs=801920k | dd of="/Volumes/--Mojave--/mojave.dmg" bs=801920k
5+1 records in
5+1 records out
4719681368 bytes transferred in 26.210222 secs (180070255 bytes/sec)
0+72017 records in
0+72017 records out
4719681368 bytes transferred in 26.286946 secs (179544682 bytes/sec)
Show_Time
date +%s
Elapsed time in seconds since start of processing: 165 Time of this step: 26
... lines at the beginning were trimmed. ...
Here is the bash script I used.
#!/bin/bash -v
function Show_Time () {
let currentRunTime="$( date +%s ) - ${Seconds_since_the_epoch_start}"
let stepRunTime=currentRunTime-previousRunTime
echo " Elapsed time in seconds since start of processing: ${currentRunTime}" \
" Time of this step: ${stepRunTime}"
echo
let previousRunTime=currentRunTime
}
savedCommandName="$0"
echo
echo "${savedCommandName} script last revised on $(GetFileInfo -m $0)"
#echo "${savedCommandName} script revised."
echo
# input file name "/Applications/InstallmacOSHighSierra.app/Contents/SharedSupport/InstallESD.dmg"
inputDir="/Applications/InstallmacOSHighSierra.app/Contents/SharedSupport"
cd ${inputDir}
inputName="InstallESD.dmg"
echo "inputDir is ${inputDir}"
echo "inputName is ${inputName}"
ls -l "${inputDir}/${inputName}"
ls -l "/Volumes/--Mojave--/mojave.dmg"
rm "/Volumes/--Mojave--/mojave.dmg"
ls -l "/Volumes/--Mojave--/mojave.dmg"
ls -l "/Volumes/--Mojave--/mojave2.dmg"
rm "/Volumes/--Mojave--/mojave2.dmg"
ls -l "/Volumes/--Mojave--/mojave2.dmg"
# Set the start time now that the user interaction is done
Seconds_since_the_epoch_start=$( date +%s )
# 80meg buffer
Show_Time
dd if=InstallESD.dmg bs=801920k of="/Volumes/--Mojave--/mojave2.dmg"
Show_Time
dd if=InstallESD.dmg bs=801920k | dd of="/Volumes/--Mojave--/mojave.dmg" bs=801920k
Show_Time
rm "/Volumes/--Mojave--/mojave.dmg"
rm "/Volumes/--Mojave--/mojave2.dmg"
Show_Time
dd if=InstallESD.dmg bs=801920k of="/Volumes/--Mojave--/mojave2.dmg"
Show_Time
dd if=InstallESD.dmg bs=801920k | dd of="/Volumes/--Mojave--/mojave.dmg" bs=801920k
Show_Time
rm "/Volumes/--Mojave--/mojave.dmg"
rm "/Volumes/--Mojave--/mojave2.dmg"
Show_Time
dd if=InstallESD.dmg bs=801920k of="/Volumes/--Mojave--/mojave2.dmg"
Show_Time
dd if=InstallESD.dmg bs=801920k | dd of="/Volumes/--Mojave--/mojave.dmg" bs=801920k
Show_Time