ClonezillaReplace Symantec Ghost Enterprise with Clonezilla.

Since posting my article listing the open source alternatives to Symantec Ghost Enterprise, I have received a lot of questions related to installing and configuring Clonezilla, so I thought it would be a good idea to post a “quick start guide” for installing Clonezilla.

The following applies to setting up a network boot environtment using the PXE capabilities of your network card. If you simply want to image a single machine, then I suggest you use the Clonezilla Live CD. You simply boot your system from the CD, mount a network drive, and save your image to the network. It is the same as using a ghost boot disk in DOS but, without all the network card configuration.

If you are anything like me then you don’t like having to remember what you did with a boot disk and have to image a system a lot more often then a couple of times a year. In that case, follow along to setup a Clonezilla server your clients can use to boot from without the need for a boot disk.

Required:

First, you will need a fresh install of Ubuntu to follow this guide. I am using the latest server release candidate, Ubuntu 8.10 (Hardy), for this guide. If you are using the desktop version of Ubuntu or an early server version, you should be fine. Just make sure to change the required lines when adding the drbl (Diskless remote boot Linux) repositories to your source.list.

Second, you will need too configure two network cards. These can either be physical cards or one can be a virtual one. I am using a virtual interface for the second card.

Below is my /etc/network/interfaces file. You’ll need to edit your file to match. Make sure you change the IP addresses to something that will work on your network.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.2.201
netmask 255.255.255.0
gateway 192.168.2.1

auto eth0:0
iface eth0:0 inet static
address 192.168.3.1
netmask 255.255.255.0

Finally, you are going to need a list of the MAC address for each machine you wish to image. By default, Clonezilla installs a DHCP server. We want to lock down which machines can request an IP address from this server so we don’t cause any problems with other machines requesting a DHCP address from the Clonezilla server and receiving the wrong information. This is very important if you are setting up Clonezilla on a production network with an existing DHCP server.

Once you have your two network cards setup you are ready to start installing Clonezilla.

Installing Clonezilla.

The first step is to install the key for the Clonezilla repository. Enter the following in the terminal to download the key:

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

Second, add the key:

sudo apt-key add GPG-KEY-DRBL

Third, we need to add the Clonezilla repository to the apt source.list file. Enter the following to open /etc/apt/source.list in the nano text editor:

sudo nano /etc/apt/sources.list

Add the following two lines to the bottom of the file. Make sure to replace “hardy” with the name of the Ubuntu distribution you are using. I.E. gutsy, feisty, edgy….:

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

Once you have added the Clonezilla repository to your source list, you can run the following two commands to update your list and install drbl:

sudo apt-get update
sudo apt-get install drbl

Once drbl is installed we can go ahead and install all the dependencies for Clonezilla. NIS will fail to launch at this point. Just ignore it. We will configure it later.

sudo apt-get install util-linux tar gzip bzip2 procps dialog rsync parted pciutils tcpdump bc grub gawk hdparm sdparm netcat file ethtool etherwake ssh syslinux mtools mkisofs reiserfsprogs e2fsprogs psmisc locales wget disktype zip unzip initscripts dhcp3-server tftpd-hpa nfs-kernel-server nis ntp curl lftp iptables sysutils libdigest-sha1-perl

sudo apt-get install partclone mkpxeinitrd-net clonezilla mkswap-uuid drbl-partimage drbl-ntfsprogs drbl-chntpw drbl-lzop udpcast drbl-etherboot freedos

sudo apt-get install lvm2 ntfs-3g lshw

Once drbl is installed we need to create a file with the MAC address of each system we wish to image. The addresses should be in the following format with one address per line.

sudo nano /etc/drbl/macadr-eth0:0.txt

00:00:00:00:00:00

Next we need to configure the boot image that each PXE client will use:

sudo /opt/drbl/sbin/drblsrv-offline -s `uname -r`

Finally, we need to launch drblpush to configure the environment.

sudo /opt/drbl/sbin/drblpush -i

The drblpush script will ask you a series of questions and then setup your environment for you.

Please enter DNS domain (such as drbl.sf.net):

Enter your domain.

Please enter NIS/YP domain name:

Enter you NIS domain name. If you don’t have a NIS domain you can call it whatever you want.

Please enter the client hostname prefix:
This prefix is used to automatically create hostname for clients. If you want to overwrite some or all automatically created hostnames, press Ctrl-C to quit this program now, edit /opt/drbl/conf/client-ip-hostname, then run this program again.

Enter a hostname prefix.

The public IP address of this server is NOT found.
Which ethernet port in this server is for public Internet accsess, not for DRBL connection ?

eth0

