[IOML] Other neat uses of Linux

Dylan Smith dyls at alioth.net
Fri Feb 20 17:18:50 GMT 2004


At ork, I'm having to clone a bunch of Windows XP systems. We started off
with Norton Ghost software, but unfortunately their USB drivers on the
boot disk seemed to disagree with the PCs we use.

Whilst trying to debug other problems with the ever versatile Knoppix Live
CD, a beautiful thought struck me for cloning PCs:

1. Boot Knoppix on the source and destination systems.
2. On the destination: nc -l -p 2000 | gzip -dc | dd of=/dev/hda1 bs=1K
3. On the source: dd if=/dev/hda1 bs=1K | gzip | nc 2000
4. ????
5. Profit!

With a pre-made gzip file of the NTFS partition stuck on a PC, you could
probably do half a dozen boxes at once from the one image over a 100Mbit
ethernet segment. On the Windows system, you have to do a little bit of
preparation using 'sysprep' to get rid of the unique things that each
Windows install has so the resulting image works.

If you're new to this sort of thing, this is what it's doing:
'nc' is netcat. Do a man netcat to find out more, but basically it allows
you to pipe arbitrary data over arbitrary network ports.
gzip is the compressor, to save network bandwidth (for many reasons, these
machines are only on a 10Mbit/sec segment, so it's important to compress
for this one)
dd allows you to read and write arbitrary data to pretty much wherever you
like. On the source, it's doing a raw read 1 kilobyte at a time from the
first hard disk partition and spitting it out on stdout. This is then
piped to gzip which compresses it, which pipes to netcat which throws it
over the network. Reassembly is the reverse of disassembly :-)

The thing is going now, I'll report my results on the list. Knoppix is
just _so cool_.

Things like this is what make *nix like OSen so much more versatile than

Dylan Smith, Port St Mary, Isle of Man    | Code fast, crash young and
Flying: http://www.dylansmith.net         | leave a beautiful core.
FFE/Elite Universe: http://www.alioth.net |             -- JK (#afe)

More information about the IOM mailing list