Introduction

You're probably familiar with the popular proprietary commercial package Norton Ghost®, and its OpenSource counterpart, Partition Image. The problem with these software packages is that it takes a lot of time to massively clone systems to many computers. You've probably also heard of Symantec's solution to this problem, Symantec Ghost Corporate Edition® with multicasting. Well, now there is an OpenSource clone system (OCS) solution called Clonezilla with unicasting and multicasting!

Clonezilla, based on DRBL, Partition Image, ntfsclone, and udpcast, allows you to do bare metal backup and recovery. Two types of Clonezilla are available, Clonezilla live and Clonezilla server edition. Clonezilla live is suitable for single machine backup and restore. While Clonezilla server edition is for massive deployment, it can clone many (40 plus!) computers simultaneously. Clonezilla saves and restores only used blocks in the harddisk. This increases the clone efficiency. At the NCHC's Classroom C, Clonezilla server edition was used to clone 41 computers simultaneously. It took only about 10 minutes to clone a 5.6 GBytes system image to all 41 computers via multicasting!

Features of Clonezilla

Editions

This Howto only covers Clonezilla server edition

How to setup a Clonezilla server

A DRBL server must first be set up in order to use Clonezilla to do massively clone.

Diskless Remote Boot in Linux (DRBL)

Setup the Linux Server

