Unix/Linux dd Usage Examples

List disks in Linux

fdisk -l

After entering fdisk -l you would need to identify your disk(s)

dd how to clone disk to another disk

dd if=/dev/sdc of=Desktop/usb.iso bs=1M conv=noerror,sync

when using dd you have to make sure that you do not mix up the if (input file) and of (output file). “If” will always be the disk that you are copying and “of” is the location or the disk you are copying to

dd how to clone disk to an image

dd if=/dev/sdc of=/dev/sde bs=1M conv=noerror,sync

dd how to show progress

watch -n60 'sudo kill -USR1 $(pgrep ^dd)'

To get the progress of dd we will be using the

  • kill – a built-in command used to terminate processes manually
  • watch – execute a program periodically
    • -n60 (the number 60 in the command above is the seconds that it will refresh, change that to the desired refresh rate )