You can clone a drive from one machine to another using “dd” and netcat (nc)

Caveats:

  • The commands should be run a root

  • Data on the destination device will be overwritten, so double-check that you get the right one (maybe check with “lsblk” etc)

  • The drive on the destination machine must be at least as big as the source

  • The data on the source device should not changed while it is being cloned. Make sure it has no mounted partitions (it’s a good idea to boot from USB). Ditto the destination drive

  • The source machine must be able to reach the destination on the port specific (not blocked by firewall etc)

  • Data is sent unencrypted over the network, so make sure you get the right destination and your network is trustworthy/secure (you could so this over the internet - firewall rules permitting - but I wouldn’t recommend doing so with a drive containing sensitive data and it is going to eat up bandwidth/data-cap)

The process…

On the machine with the destination drive, run the following (where 11111 is a TCP port the machine will listen on, and /dev/sdd is the device that will be cloned to. Data will be sent in 1M blocks).

nc -l 11111 | dd of=/dev/sdd status=progress

This will begin listening for data on port 11111

On the machine with the source drive, run the following (where 192.168.1.2 is the IP address if the destination machine, /dev/sdb is the drive being cloned from, and 11111 is the port you used above)

dd if=/dev/sda status=progress bs=1M | nc 192.168.1.2 11111

You should see progress on both hosts as the drive from machine to the other

0 points

You can also use a file instead of a device if you want to write your image to/from a file

Writing a compressed image at the destination

nc -l 11111 | gzip > /path/to/backup.img.gz

Reading a compressed image at the source and sending uncompressed data over the network (can be cloned directly over drive at the destination, within the original constraints). Please note this will not show a progress status at the source:

zcat /path/to/backup.img.gz | nc 192.168.1.2 11111

Or you could just send the compressed-image data over the network and decompress at the destination (as per the second example}:

dd if=/path/to/backup.img.gz status=progress bs=1M | nc 192.168.1.2 11111

permalink
report
reply
1 point

what about clonezilla? does it have more safe guards and functionality?

permalink
report
parent
reply
1 point

I’ve never used that particular software so I couldn’t say. Unless you’re sending over the internet this method should be fairly safe though

permalink
report
parent
reply
-1 points

Sudo rm -r /*

permalink
report
reply

Software alternatives for Linux

!software_alternatives_linux@lemmy.ca

Create post

This is a sister community to !linux@lemmy.ml.

Many members there are computer users who recently moved to Linux from other OSs, Windows in particular. Having established their work and hobbies on a particular software base, they often encounter difficulties trying to find similar software on Linux.

Here you can ask, propose, comment about some software alternative you’re looking for.

It’s important to be broad-minded when speaking about software alternatives when switching to Linux:

  • Exactly the same software could be available for Linux.

  • Different software but with similar critical features could be available for Linux.

  • It could be possible to use emulators (such as Wine) of the old OS.

  • Finally, one can change one’s perspective or workflow, in such a way that the old software is not needed any longer, but is replaced with other software of a different kind (this may actually lead to much improved workflows).

Role of conduct: The same as in Lemmy and Mastodon: in summary, be respectful, no offensive language, no harassment, no spam.

Community stats

  • 1

    Monthly active users

  • 7

    Posts

  • 9

    Comments