Install the GNU/Linux distribution and configure all network cards. In the following, we use "eth0" to connect the Internet, while eth1, eth2, eth3 are for DRBL environment(set the network card's IP addresses to be private IPs (i.e. 192.168.x.x, the following example, we set eth1:192.168.101.254, eth2:192.168.102.254, eth3:192.168.103.254...); Please remember this principle, private IP (e.g. 192.168.x.x) is used for DRBL environment.

nano -w /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#Gateway - 
auto eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save > /etc/iptables.rules

#eth1
auto eth1
iface eth1 inet static
    address 192.168.101.254
    network 192.168.101.0
    netmask 255.255.255.0
    broadcast 192.168.101.255

#eth2
auto eth2
iface eth2 inet static
    address 192.168.102.254
    network 192.168.102.0
    netmask 255.255.255.0
    broadcast 192.168.102.255

#eth3
auto eth3
iface eth3 inet static
    address 192.168.103.254
    network 192.168.103.0
    netmask 255.255.255.0
    broadcast 192.168.103.255

Restart network

sudo /etc/init.d/networking restart

Your firewall rules will be overwritten when setting up the DRBL server. After completing the DRBL setup and successfully testing it, you can config your firewall using your own rules. Remember, in the DRBL environment, NFS, NIS, tftp, and dhcp services are required, so dot NOT block them in your firwall rules.

If you want to get better performance, you can do some tuning as follows. If reiserfs filesystem is available in your GNU/Linux distribution, it is recommended for its better performance compared with ext2/ext3. The current ubuntu (8.04) default setup uses ext3.

After Linux is installed on the server, make sure the hard disk drive DMA mode is on. It will accelerate the access speed of the server's hard disk drive. Use "hdparm /dev/sdx" to check to see if the DMA mode is on or off. If it is off, run "hdparm -d1 -c3 -k1 /dev/sdx" to turn it on. Replace the /dev/sdx to the /dev/sda if your IDE HD for this Linux system is in "Primary IDE."I couldn't get this to work with ubuntu. The result i got was: HDIO_GET_DMA failed: Inappropriate ioctl for device

If you have only one NIC, you may set two IP addresses, i.e. one in eth0 and another alias IP address in eth0:1. eth0 will be used for the DRBL server to connect to the public Internet while eth0:1 will be used for the DRBL environment. NOTE! This alias IP address will cause some problems if you do not provide static IP address to DRBL client via its MAC address. In this example, the DRBL server will lease IP address to any machine connected to eth0 if no MAC address is set in the DHCP service. Hence you'd better not to use alias IP if you do not know exactly what you are doing! Two or more NICs are recommended!

nano -w /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#Gateway - 
auto eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save > /etc/iptables.rules

#eth0:1
auto eth0:1
iface eth0:1 inet static
    address 192.168.100.254
    network 192.168.100.0
    netmask 255.255.255.0
    broadcast 192.168.100.255

Server Setup for clients

Install the program "drbl"

wget http://drbl.nchc.org.tw/GPG-KEY-DRBL

apt-key add GPG-KEY-DRBL

nano -w /etc/apt/sources.list

If it's Ubuntu Hardy (8.04):

deb http://free.nchc.org.tw/ubuntu hardy main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable

If it's Ubuntu Gutsy (7.10):

deb http://free.nchc.org.tw/ubuntu gutsy main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable

If it's Ubuntu Feisty (7.04):

deb http://free.nchc.org.tw/ubuntu feisty main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable

If it's Ubuntu Edgy (6.10):

deb http://free.nchc.org.tw/ubuntu edgy main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable

If it's Ubuntu Dapper (6.06):

deb http://free.nchc.org.tw/ubuntu dapper main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable

If it's Ubuntu Breezy (5.10):

deb http://free.nchc.org.tw/ubuntu breezy main restricted universe multiverse
deb http://free.nchc.org.tw/drbl-core drbl stable

If you want to use the DRBL's testing branch, the 2nd line is:

deb http://free.nchc.org.tw/drbl-core drbl stable testing

If you want to use the unstable branch of DRBL, set the 2nd line as:

deb http://free.nchc.org.tw/drbl-core drbl stable testing unstable

apt-get update

apt-get install drbl

Server Hardware configuration

Impatient method

If you are impatient, your network bandwidth to Internet is good, you can run "/opt/drbl/sbin/drbl4imp" to finish hardware configuration. "drbl4imp" uses the default values to setup the DRBL server. THIS IS VERY IMPORTANT! The default value might not fit your environment! It uses the "range" option in dhcp server so your DRBL client will not always get the same IP address. It also assumes each of the server's network card (except eth0) provides DRBL services to 12 clients. If you want the setup to fit your environment, please run steps.

/opt/drbl/sbin/drbl4imp

Manual Configuration

Execute "/opt/drbl/sbin/drblsrv -i". Note: There is a space before the "-i". This is the example execution. If you are uncertain, just press Enter to accept the default value.

/opt/drbl/sbin/drblsrv -i

Set up the file system for the client in the Server

Taking NCHC's computer class room C as an example: There are 40 computers. In order to get DRBL to work more efficiently, we separated them to 4 subnets: 192.168.100.0, 192.168.101.0, 192.168.102.0 and 192.168.103.0. There are four Ethernet cards in DRBL server. One is for WAN and the others are for LAN. The IPs of DRBL environment (LAN) are 192.168.100.254, 192.168.101.254, 192.168.102.254 and 192.168.3.254. The services DHCP, TFTP, NFS, etc will run on eth0:1, eth1, eth2, and eth3.

         NIC    NIC IP                    Clients
+-----------------------------+
|         DRBL SERVER         |
|                             |
|+-- [eth0] public IP         +- to WAN
|     (ex. 61.216.116.23)     |
|                             |
|+-- [eth0:1] 192.168.100.254 +- to clients group 1 [ 10 clients, their IP
|                             |            from 192.168.100.1 - 192.168.100.10]
|+-- [eth1] 192.168.101.254   +- to clients group 1 [ 10 clients, their IP
|                             |            from 192.168.101.1 - 192.168.101.10]
|+-- [eth2] 192.168.102.254   +- to clients group 2 [ 10 clients, their IP
|                             |            from 192.168.102.1 - 192.168.102.10]
|+-- [eth3] 192.168.103.254   +- to clients group 3 [ 10 clients, their IP
|                             |            from 192.168.103.1 - 192.168.103.10]
+-----------------------------+

The network bandwidth and disk space requirement are higher in the former two modes, but all the system setting will be saved to server's disk, and every client can have its own individual setting. On the other hand, the DRBL SSI uses single system image for all clients, and the necessary individual settings of clients are created run-time when they boot. This will reduce the required disk space in the server since only one image is necessary. However, the disadvantage is every client can NOT have its own individual system setting (Users' setting will be saved to server). In DRBL SSI mode, once there are extra client nodes want to join DRBL environment, all you have to do is modify the dhcpd config file (dhcpd.conf), then use "/opt/drbl/sbin/dcs -> others -> gen_3N_conf" to create or run "/opt/drbl/sbin/drbl-3n-conf generate", the necessary files will be created. In this mode, theoretically one network card in the server can provide 253 clients. The fourth mode, Clonezilla box mode, is based on DRBL SSI mode, especially for clone system. If you want to use DRBL SSI mode, make sure your client has large memory (say > 512 MB), and all the hardware (especially the graphic card) in the clients are the same. Check this comparison table for these four modes.

Full DRBL

Full Clonezilla

DRBL SSI

Clonezilla Box

/etc, /var of clients

NFS-based

NFS-based

tmpfs-based

tmpfs-based

modified files in /etc and /var of client after reboot

kept

kept

gone

gone

extra space in server per client

~ 50 MB

~ 50 MB

0

0

max client no per ethernet card in server

253

253

253

253

