I have saved my whole hard-disk with dd
to an image file. The hard-disk contained some primary partitions formatted with ntfs, swap and ext4. I did it this way:
dd if=/dev/sda | ssh user@fastmachine "cat - > diskimage.img"
Then I have overwritten the first 5 to 6 GB of my hard-disk for testing purposes with a new system:
- I created a swap primary partition with 1.5 GB.
- I created an ext4 primary partition with 4 GB.
After testing the test system now I want my old system back. But my local hard-disk is very slow when writing. To save time and energy I want to only restore about 6 GB from the image. Is this enough and safe? Would it work? I would do it this way:
ssh user@fastmachine "dd if=diskimage.img bs=1M count=6000" | dd of=/dev/sda
Update—partially restoring test
It worked to only partially restore the hard-disk.
Update—speedtest of 1.8" pata hard-disk
I just testet the writing speed with
dd if=/dev/zero of=blub count=1000 bs=1M
And
ssh user@fastmachine "dd if=/dev/zero count=1000 bs=1M" | dd of=blub
- First gave me 14.5 MByte/s as writespeed to my 1.8" hard-disk—not as bad as I thought
- Second gave me 11.4 MByte/s = 91.2 Mbit/s ≈ 100 Mbit/s = speed of my ethernet connection
But: ssh over WLAN (wireless) only was 1,3 MByte/s! That was the problem.
ssh took 68 % cpu load when copying over ethernet, and only 20 % when copying over WLAN (wireless).
Conclusion: If I had a faster network and hard-disk/flash-drive I would use netcat (nc) to copy the data.