Restoring computer-images over the network using dd

In this brief walkthrough I describe, how to restore a previously created dd– image (http://de.wikipedia.org/wiki/Dd_(Unix)) from a host (hosting the imagefile), over the network, to one or more guests.

Of course, there are many other and more economical ways of rolling out images to clients, but in some cases it might be useful to have at least another option as a fallback solution.

Step 1: Preparation of the host PC

  • Boot Knoppix with the parameter “knoppix toram” (this installs Koppix to the ram, wich allows you to remove the CD after booting)
  • After booting, open a console and kill the DHCP client with “killall pump” (to make sure the host doesn’t change ip address while imaging)
  • Note down the hosts current IP address (use “ifconfig” to find it out)
  • Start a console prompt, “su” and open /etc/samba/smb.conf with nano and add the following lines to the bottom of the file (match the line “path” to the location where the dd image resides)
    [image]
    comment = Images
    path = /media/sdb1
    browseable = yes
    guest ok = yes
    read only = yes
  • Save the changes and reload samba with the command “/etc/init.d/samba restart”
  • Testing the samba share on the host:
    open another console and “su”
    “mkdir /img”
    “smbmount //HOSTIP/image /img/ -o username=nobody” (blank password)
    If you run “ls /img” you should be able to see some useful contents (i.e. the image files)

Step 2: Cloning the image to guests

  • Boot Knoppix with the parameter “knoppix toram” (this installs Koppix to the ram, wich allows you to remove the cd after booting)
  • Start a console prompt and “su”
    “mkdir /img”
    “smbmount //HOSTIP/image /img/ -o username=nobody” (blank password)
    “cd /img”
    “dd if=IMAGENAME of=/dev/sda”

Monitoring: check if guests are still downloading

  • Open a console on the host and enter “smbstatus”

Leave a Reply

Your email address will not be published. Required fields are marked *

*