I'd like to clone a running Debian machine (ext4, no LVM) to identical hardware, preferably over the network to create a test box.

Q1) Which tools / scripts are available that allow me to do this? AFAIK clonezilla and gparted need to be started from a separate medium. Would dd or ddrescue work?

Q2) In what ways do I need to adapt the clone so that both will run in the same network segment (my home network)? The original machine has a static DHCP IP via its MAC so that won't be an issue. I thought of changing the hostname and disabling crontabs. Anything else?

  • Can you snapshot the original machine (e.g., are you running a filesystem that supports snapshots, or on top of LVM?) – derobert Feb 19 '16 at 18:26
  • 1
    If you can risk downtime, it's always preferrable to clone the hard drive(s) offline. Always tricky to get stuff like running databases right and to not copy lock files, sockets, block devices etc. As for actual solutions, I would recommend to search ServerFault, there are good answers to that question. – kba Feb 19 '16 at 18:34
  • @derobert: Added info on FS type / LVM. kba: Downtime wouldn't be a problem but I'd like to automate the whole process as much as possible. – Jan Feb 19 '16 at 18:37
  • Do you need a sector-by-sector clone or would a normal (one time) copy of the first machine suffice? In the latter case I would suggest, that you 1. boot the new machine from a live medium 2. partition (if need be) the hard drive and mount it 3. set up an ssh server 4. rsync the old machine to the new drive 5. install grub on the new machine 6. future changes are 90% done with rsync now. - A few things would have to be done manually, e.g. like the UUIDs in the /etc/fstab. ... But maybe I am oversimplifying. – Fiximan Feb 19 '16 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.