Tags

Use dd to clone a drive and view progress

dd is a very, very powerful tool. Use with caution! Please ensure your if= (input file, i.e. what you want to back up) and of= (output file, i.e. where you are backing up to) are definitely correct before hitting that enter key!

This example involves cloning a USB stick but obviously your can copy anything to anything using dd, hence its power.

First of all I would recommend using gparted to work out the internal identifier of the drive(s) you want to clone. Unmount them all while you're at it too.

For example, the USB stick I want to copy is /dev/sdc (the partitions will be listed as /dev/sdc1, /dev/sdc2). The USB stick I want to clone to is listed as /dev/sdd. That would make the command to clone them:

dd bs=4M if=/dev/sdc of=/dev/sdd

Let's break that down so you have a full understanding. dd starts the program obviously. bs=4M switches the block size of the operation to 4 megs, which speeds things up siginificantly. if= is the SOURCE. of= is the DESTINATION. If you are working from this, make sure those match what you need!

All good, hit enter. The cloning operation starts... silently. No feedback. Is it even working? Let's fix that. Type 'top' and view running processes. dd will be in that list. Make a note of its process number. In this example is was 3729. To view progress you can open another terminal window and type:

kill -SIGUSR1 3729

Please make sure the process number is relevant to your dd. Don't just copy and paste the above!

You can keep entering the above command to view progress or use watch, as below:

watch -n 10 'kill -SIGUSR1 3729'

That will update the other terminal with dd's progress every 10 seconds. Change it to whatever you like.

Once again, be careful when using dd!

Posted by

Share: