How do I use dd to clone an external USB drive installation to a local hard disk?

Solution 1:

Using dd to clone an Ubuntu installation

Yes, you can use dd to clone an installation, but it's not the fastest/easiest way to do it. It's better to do it via backup/restore with a live-tool such as Clonezilla.

  • If you wish to use dd, note that the target disk must be the same size or larger than the source.

  • Also, to make it bootable, you must copy from device-to-device (e.g. /dev/sdX), NOT from partition to partition (/media/...)

  • Use sudo fdisk -l or gparted to find out which block devices your target internal hard disk (usually /dev/sda) and external USB hard disk (usually /dev/sdb) are.

  • Then use dd with exactly the following syntax, where x is the letter for the USB drive and y the letter for the internal drive which you have determined in the previous step:

      sudo dd if=/dev/sdx of=/dev/sdy bs=8M && sync
    

    and wait for it to complete.

  • To answer your other question, no, simply dd'ing to an ISO (or CD or DVD, etc.) will NOT work; it will be unbootable. For that, you need to use a tool such as remastersys. See this question for more information:

    How do I convert my Ubuntu installation into a Live-USB or Live-CD?