Now we can collect the MAC address of clients!
If you want to let the DHCP service in DRBL server offer same IP address to client every time when client boot, and you never did this procedure, you should do it now!
If you already have those MAC addresses of clients, you can put them into different group files (These files number is the same number of networks cards for DRBL service). In this case, you can skip this step.
This step helps you to record the MAC addresses of clients, then divide them into different groups. It will save your time and reduce the typos.
The MAC addresses will be recorded turn by turn according to the boot of clients,
and they will be put into different files according to the network card in server, file name will be like macadr-eth1.txt, macadr-eth2.txt… You can find them in directory /etc/drbl.
Please boot the clients by order, make sure they boot from etherboot or PXE!
Do you want to collect them ?

n. We already listed them in the /etc/drbl/macadr-eth0:0.txt file.

Do you want to let the DHCP service in DRBL server offer same IP address to the client every time when client boots (If you want this function, you have to collect the MAC addresses of clients, and save them in file(s) (as in the previous procedure)). This is for the clients connected to DRBL server’s ethernet network interface eth0:0 ?

y

OK! Please tell me the file name which contains the MAC address of clients line by line for eth0:0.

macadr-eth0:0.txt

What is the initial number do you want to use in the last set of digits in the IP (i.e. the initial value of d in the IP address a.b.c.d) for DRBL clients connected to this ethernet port eth0:0.

10. This will be the starting IP address of your DHCP range.

The file name you set is “macadr-eth0:0.txt”.
The clients number in this file is 1.
We will set the IP address for the clients connected to DRBL server’s ethernet network interface eth0:0 By the MAC address file you set, the IP addresses for the clients connected to DRBL server’s ethernet network interface eth0:0 as: 192.168.3.10 – 192.168.3.10
Accept?

y

The Layout for your DRBL environment:
******************************************************
NIC NIC IP Clients
+—————————–+
| DRBL SERVER |
| |
| +– [eth0] 192.168.2.201 +- to WAN
| |
| +– [eth0:0] 192.168.3.1 +- to clients group 0:0 [ 1 clients, their IP
| | from 192.168.3.10 – 192.168.3.10]
+—————————–+
******************************************************
Total clients: 1
******************************************************
Press Enter to continue…

In the system, there are 3 modes for diskless linux services:
[0] Full DRBL mode, every client has its own NFS based /etc and /var.
[1] DRBL SSI (Single system image) mode, every client uses tmpfs based /etc and /var. In this mode, the loading and necessary disk space of server will be lighter. NOTE! (a) The client machine memory is recommended at least 256 MB. (b) The setting and config files of client will not be saved to the DRBL server! They are just used once and will vanish after the machine shutdowns! Besides, if you modify any file in the template client (located in /tftpboot/nodes), you have to run /opt/drbl/sbin/gen_ssi_files to create the template tarball in /tftpboot/node_root/drbl_ssi/. (c) If you want to provide some file to overwrite the setting in the template tarball when client boots, check /tftpboot/node_root/drbl_ssi/clients/00_README for more details.
[2] I do NOT want to provide diskless Linux service to client.
Which mode do you prefer ?

2. We didn’t configure any other option above.

In the system, there are 3 modes available for clonezilla:
[0] Full Clonezilla mode, every client has its own NFS based /etc and /var.
[1] Clonezilla box mode, every client uses tmpfs based /etc and /var. In this mode, the loading and necessary disk space of server will be lighter than that in Full Clonezilla mode. Note! In Clonezilla box mode, the setting and config files of client will not be saved to the DRBL server! They just use once and will vanish after the machine shutdowns!
[2] I do NOT want clonezilla.
Which mode do you prefer ?

1

When using clonezilla, which directory in this server you want to store the saved image (Please use absolute path, and do NOT assign it under /mnt/, /media/ or /tmp/) ?
[/home/partimag]

/home/partimag. You should change this to the location wish to store your images.

Do you want to set the pxelinux password for clients so that when client boots, a password must be entered to startup (For better security)

n

Do you want to set the boot prompt for clients ?

n

Do you want to use graphic background for PXE menu when client boots ?
Note! If you use graphical PXELinux menu, however client fails to boot, you can switch to text mode by running “/opt/drbl/sbin/switch-pxe-bg-mode -m text”.

y

Do you want to let DRBL server as a NAT server ? If not, your DRBL client will NOT be able to access Internet.

n

We are now ready to deploy the files to system!
Do you want to continue ?
Warning! If you go on, your firewall rules will be overwritten during the setup!
The original rules will be backuped as iptables.drblsave in system config directory (/etc/sysconfig or /etc/default).

y

After a minute or so you PXE boot environment should be set up automatically.

The last thing you need to do is start the Clonezilla server.

sudo /opt/drbl/sbin/dcs

On the first screen select All.

On the second screen select clonezilla-start

On the third screen select “select-in-client” so you can choose to backup or restore an image on a client by client basis.

On the last two screens you should select the default values provided.

That’s it. Clonezilla is ready to go.

Now we can move over to the client and see if you can boot it using your newly created DRBL environment.

Go into your BIOS settings and set the first boot device to your network card and reboot.
That’s it. Let the client boot and enjoy.