How to setup Clonezilla on Linux (Ubuntu). Quick start guide.
By Mike on Apr 20, 2008 in Featured, How to, Linux
Replace 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.
Popularity: 37% [?]







kgarland | Apr 28, 2008 | Reply
This was extremely helpful, it just plain worked. I was dealing with setting up a few different services and somethings were working. Decided to just scrap it all and install Ubuntu Hardy 8.04 then follow this guide. Bam, worked isntantly.
Tested by backing up and restoring a Windows 2008 Server.
One thing that might be worth noting is the one-liner output from ‘/opt/drbl/sbin/dcs’ which allows you to startup the Clonezilla server can be put into /etc/rc.local or your own /etc/init.d/ startup script.
Thanks for the guide.
admin | Apr 29, 2008 | Reply
Glad I could help.
Thanks for the visit and the comment.
Jason | May 1, 2008 | Reply
Just Wondering, If I want to add another client to the macadr-eth0:0.txt file, do I have to run the setup again, or is there a faster way. Other then that this tutorial was exactly what I was looking for. Thanks, for the good work
admin | May 1, 2008 | Reply
I believe that you have to run the
sudo /opt/drbl/sbin/drblpush -i
command to update the DHCP server with the new mac address.
I guess if you go directly into the DHCP server config then you can just clone the settings to a new entry without having to run through the script again.
Wildly Yang | May 10, 2008 | Reply
This is a great tutorial. I got the server up and running, but am running into a bit of a problem with the client though. Each and everytime it boots from LAN, PXE, I get a Could not locate boot server error message. It hits the server and everything, I can see the server IP on the client and the Zenworks boot.. but after a while it’ll time out with the same error message each time.
admin | May 11, 2008 | Reply
I had that problem once and it turned out that I didn’t select “I do NOT want to provide diskless Linux service to client” in the /opt/drbl/sbin/drblpush setup.
The other thing is this tutorial only works for the clonezilla and free DOS options when you start the server using the dcs command. I stripped out any other linux boot options in the interest of space.
Denis | Jun 7, 2008 | Reply
Hi,
thanks a lot for this tutorial, it’s very helpful !
until I get to this line :
sudo /opt/drbl/sbin/drblsrv-offline -s `uname -r`
what I’m suppose to type ?
my KERNEL_VER is 2.6.24-16-generic
Denis | Jun 8, 2008 | Reply
I solve my problem, only mistyping ‘ for `
grr…
Jason | Jun 23, 2008 | Reply
I really have followed this guide to a tee but unable to get it working. When I boot up the client machine, it goes nuts for a few pages before I get a fatal message. Most of the time it will not get an IP address but now it says successful but then followed by a fatal error: failed to mount root filesystem! I really am going nuts trying to get this to work. Any help greatly appreciated!
zden | Jun 27, 2008 | Reply
Hi… another problem, but I don’t think it’s clonezilla or drbl-related…
I have properly set up a clonezilla server at work… but every time I boot a PC on PXE, it summons a Microsoft RIS login screen. And, to my knowledge, there is no RIS server there. Is Clonezilla overriden when a Microsoft RIS is present ?
Justin | Jul 2, 2008 | Reply
I don’t know much about Linux at all. Is their a guide that can help with the specifics of this? Such as using the sudo command? Thanks.
Tim Harmon | Jul 22, 2008 | Reply
do you need to create a drbl folder in etc? I do not have one in order to edit /etc/drbl/macadr-eth0:0.txt
Thanks Tim
Tim Harmon | Jul 23, 2008 | Reply
I uninstalled DRBL using the /opt/drbl/sbin/drblsrv -u command , did a re-istall and still did not get a DRBL folder in etc. Do I need to create one for the
/macadr-eth0:0.txt? I just do not know if this directory contains othe files. Thanks Tim
admin | Jul 23, 2008 | Reply
If memory serves me there isn’t anything else in that directory. Go ahead and create it.
Tim Harmon | Jul 23, 2008 | Reply
Creating the folder and adding the file macadr-eth0:0.txt did work, I got one client to boot but now have to figure out reverse mapping of clients, Thanks a great tutorial, I am most of the way there now….Tim
Rodrigo | Aug 2, 2008 | Reply
WOW!!, U ARE THE BEST!!. Amazing guide, I used it step by step and works perfectly.
I have something to add, I used a 2960 CISCO Catalyst switch to multicast and had some troubles making it work, for those in the same situation use this:
https://lists.ubuntu.com/archives/ubuntu-us-pa/2008-January/000429.html
it worked for me!!
Erik | Aug 6, 2008 | Reply
Here is the problem i have run into i can run the clonezilla live cd and get images no problem however when i try to use my install of clonezilla on my ubuntu 8.04.1 it does not recognize any of the drivers. I looked at the kernel versions and the version on the live cd i was using is older than the one that i downloaded, is there a fix for that? It also bombs out when i try to deploy an image.
joca | Sep 3, 2008 | Reply
Hello Friend!
Your site are the best! Congratulations!
regards
kai | Oct 15, 2008 | Reply
thx for your great tutorial.
I got the following error when client boots from network
“dhcp……
“PXE: No Boot Filename Received”
Client machine is HP dc 5770 Microtower.
Ubuntu Version is 8.04.
What can I do to fix it?