HOWTO raw-disk cloning with SystemImager

From SystemImager

Jump to: navigation, search

Contents

HOWTO: raw-disk cloning with SystemImager

Preamble

This documentation is WIP (Work In Progress). If you notice errors or encounter issues, please email us at sisuite-devel.

These instructions have been tested installing FreeBSD 6.3 and Windows 98 SE.

Introduction

SystemImager uses a file-oriented approach to clone and image the clients. This has a lot of advantages, because allows SystemImager to be distribution agnostic, it gives the hardware independence and it permits to automatically save only the useful informations (the content of the filesystem).

Unfortunately, the file-oriented approach requires to add in SystemImager the support for all the filesystems the clients could use, that is not a complicated issue with GNU/Linux distributions (because SystemImager is focused on Linux), but a lot of problems come into place cloning & installing other OSes: FreeBSD, Solaris, Windows, etc., because the SystemImager developers should provide the support to all the filesystems used by these OSes.

This documentation describes how to use the disk cloning approach with SystemImager in few simple steps. This introduces the hardware homogeneity constraint, because it just does a bare metal copy, but it theoretically permits to image any kind of OS (due to the filesystem independence)!!!

First step: raw-disk cloning

  • We suppose to have the host foo up&running with your preferred OS and we've configured it as a SystemImager netbooting client (as described in the Quick Start HOWTO).
  • Define a pre-install script to stop the installation just after the hardware discovery and enable the golden client raw-cloning:
 $ cat /var/lib/systemimager/scripts/pre-install/80foo.hda-raw-disk-clone
 #!/bin/sh
 [ -e /tmp/variables.txt ] && . /tmp/variables.txt
 echo "cloning from $HOSTNAME enabled"
 cat /dev/hda | nc -l -p 9090
 echo "cloning completed: press a key to reboot"
 echo
 echo "NOTE: remember to run:"
 echo "# si_mkclientnetboot --netboot --clients $HOSTNAME"
 echo "on your image server to stop booting in SystemImager environment"
 echo
 read
 reboot
  • Configure foo to netboot (just like a normal re-installation, but don't worry, the pre-install script will stop the installation just before the disk partitioning, so foo will be untouched and we'll be be able to get the raw partitions from him):
 # si_mkclientnetboot --netboot --clients foo
  • the client boots up and stops after the hardware discovery; at this point go to your image server and execute:
 # mkdir /var/lib/systemimager/raw-images/
 # nc -q 1 foo 9090 > /var/lib/systemimager/raw-images/OS-foo.img
  • Now we've successfully cloned our raw disk-image and we can allow the image server to start distributing it via network (remember to configure your firewall and network ACLs to accept connections to the image server on port 9090, or, anyway, repeat these steps choosing any other opened port according to your network policies):
 # dd if=/var/lib/systemimager/raw-images/foo-OS.img | nc -q 1 -l -p 9090

NOTE: this is a quick and dirty hack, because in this way we can install only a single client (we could put the instruction above in a while() loop, but it wouldn't be threaded = a single client per time will be served). If you want to install multiple clients at the same time you should consider to use this script instead.

  • At this point we're able to install other clients with identical hardware using the foo-OS.img raw-disk image.

Raw-disk installing

  • OK, let's try to install the client bar using the raw disk image cloned from foo.
  • Prepare bar for installation:
 # si_mkclientnetboot --netboot --clients bar
  • Create the following pre-install script:
 $ cat /var/lib/systemimager/scripts/pre-install/80bar.raw-disk-install
 #!/bin/sh
 [ -e /tmp/variables.txt ] && . /tmp/variables.txt
 # retrieve the raw-disk image from the image server
 nc $IMAGESERVER 9090 > /dev/hda
 # this is needed to inform netbootmond that the installation is completed
 rsync $IMAGESERVER::scripts/imaging_complete_$IPADDR > /dev/null 2>&1
 reboot
  • That's it! the client bar should now reboot in the OS cloned from foo.

TODO

  • exclude useless data (swap/empty partitions) from disk images
  • raw-disk image compression
  • raw-disk image encryption
  • raw-disk deployment via BitTorrent and/or Multicast transports (!!!)

See also

Personal tools