[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cloning



On Thu, Jan 29, 2004 at 04:00:23PM +0100, Pedro Hernandez wrote:
} Hello all!
} 
} I'm about to install Debian on 12 computers (i*86). They will use the
} same setup regarding software, but the hardware differs somewhat
} between them.
} 
} I would like to know if there is possible to, for example, install and
} configure one box and then somhow "copy" the install to the others. Or
} is the debian installer maybe scriptable?
} 
} Well, I have never done anything similar before- suggestions, anyone?

Though I don't have an immediate need for this, I expect to in the
future. This means that I've been playing with ideas in my head, but
haven't tested anything. Here are a few ideas, starting from the
assumptions that you have configured a "master" and that your machines
are x86 and identical:

1) dpkg --get-selections | grep '\<install\>' | cut -f1 | xargs dpkg-repack

   This will produce .debs of everything installed, including any
   changes you have made to config files, which you can use to recreate
   the system on a new machine once it has gone through a base install.
   Note that this will not capture additional config files, and that it
   can cause some issues with new versions overwriting modified config
   files later. See the dpkg-repack man page for details. Note that this
   still requires an install on each machine.

2) Get an external disk identical to all the internal disks. This isn't
   as hard as it sounds; get the disk, then get a USB or Firewire
   external enclosure for it. Boot with Knoppix and use dd to copy the
   master disk (entire disk, including MBR, e.g. /dev/hda not /dev/hda1)
   onto the external. Boot other machines with Knoppix and external
   drive connected and dd from external to internal. This preserves
   partitioning and everything, but can be expected to be slow for large
   disks.

3) Variant of #2. Instead of using an external disk, both the master and
   the clone with Knoppix, then use dd over netcat (you'll need a named
   pipe on each side). It may be possible to use UDP multicast or
   broadcast with netcat (this might require modifying the netcat
   source) to do more than one clone at a time. This requires a fast
   network (probably disconnected from everything else temporarily
   because it will completely fill the bandwidth) and many Knoppix CDs.
   It can be expected to be even slower than #2 for large disks, but
   if the multi-/broadcast trick works then it is amortized over the
   multiple concurrent installs.

4) Get an extra disk large enough to hold the full install (need not be
   identical to other disks, need not be external, only needed
   temporarily). Between installing and configuring the master,
   duplicate the master onto the external disk. After configuring, boot
   Knoppix and produce a diff -ur of the roots of the two disks. Get the
   output of dpkg --get-selections. Install the base system on a clone.
   Armed with the dpkg selections (named selections) and the diff output
   (name clone.patch), load the selections into dpkg (dpkg
   --set-selections < selections), install the selected packaged
   (apt-get dselect-upgrade), then boot into Knoppix and patch the
   system (patch < clone.patch). This needs refining, but it should work
   pretty dependably, especially with a local repository mirror.

5) Refinement of #4. No need for an extra disk, just keep a backup of
   each config file you change and produce patches for each one
   separately.

} Thanks,
} --ph
--Greg



Reply to: