2

Let's say i have already configured linux system which i would like to clone from machine it's on to other machines which aren't similar - don't have the same hardware, etc. How do i achieve this? I was thinking about doing hd copy and then copying it to target machines and using scripts to customize it later to work with other hardware... any thought on that? Are such solutions available or i would have to dig in it?

edit: I'm using Debian Etch based distro, 2.6 kernel line

1
  • 2
    Issues with cloning systems are primarily Window issues. Linux is pretty hardware transparent and most distributions ship will all the drivers built as modules. So as long as the hardware is supported it should just work. You may have to rebuild the initrd if you have a different hardware raid controller in the new system and this is used for the root partition. Aug 10, 2009 at 16:26

6 Answers 6

2

SystemImager will do what you want. You can customize the image after creating it. (it is just a copy of the dir structure along with a bunch of scripts. Howto.

2

Just rsync the filesystem? Unless you've gone crazy and recompiled all the kernel for some reason, you should be able to just rsync and everything will work?

2
  • ryncing will not work.
    – fpmurphy
    Aug 10, 2009 at 16:36
  • 1
    rsync will work, but it's only part of the solution. as well as rsync, you also need to install a boot loader such as grub into the Master Boot Record (MBR) of the boot disk. rsync (or tar) are a better solution for copying the files than dd because a) it only copies the actual files, not all the empty space and b) the disk geometry of the target doesn't have to match that of the source.
    – cas
    Aug 10, 2009 at 22:26
1

Do you know what changes you've made to it?

If so, the FAI (http://www.informatik.uni-koeln.de/fai/) looks to be full featured enough to "clone" a config, as long as you know what the config is. And honestly, you should make it a point to document a config to the point that you can use a tool like FAI anyway.

0

You'll need to give some more information, particularly which version of linux you're using. You may be able to do something like I do in windows: Clone the hard drive, put in the new system, throw the install disc in, and do what's called a Repair install. It will build the kernel and drivers up for your system, and you should be able to boot on a different system then.

2
  • Given that Linux doesn't hardcode ACPI information into the libraries needed to boot, it's not as much of an issue (this isn't needed on Windows either if you remove platform-specific drivers, ACPI and chipset being big ones). However, I can't think of a single UNIX/Linux variant that has a "repair" option.
    – phresus
    Aug 10, 2009 at 20:36
  • Thanks for the heads up. Unfortunately i'm not extremely familiar with linux, just know enough to bash my way around the console...
    – IceMage
    Aug 11, 2009 at 21:28
0

I've had success with this (adjust IPs and devices as appropriate; and do this with a rescue disk (I used knoppix)):

Original system:

dd if=/dev/sda | gzip -c | nc -l -p 3000

New system:

nc 1.2.3.4 3000 | gunzip -c | dd of=/dev/sda

There's no reason you couldn't use a bittorrent client for the HD cloning instead of netcat, if you need to send the image to multiple servers at once.

The on the new system, use the standard stuff to generate a new initrd with the right drivers. On RH systems you just have to fix the SCSI module so that it can boot at all, it'll automatically detect the change in network drivers and rebuild the initrd for that change.

0

why don't you just automate the install of all the machines. You can even do everything over the network PXE booting.

With Debian you can use preseed and automate all the installation and configuration phase.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .