Linux installation in 2012 is pretty simple – answer a few questions, then click Start and wait. But what if you could eliminate a lot of the waiting? That's the promise of Clonezilla Server Edition, which can help you install servers with less effort, and the same, or better, results.
Clonezilla is GPL-licensed software that allows you to do bare-metal backup and recovery, or just use an image previously saved to clone it on other computers. Two types of Clonezilla are available: Clonezilla Live and Clonezilla Server Edition. The live CD is suitable for single-machine backup and restore. Clonezilla SE lets you clone or install many computers simultaneously. It saves and restores only used blocks on the hard disk, which increases cloning efficiency.
In this article I'll show you how to set up Clonezilla SE on a CentOS 6.2 server and start cloning a server.
The first step of the installation process is to prepare your source server to be a DRBL (Diskless Remote Boot in Linux) server. DRBL is a open source solution for managing the deployment of GNU/Linux across many clients, and is required by Clonezilla. You can download the latest version of the DRBL package, then install as root with the command:
# rpm -ivh drbl-1.10.31-1drbl.i386.rpm
Note: Most distributions will install the necessary package perl-Digest-SHA1 with Clonezilla by default. If yours doesn't, install it manually with the command yum install perl-Digest-SHA1.
yum install perl-Digest-SHA1
Next, start the wizard to set up DRBL. From a terminal run (as root) /opt/drbl/sbin/drblsrv -i. It asks if you want to install other Linux images, as below. I'll choose N:
Do you want to install the network installation boot images so that you can let the client computer install some GNU/Linux distributions (Debian, Ubuntu, RedHat Linux, Fedora Core, Mandriva, CentOS and OpenSuSE…) via a network connection? !!NOTE!! This will download a lot of files (Typically > 100 MB) so it might take a few minutes. If the client computer has a hard drive that you may install GNU/Linux onto, put a Y here. If you answer “no” here, you can run “drbl-netinstall” to install them later.[y/N] N
Choose N again when asked if you want to setup a serial console instead of a GUI. Next, choose which architecture you want to install. Choose 1 to install i586 CPU architecture.
Which CPU architecture kernel do you want to assign for the DRBL client computer(s)?0 -> i386 CPU architecture1 -> i586 CPU architecture2 -> Use the same architecture as this DRBL serverNote! Note Note! Note! Note! Note! Note!NOTE!!! If the client computer(s) is not the same architecture as this server, please pick "0" or "1", otherwise your client computer(s) will NOT be able to boot.If you use wrong architecture type kernel, the glibc and openssl package might use i686 or i386 while the kernel might use i686, i586, or i386, which might be not suitable for all your computer(s). 1
Finally, Clonezilla asks whether you want to run a system update of your system. It then installs all the packages it needs.
Once DRBL is in place, you can start configuring Clonezilla with the command:
sudo /opt/drbl/sbin/drblpush -i
Another wizard will start, asking for information on your domain name, whether you use NIS/YP, and a prefix for your hostname. It will ask you information for setting up a DHCP server. If you get a message telling you that your Clonezilla IP interface (eth0:0) is on a class A or B network, make sure you change it to a class C (e.g. 192.168.x.x) and start Clonezilla's configuration over; if you don't, multicasting effectiveness will be greatly reduced. This can be an issue if you plan to install more than, say, half a dozen computers at the same time.
The wizard asks if you want to collect MAC addresses of computers to be cloned, so that only those computers get assigned an IP address from DRBL. This operation is time-consuming and unnecessary, since it is easier to turn DRBL off once you are done cloning so that it does not conflict with your network's DHCP server. Choose N unless you plan to use DRBL as your only DHCP server.
Once that the wizard has finished to setup your network it will show you a "graphical" output of your setup, something like this:
The Layout for your DRBL environment:****************************************************** NIC NIC IP Clients+-----------------------------+| DRBL SERVER || || +-- [eth0] 192.168.120.172 +- to WAN| || +-- [eth1] 192.168.201.254 +- to clients group 1 [ 3 clients, their IP| | from 192.168.201.1 - 192.168.201.3]+-----------------------------+
It then asks you to choose options to finish the setup. The first question asks whether you want to have a full DRBL server. We just want to clone servers, so we'll choose option number 2.
In the system, there are 3 modes for diskless linux services: Full DRBL mode, every client has its own NFS based /etc and /var. 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/drbl-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. I do NOT want to provide diskless Linux service to client.Which mode do you prefer? 2
The next question asks if you want to have some filesystems to be cloned (usually /var and /etc) in a temporary filesystem in RAM for a faster cloning process, or have all the filesystems saved on disks. For long-term storage of images choose 0; if you just have to clone a high number of computer quickly, choose 1.
In the system, there are 4 modes available for clonezilla: Full Clonezilla mode, every client has its own NFS based /etc and /var. 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! I do NOT want clonezilla. Use Clonezilla live as the OS (Operating System) of clients (Testing).Which mode do you prefer? 0
Next, the wizard asks what will be the default directory where you store your images. Usually this will be a big filesystem. I don't like to keep anything in the filesystem /home, so I suggest specifying something else, such as /images. The filesystem must exist and be mounted in the mount point you specify:
The CPU arch for clients when running Clonezilla job: i586------------------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] /images
Next come a series of yes or no questions. Do you want a password to protect PXE boot? Since this protocol usually runs on a local private network, you can safely say N here. You can also choose N for the next question; we want to clone our clients quickly, so it's better if they don't have a boot prompt. You can choose to display a graphical background for PXE; I prefer text, since it has usually less problems. Finally, specify whether you want to use the Clonezilla server as a NAT server. Depending on your network configuration, this can be a useful option, but in my opinion it's not a good idea to have the server with all your images act as the router for Internet access. Clonezilla then asks you if you're ready to deploy the files, and when you say yes, it completes the process.
Once everything is installed and configured, start the Clonezilla service from a terminal as root with the command sudo /opt/drbl/sbin/dcs. You'll be able to select the operation that will be run on each client when it boots; Clonezilla calls this clients' mode. You will see two choices that are useful for our Clonezilla SE on the DRBL menu: clonezilla-start and clonezilla-stop:
Move down the menu with the arrow keys and select clonezilla-start with the space key. A new submenu will appear, displaying available modes:
Choose the mode you want with the space key, then follow the menus to run it. Once the mode in the DRBL server is ready, you can boot your clients via PXE to save or restore an image. You target machine does not need the same size disk as the one on which you generated your image; Clonezilla can resize the filesystem.
If you have finished your work, stop Clonezilla by running /opt/drbl/sbin/dcs as root again and choose "clonezilla-stop," or run /opt/drbl/sbin/drbl-ocs stop.
Once you have Clonezilla Server Edition available, you can boot clients on your network in PXE mode and get them installed automatically with an image of your choice. The project's site includes plenty of reference and resource material to inspire you.
Allowed tags: <a> link, <b> bold, <i> italics