I'd like to copy a partition to another laptop (to back it up). I'll connect the side-by-side laptops with an ethernet cable. To do the backup, I'd specifically like to use the "dd" command.

For simplicity, I haven't shown below the "netcat" commands (which provide the laptop-to-laptop communication) that I'll be using along with dd. So below is the effective command that I plan to run to do the backup:

dd if=/dev/sda6 of=/home/name/sda6.img

To restore the backup later, I plan to run

dd if=/home/name/sda6.img of=/dev/sda6

BUT I'VE READ that in order to do the latter command (which is a reversal of the first), the destination partition needs to be LARGER than the image file, even though I'm just putting the SAME DATA back where it came from.

This would involve me in increasing the size of the original partition, which might involve extensive work, which I'd rather not do.

SO MY QUESTION IS, for the restore, will I really need to increase the size of the destination partition, or will the data fit neatly back on the partition?

Also, if I WOULD need to increase the partition size with the above scenario, is there some tweak I can do to the dd commands that makes increasing the partition size unnecessary?

Added detail

I realise that the following are alternative ways to do such a backup, but I chose not to use them because of the reasons below:

tar: Apparently doesn't backup certain attributes or something like that.

cp: Apparrently doesn't backup certain things, like ACLs.

rsync: This command has too many options that just confuses me and complicates things. Whereas I know where I am with dd.


No, you don't need to increase the original partition size. It's vitally important that the new partition is at least as large as the filesystem, but there's no need for it to be bigger. Typically the filesystem is the same size as the partition you're copying.

You may have seen advice that leads to making a larger partition because if there's a doubt, that's the safe option. For example, make sure not to mix up powers-of-ten (SI units) megabytes/gigabytes/terabytes and binary (powers of 210) units (MiB/GiB/TiB). Some software is poorly labeled so sometimes it isn't clear which unit sizes are expressed in. Be especially wary of software that displays sizes with a decimal point: there you have to round up and so would typically end up creating a larger partition.

As long as you use software that reports sizes accurately, there's no reason to make the partition larger. Just make it the same size (unless you want to enlarge the filesystem after moving it, of course).


You are thinking about too many things. Lets try to think in a simple way.

The .img file will simply have exactly the size of the partition including its free space. And that is it. There is no other secret. So if you have a 50GB partition, the .img will be 50GB of size, if the partition has 100GB the img will have 100GB of size. That is it, to restore it, just restore it in a partition or device with the same size (or bigger!), or in the same partition.

This is the End of the answer, but here some tips to help you:

1- This will make the image to be very smaller, specially if you have free space on the partition :

dd if=/dev/sda6 | gzip > sda6.img.gz 

2- And the restore operation can be like this:

gunzip < sda6.img.gz | dd of=/dev/sda6
  • I think you mean to use gzip -c > sda6.img.gz and gunzip -c sda6.img.gz – joeytwiddle Sep 29 '16 at 2:31
  • It is just missing > and <, I edited the question. For Linux this is working fine. Try it. – Luciano Andress Martini Sep 29 '16 at 12:08

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.