You want to copy your entire 1TB NMVE SSD into a new, 2TB NMVE SSD you bought, you have two computers, but both of them only have one NMVE slot each, so a direct copy from one SSD into the other using only one computer isn't needed.
- Install the source disk 1TB SSD in the source computer and the 2TB SSD in the target computer.
- Boot both computers into a Linux Live environment (e.g., Ubuntu, Debian, or any distro with SSH and dd).
- Use
ddover SSH to clone the data.
Start a netcat (nc) listener to receive data:
nc -l -p 1234 | dd of=/dev/nvme0n1 bs=64KSend the disk data over the network:
dd if=/dev/nvme0n1 bs=64K | nc <target_ip> 1234Notes:
- Replace
<target_ip>with the target computer's IP address. bs=64Ksets the block size to 64KB for efficient transfer.- This method copies everything, including partition tables and boot sectors.
Before cloning an entire disk, verify that the network connection is stable by transferring a test file.
- Create a sample image file on PC1 (Source Computer).
- Transfer the file from PC1 to PC2 (Target Computer).
- Verify file integrity using checksums.
Create a test image file (100MB):
dd if=/dev/zero of=~/test.img bs=1M count=100if=/dev/zero: Uses zero bytes as dummy data.of=~/test.img: Saves the test file in the home directory.bs=1M count=100: Creates a 100MB file.
Or use an existing image file.
Start the file transfer:
cat ~/test.img | nc -q 0 <PC2_IP> 1234- Replace
<PC2_IP>with the IP of PC2. -q 0: Ensuresncexits immediately after the transfer.
Start a listener to receive the file:
nc -l -p 1234 > ~/received_test.img-l: Listens for incoming data.-p 1234: Uses port 1234.> ~/received_test.img: Saves the received file.
Check the SHA-256 checksum on both computers:
sha256sum ~/test.img # On PC1
sha256sum ~/received_test.img # On PC2If both checksums match, the transfer was successful.
Instead of transferring the disk directly over the network, you can save it as an image file on another disk. This is useful for backups or staged transfers.
- Mount the destination disk (where the image will be saved).
- Use
ddto create an image of the source disk. - Restore the disk from the saved image if needed.
Save the entire disk (/dev/nvme0n1) to an image file on another mounted disk:
dd if=/dev/nvme0n1 bs=64K | pv > /mnt/backup/disk_image.img/mnt/backup/: Should be the mount point of the target disk (e.g., an external drive or a second internal disk).pv: Shows progress (install it viasudo apt install pvif needed).
Check the image file size:
ls -lh /mnt/backup/disk_image.imgTo verify the integrity, compare checksums:
sha256sum /dev/nvme0n1
sha256sum /mnt/backup/disk_image.imgIf you need to restore the image to a new disk:
dd if=/mnt/backup/disk_image.img bs=64K | pv | dd of=/dev/nvme0n1- This will completely overwrite the target disk with the saved image.
- Ensure the target disk is at least as large as the source disk.
- You can compress the image to save space:
dd if=/dev/nvme0n1 bs=64K | gzip > /mnt/backup/disk_image.img.gz- To restore a compressed image:
gzip -d -c /mnt/backup/disk_image.img.gz | dd of=/dev/nvme0n1 bs=64K