0

Description:

I would like to copy a whole data partition (~100 GB) from a computer to a single file on an external USB drive so that I can copy it back on a new empty data partition of an other computer.

The external drive is 1.5 TB and already contains 1 TB of data which I do not want to lose.

So I would like to be able to specify the of option of the dd command as a file onto this disk rather than its /dev/sdX identifier (which otherwise would overwrite the existing data on it).

Question:

How to do that?

3

You should be able to specify an output file (such as .iso, .img, .bak) by first mounting the device you want to write to, then running sudo dd if=/dev/sdX# of=/mount/point/file.iso. dd will automatically translate the partition into one of those filetypes, and won't just write it to the device directly.

Then, when finished, create a new empty partition of the appropriate size and run sudo dd if=/mount/point/file.iso of=/dev/sdX# and it will restore the partition.

If you prefer a GUI way, you can also use the gnome-disks utility to create a backup image of the partition you want to save; it does essentially the same thing as the dd command, but without the command line.

  • $ sudo dd if=/dev/sdX# of=/mount/point/file.iso <- do this also apply if the mount point of the external drive is /media/username/USBDiskStorage and the internal Data partition is mounted at /media/username/Data? – s.k Dec 12 '18 at 13:58
  • 1
    assuming the external drive (which you want to write TO) is /media/username/Data and the partition (which you want to write FROM) is /dev/sdb1, the command would be sudo dd if=/dev/sdb1 of=/media/username/Data. – Minty Dec 14 '18 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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