Cloning Linux Systems With CloneZilla Server Edition (CloneZilla SE)
Cloning Linux Systems With CloneZilla Server Edition (CloneZilla SE)
By Falko Timme
Published: 2009-01-20 20:39
This tutorial shows how you can clone Linux systems with CloneZilla SE. This is useful for copying one Linux installation to multiple computers without
losing much time, e.g. in a classroom, or also for creating an image-based backup of a system. I will install CloneZilla SE on a Debian Etch server in this
tutorial. The systems that you want to clone can use whatever Linux distribution you prefer.
I do not issue any guarantee that this will work for you!
1 Preliminary Note
The Debian server on which I want to install CloneZilla SE is in the local network 192.168.0.0 (netmask 255.255.255.0) and has the IP address
192.168.0.100.
To clone a system, the target systems should use the same or at least similar hardware, otherwise cloning might not work!
2 Installing CloneZilla SE
First we import the GPG key of the DRBL (Diskless Remote Boot in Linux, needed to boot the client systems from the network (PXE) later on) and
CloneZilla repository:
vi /etc/apt/sources.list
[...]
deb http://drbl.sourceforge.net/drbl-core drbl stable
[...]
Run
apt-get update
afterwards.
Then we run
/opt/drbl/sbin/drbl4imp
to configure DRBL and CloneZilla with default values (should work in most environments):
*****************************************************.
This script is for those impatient, it will setup the DRBL server by the default value which might not fit your
environment. Are you impatient ?
*****************************************************.
Ok, Laziness is a virtue! Let us setup DRBL server with the default values!!!
Press "Enter" to continue... <-- ENTER
[...]
*****************************************************.
If you like, you can reboot the DRBL server now to make sure everything is ready...(This is not necessary, just an
option.).
*****************************************************.
DRBL server is ready! Now set the client machines to boot from PXE or Etherboot (refer to http://drbl.sourceforge.net for
more details).
NOTE! If Etherboot is used in client machine, version 5.4.0 or newer is required!
PS. The config file is saved as /etc/drbl/drblpush.conf. Therefore if you want to run drblpush with the same config again,
you may run it as: /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
server1:~#
Run
/opt/drbl/sbin/dcs
Select Later_in_client Later input image and device name in client (you will then be prompted for an image name later on the client, instead
of having to provide an image name now):
On the next two screens you can simply press ENTER to select the default values:
Select the action when the client finishes cloning (I want to shut down the client after the image has been created, so I select -p poweroff):
Press ENTER again on the next two screens to accept the default values:
The server is now ready. Now start the client system that you want to clone. It is important that you boot it from the network (via PXE) - you might have to
adjust the boot order in the client's BIOS so that it boots via PXE:
After you've configured the client to boot from the network, you should see a DRBL boot menu. Select Clonezilla: save disk (choose later) as
image (choose later):
Next provide a name for the image (or accept the default value):
Afterwards, the image is being created and transferred to the CloneZilla server:
Then the CloneZilla server is notified that the image creation process has finished...
... and the client system is shut down (or rebooted - that depends on the action you've chosen on the server):
That's it, we now have an image of our Linux system that we can clone to other systems.
/opt/drbl/sbin/dcs
You can accept the default values on the next four screens by pressing ENTER:
Choose clients+time-to-wait:
Fill in the number of systems on which you want to restore the image (I want to restore just one system in this example):
Fill in the max. time (in seconds) that the server will wait until all clients are powered on (i.e., if you want to restore the image on ten clients, you have 300 seconds to
power on the other nine computers after you have powered on the first one - if you are too slow, CloneZilla will start to restore the image only on the systems that have
been powered on in time):
Now power on the clients. Make sure they are configured to boot from the network (via PXE):
Afterwards, the server will be notified that the process has finished...
Before the client system boots, enter its BIOS again and configure it to boot from the hard drive!
If all goes well, the computer should boot into the cloned operating system.
5 Troubleshooting
It is possible that you see this message during the restore:
Grub
error 2
The solution is to boot into a rescue system (e.g. Knoppix or the Ubuntu Live-CD) and install GRUB from the rescue system.
Once Knoppix or the Ubuntu Live system has started, open a terminal and become root:
Knoppix:
su
Ubuntu:
sudo su
Run
fdisk -l
root@Knoppix:~# fdisk -l
In this example, I have one big partition (/dev/sda1) that also contains the /boot directory (the Boot column is marked with a star).
(If you have a separate /boot partition, e.g. /dev/sda2, you'd mount it to /mnt/boot after you have mounted /dev/sda1 to /mnt.)
Probing devices to guess BIOS drives. This may take a long time.
Installing GRUB to (hd0) as (hd0)...
Installation finished. No error reported.
This is the contents of the device map //boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0) /dev/sda
root@Knoppix:~#
reboot
... and don't forget to remove the Knoppix or Ubuntu CD from the CD drive. If everything goes well, the GRUB error should be gone, and the system
should boot without any problems.
6 Links
- CloneZilla SE: http://clonezilla.org/clonezilla-server-edition/
- Debian: http://www.debian.org/