Share this post
FaceBook  Twitter  
Contents[Hide]

1. Introduction and concepts

Every system administrator I know develops in time the habit of putting together a toolbox where, as time passes, many useful pieces of software get added up, as the recurrent need arises. Please do not imagine this in the most classical of the sense, as this is not about a carpenter's toolkit, nor a mechanic's toolbox. It usually is a CD portfolio with live CDs, installable most-used distributions, vendor-specific tools and whatever not. Of the (indispensable) live CDs, one usually sees in the aforementioned toolbox a disk cloning item. What does it do? It helps a tremendous amount when you need to save and restore a hard disk, operating system included, and by save I mean 1/1 copy with the possibility of restoring in a few minutes, despite the ever-increasing size of the hard drives offered by the market today, where the terabyte becomes more and more common.

Such software exists, and indeed it makes the lives of admins and users alike much easier and efficient. Unfortunately, companies tried to impose their own proprietary disk image formats, so that restoring could be possible only by using their tools. Fortunately, there is a FOSS solution that deals with this, offering a very efficient live CD and server for download, and that is Clonezilla, which we'll talk about today. You are expected to have some knowledge on how disks work, networking and system administration. We will treat more advanced subjects a bit later on, but all you need to know if you are a beginner in those matters is right here.

First we should take care of some concepts, essential for your subsequent understanding of this topic. Cloning software can be used in more complex scenarios than just creating an image of a disk or a partition. One can set up a server that can be used for booting the machines to be cloned via PXE, run a imaging script automatically then shutdown the imaged machine. This can be useful also when you need to restore such a image to several machines, when such as server can prove to be an invaluable time-saver. Imagine you just bought 40 identical machines to replace the old ones in the accounting department and you already contemplate the specter of installing the same thing over and over again. Instead, you can create an image of one of the old and deploy it on all the 40 machines simultaneously, by connecting them to the PXE/clone server at the same time. I hope you are already convinced, so let's see how to do this in practice with Clonezilla.

2. Getting and using Clonezilla

We will start with using the live CD offered by the Clonezilla project, and after that we will go on to more advanced topics, like using the related DRBL (Diskless Remote Boot in Linux), which basically refers to the server part we spoke about earlier. Just go to the download page and get the ISO image that's appropriate to your machine, write it to CD or USB or just test it in a virtual environment and you're good to go. We will start with a simple scenario, where you use disk-to-disk cloning. The disk you are cloning to can be an external drive or another internal one, be it IDE, SATA or SCSI. Boot the live CD as you see below, with the default GRUB option, and you should see Debian booting, as it's the base for Clonezilla. Select your language and keymap, then select "Start Clonezilla" and afterward the device-to-device option. If you don't need (or don't know how) to alter CHS settings or other advanced topics, just go with beginner mode and disk-to-local-disk (as opposed to remote, which means, for example, NFS). Choose the source and destination disks, all from easy to use menus, and voila! A word of warning though : you might just want to set up a minimal two-disk virtual machine as practice box before dealing with production data, and of course, you do have backups, right? Also make doubly sure that the destination drive is void of any important data, because you wouldn't want to overwrite that.

While this is a simple way of using Clonezilla, what we are really trying to get at is how to really use it in order to make the best use of its capabilities. And that means using it as a distributed server to install many systems at once, using a pre-existing image. Please note that the hardware and networking gear needs rise exponentially depending on the number of simultaneous connections. If you are really serious, upgrading to Gigabit Ethernet equipment and investing in powerful hardware is recommended. Please excuse our brevity regarding the first part, but that is because we don't want to become boring with things that are simple enough anyway, given Clonezilla's easy to use menus.

2.1. Getting and/or installing DRBL

Now, let's see how to really put this distribution to work. As you can see from the subtitle, DRBL can be run as a live environment and set it up in-place, or you can install it. There is one problem with this though, as the authors warn us that there is a limited number of distributions/versions the installation will succeed on. The hardware requirements list is modest, but please remember our warning regarding hardware: the more clients, the bigger the hardware needs. In our example, we will use, say, Fedora for a machine that will serve 3 clients. Alter your settings accordingly if your needs are different, and they probably will be. Our first interface, eth0, will be our link to the Internet, while the other three NICs will have addresses of the form: eth1 -- 192.168.101.x, eth2 -- 192.168.102.x and so on. The greatest advantage for this approach is that you can later add more and more machines as clients in every subnet. Be careful of your firewall settings and, being a Fedora machine, take care of SELinux, either by turning it off entirely or by altering the settings. Install the rpm file, easy to download from the download page and that's about it!

2.2. Setting up DRBL

Now, here is the timeline where you have to think about what exactly you want. The software you just installed offers you multiple opportunities, depending on your needs. The one we have spoken about in the introduction, the one image --> lots of clients scenario, can be best taken care of with DRBL SSI (Single System Image). Needless to say, make sure the clients' hardware is (almost) identical. On the other hand, you are given as much flexibility as you need, with different images and settings for each client. We really cannot offer advice for every possible scenario you might need, because there are so many of them. Nevertheless, a few pointers might prove useful to you. The pointer we issued earlier, regarding your firewall, also presume that you are aware of the fact that PXE booting is about a tftp server, a DHCP server and a NFS server at a bare minimum, usually with a Web server tossed in there as well. Second, it's recommended that the setup steps we are about to give you are done directly from the server (e.g. as opposed to ssh login or whatnot). There are two main scripts (interactive, I might add, so not many text files to edit) that you will have to execute, like so:

# drblsrv -i 
# drblpush -i 
//step-by-step walking of diskless client setup
//after that, run
# /opt/drbl/sbin/dcs 
//..and choose Clonezilla start

Because of space limitations, we will refer only to the PXE boot case of client booting, so you are expected to have NICs in the client machines with network boot capabilities, and firmware (BIOS, PALO....) as capable as the network cards, but nowadays that's usually a given.

3. Conclusion

The uses of such a boot and install server extend far wider than the small enterprise environment. I have, for example, a bunch of old x86 machines that I got from a friend and decided to use them, but they had no CD-ROM, just a floppy drive, and I had no floppy drive on my box to write an image. Nor, of course, did I have floppy disks. Clonezilla saved me, because it was way faster and more error-free. Check it out, you will like it.

Partners

Who are we?

LinuxCareer.com is not affiliated with any local or international company, nor is it a recruitment or employment agency. We specialise in Linux based careers and closely related Information Technology fields by providing careers advice and latest employment opportunities.

JOIN LINUXCAREER

You can also get involved in the LinuxCareer project by participating on our FORUM or SUBMITTING A LINUX ARTICLE. We offer a range of privileges to our authors and good company.