When you use multiple NICs to expand the bandwidth, we recommend you set the MAC addresses so that every node will get the same IP address all the time. (i.e. in the following step 3a, when you run "/opt/drbl/sbin/drblpush -i", it prompts "Do you want to fix the IP address of client connected to eth1 by giving MAC address ? [y/N]", choose "Y"). If you do NOT set MAC address (we will call it "range" from now), and you have only one 48-port network switch (or many switches but connected to be one), and you use four NICs (or more than two...) in DRBL server to expand the network bandwidth, a problem will occur (i.e. some clients will not lease IP from DHCP server) so it will not be able to boot. On the other hand, if your DRBL server uses four NICs to expand the network bandwidth (meaning that four NICs with four private subnets such as 192.168.100.x, 192.168,101,x, 192.168.102.x, 192.168.103.x), and you have exactly four switches that are separated and not connected to each other, then you can use range (i.e. you do not have to set the MAC address of clients). Remember, if you use N NICs to expand network bandwidth in the DRBL server, if using the "range" method, then you must have N switches and they can NOT be connected to each other.

nano -w /opt/drbl/conf/drbl.conf

edit

diskless_root_dir_ro_user_add="/work1" #read only

diskless_root_dir_rw_user_add="/work1" #read write
  1. If all the clients have their local harddisk, and the partition is formated (For example, /dev/hda1, its filesystem is ext3), then if you want the client to mount /dev/hda1 as /localwork when booting. Therefore you can edit /opt/drbl/conf/client-append-fstab, and its syntax is just like /etc/fstab. In this example, you can make /opt/drbl/conf/client-append-fstab like this:

nano -w /opt/drbl/conf/client-append-fstab

/dev/hda1 /localwork ext3 defaults 0 0
  1. If you have extra services (such as apmd and bluetooth) to be on when client boots, you can edit /opt/drbl/conf/client-extra-service, let service_extra_added="apmd bluetooth".

nano -w /opt/drbl/conf/client-extra-service

service_extra_added="apmd bluetooth"
  1. If you want to overwrite some or all automatically created hostnames later by "drblpush -i", you can edit "/opt/drbl/conf/client-ip-hostname" now. Check that file for the format. If some machines are not assigned, drblpush will use those automatically created hostname.

nano -w /opt/drbl/conf/client-ip-hostname

/opt/drbl/sbin/drblpush -i

/opt/drbl/sbin/drblpush -i

/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf

Setting up clients to use the DRBL environment

  1. the client has PXE network interface card,
  2. the client has a floppy drive,
  3. the client has a CDROM,
  4. the client has a local hard drive.

We use etherboot 5.4.3 as an example for cases 2-4. NOTE! With DRBL version 1.3.9 or later, if you want to use Etherboot, Etherboot version 5.4.0 or newer is required.

Case 1

The client has a PXE network interface card

Case 2

The client has a floppy drive.

cat /opt/drbl-etherboot/etherboot-net.zdsk > /dev/fd0

Case 3

Client has a CDROM (Reference):

cdrecord -v speed=12 fs=16m dev=0,0,0 -data etherboot-net.iso

(If necessary, modify "dev=0,0,0", run "cdrecord -scanbus" to get your CD burner.)

cdrecord -scanbus
  1. Ensure the PC is set to boot from CDROM, place the burned CD in the drive, and reboot. Done!

Case 4

client has a local hard drive

                  title Etherboot-PXE
                  kernel /boot/etherboot-net.zlilo

  1. Change the default boot to the corresponding one above, like "default 1", in menu.lst or grub.conf in client.

                  boot.ini:
                
                  [boot loader]
                  timeout=30
                  default=C:\GRLDR
                  [operating systems]
                  multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
                  C:\GRLDR="Etherboot"
                 [
                  MENU.LST:
                  [
                  timeout 7

                  title etherboot
                  root (hd0,0)
                  kernel /etherboot-net.zlilo

                  title Windows at (hd0,0)
                  root (hd0,0)
                  chainloader +1
                 [

How to use Clonezilla server edition

As root, run "/opt/drbl/sbin/dcs" in DRBL server to switch clients' mode. You will see two menus: clonezilla-start and clonezilla-stop like this:

/opt/drbl/sbin/dcs

Again, check the mode you want by "space" key, then follow the menus to do it. Once the mode in DRBL server is ready, you can boot your clients via PXE to save or restore the image.

To stop clonezilla: As root, run "/opt/drbl/sbin/dcs", then choose "Clonezilla-stop". Or you can use "/opt/drbl/sbin/drbl-ocs stop".

/opt/drbl/sbin/drbl-ocs stop

# Examples:

The program will ask you which source image to restore. In this example, we chose the image "nomorems."

# More examples are available here. http://www.clonezilla.org/related_article/

# PS: You can refer to DRBl-winroll to make the restored (cloned) MS Windows with a different hostname automatically. http://drbl-winroll.sourceforge.net/

Reference

http://www.clonezilla.org/

Authors


CategoryInternet

Clonezilla_Server_Edition (last edited 2011-10-17 08:48:41 by 83-244-196-130)