dd
was useful in the old days when people used tapes (when block sizes mattered) and when simpler tools such as cat
might not be binary-safe.
Nowadays, dd if=/dev/sdb of=/dev/sdc
is a just complicated, error-prone, slow way of writing cat /dev/sdb >/dev/sdc
. While dd
still useful for some relatively rare tasks, it is a lot less useful than the number of tutorials mentioning it would let you believe. There is no magic in dd
, the magic is all in /dev/sdb
.
Your new command sudo dd if=/dev/sdb bs=128K | pv -s 3000G | sudo dd of=/dev/sdc bs=128K
is again needlessly slow and complicated. The data is read 128kB at a time (which is better than the dd
default of 512B, but not as good as even larger values). It then goes through two pipes before being written.
Use the simpler and faster cat
command. (In some benchmarks I made a couple of years ago under Linux, cat
was faster than cp
for a copy between different disks, and cp
was faster than dd
with any block size; dd
with a large block size was slightly faster when copying onto the same disk.)
cat /dev/sdb >/dev/sdc
If you want to run this command in sudo
, you need to make the redirection happen as root:
sudo sh -c 'cat /dev/sdb >/dev/sdc'
If you want a progress report, since you're using Linux, you can easily get one by noting the PID of the cat
process (say 1234) and looking at the position of its input (or output) file descriptor.
# cat /proc/1234/fdinfo/0
pos: 64155648
flags: 0100000
If you want a progress report and your unix variant doesn't provide an easy way to get at a file descriptor positions, you can install and use pv
instead of cat
.
Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying.
Check your man page for the actual signal as it differs for different dd implementations.
– groxxda Jul 12 '14 at 13:20SIGUSR1
, and BSD dd usesSIGINFO
– groxxda Jul 12 '14 at 13:22bs=
argument todd
). Also consider connecting each HDD to its own sata port. – groxxda Jul 12 '14 at 13:38direct
that might speed up the copy, but I haven't used that. – groxxda Jul 12 '14 at 13:49