Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to simply duplicate a hard disk drive to another hard disk drive of the same size.

I know I can simply do:

dd if=/dev/sda of=/dev/sdb

(or whatever the names of the drives are in /dev).

Is there a better tool for this which will show me visual progress? If I'm only using 30GB of the drive, will it only take as long as it takes to transfer 30GB or will it take as long as the drive capacity?

share|improve this question
You say drive, but your command use partitions – enzotib Dec 20 '11 at 20:08
So a drive would be /dev/sda and /dev/sdb, right? That's what I meant, sorry. – Naftuli Tzvi Kay Dec 20 '11 at 20:09
up vote 4 down vote accepted

You can make GNU dd show you progress - to quote the man page:

Sending a USR1 signal to a running `dd' process makes it print I/O statistics to standard error and then resume copying.

$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid

Schily's dd (sdd) has a similar option and uses SIGQUIT by default (Ctrl+\).

Regarding your second question: Yes, dd just copies all the blocks if used by the filesystem or not - which takes DEVICE_CAPACITY/TRANSFER_RATE seconds.

If you want to avoid copying unused disk blocks you can use tar:

# cd /mnt/sda
# tar -c -f - . | tar -C /mnt/sdb -x -f -

GNU tar also has timing options:

# tar -c -f - . --totals=SIGQUIT | tar -C /mnt/sdb -x -f - \
                                      --totals --totals=SIGQUIT

Thus you get read/write statistics when hitting Ctrl+\ and at the end.

Another possibility is to use parted or gparted for copying a filesystem - which should be done in a efficient way with filesystems it has enough knowledge of. At least gparted should display a nice graphical progress dialog.

share|improve this answer
I guess that's how I'll do it, thanks :) – Naftuli Tzvi Kay Dec 20 '11 at 20:21
I'll need to copy all the blocks then, as I have HFS+, NTFS, and ext4 partitions on the same drive. – Naftuli Tzvi Kay Dec 20 '11 at 20:45
Ctrl+? Ctrl+\​? No, that sends SIGQUIT. There's no key for SIGHUP. An easier, and generally more robust way of copying files on a Linux system is cp -a . /mnt/sdb, or rsync -aP . /mnt/sdb if you want a progress indicator. – Gilles Dec 21 '11 at 2:19
@Gilles, yes Ctrl+backslash is SIGQUIT - mixed that up - I will update the question. cp -a is not portable - GNU cp has -a but it is not in POSIX. A correct implementation of cp -a should work as well as the tar pipe (modulo use of --totals option) - but why should it be more robust? – maxschlepzig Dec 21 '11 at 8:51
@maxschlepzig My recommendation of cp -a is from an experience a few years ago, transferring home directories of people with a propensity for using advanced features of anything they touched between filesystems that weren't supported by the same unix variant. GNU cp -a over NFS caused no complaint. tar choked on files with a hard link count >1 whose path was >100 bytes. pax missed named sockets and a few other oddities. I forget what other solutions I tried. I remember some not preserving file access times, too. – Gilles Dec 21 '11 at 16:46

Maybe you can use ddrescue /dev/sda /dev/sdb which support errors and have a progress bar

share|improve this answer
Probably need the -f flag for GNU ddrescue to overwrite destination device – charlesbridge Dec 21 '11 at 12:30

I suggest that you use the pv program (it is on the repos of all the distros i know of). It will give you an nice progress bar.

$dd if=/dev/sda |pv -s 80g |dd of=/dev/sdb

with the -s you add the amount of the original prtition/disk you are copy (the if in the dd command). If you wouldn't put the -s argument it just give you a moving bar to indicate that data is moving, but wouldn't give you how much.

of course add sudo if you need.

share|improve this answer
Useless use of cat, twice: you can simply write </dev/sda pv -s 80g >/dev/sdb. – Gilles Dec 21 '11 at 2:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.