I need to clone one laptop's drive to another one which is basically the same built.

They are M.2 PCIe drives so even if I wanted to open the laptops I can't currently find USB connectors for them.

So I would need then to image the source to an external drive and then play that image back on the new computer.

Doing that for almost a Terabyte of data does take quite some time - and I have to find room for the image as well.

How can I clone the source laptop to the target laptop over the network without creating an intermediate copy of the image? I can boot to USB on both laptops.


No need to find storage for the image - just load up a Linux Live CD (or USB stick), and use netcat.

On the computer that is setup and ready to go, run:

sudo dd if=${SOURCE_DISK} bs=4M | gzip | nc -l 27015

Then, on the computer that will recieve the image and become a clone, run the following... (I feel I should note the obligatory this will destroy all data)

nc ${IP_OF_SERVER} 27015 | gzip -d | sudo dd of=${DEST_DISK} bs=4M

Here, ${SOURCE_DISK} and ${DEST_DISK} need to be swapped for the relevant disks - e.g: /dev/sda or /dev/nvme0n1.

Additionally, ${IP_OF_SERVER} needs to be replaced with the IP of the first computer.

This will transfer the data directly between the two M.2 drives.

For bonus points, you could replace the source dd with pv to keep an eye on progress... or send a SIGUSR1 to the dd instance for a poor-man's update.


  • This doesn't cover any modifications that you may need to make to the (unspecified) OS... Windows might get picky about activation, and Linux might get nostalgic about things like network interfaces...
  • This basic approach isn't suitable if your target SSD is smaller than the source.
  • If you're only interested in particular partitions, then check the sizes, and use a suffix of p1 / p2 / etc... on the device names.
| improve this answer | |
  • Thanks. Really...dd can copy a whole partition, not just files? That's quite interesting. Copying Windows 10 but other than the hard drive (new one is bigger) they are the same config - so Windows activation hopefully shouldn't be an issue if it doesn't read too many part IDs...wonder if UEFI will create issues now that you mention issues... – Mark Canada Dec 25 '17 at 0:28
  • Absolutely - in this scenario dd will copy the whole file table, inculding file contents and metadata (e.g: permissions). You will end up with "identical" disks. – Attie Dec 25 '17 at 19:23
  • There is an even easier version of this solution which would be to use ssh to pipe the output - ie from the client : ssh root@server "gzip < /dev/sdX " | gunzip | pv > /dev/sdX – davidgo Dec 26 '17 at 1:18
  • Indeed, though: A) this requires root over SSH (not typically enabled by default), B) specifying both block devices on one line opens up for mistakes and confusion, and C) pv no longer gives you progress - just rate and total transferred – Attie Dec 27 '17 at 18:11

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.