You're probably familiar with the popular proprietary commercial package Norton Ghost®, and its OpenSource counterpart, Partition Image. The problem with these software packages is that it takes a lot of time to massively clone systems to many computers. You've probably also heard of Symantec's solution to this problem, Symantec Ghost Corporate Edition® with multicasting. Well, now there is an OpenSource clone system (OCS) solution called Clonezilla with unicasting and multicasting!
Clonezilla, based on DRBL, Partition Image, ntfsclone, and udpcast, allows you to do bare metal backup and recovery. Two types of Clonezilla are available, Clonezilla live and Clonezilla server edition. Clonezilla live is suitable for single machine backup and restore. While Clonezilla server edition is for massive deployment, it can clone many (40 plus!) computers simultaneously. Clonezilla saves and restores only used blocks in the harddisk. This increases the clone efficiency. At the NCHC's Classroom C, Clonezilla server edition was used to clone 41 computers simultaneously. It took only about 10 minutes to clone a 5.6 GBytes system image to all 41 computers via multicasting!
Features of Clonezilla
- Free (GPL) Software.
- Filesystem supported: ext2, ext3, reiserfs, xfs, jfs of GNU/Linux, and FAT, NTFS of MS Windows. Therefore you can clone GNU/Linux or MS Windows. For these file systems, only used blocks in partition are saved and restored. For unsupported file system, sector-to-sector copy is done by dd in Clonezilla.
- LVM2 (LVM version 1 is not) under GNU/Linux is supported.
- Multicast is supported in Clonezilla server edition, which is suitable for massively clone. You can also remotely use it to save or restore a bunch of computers if PXE and Wake-on-LAN are supported in your clients.
- Based on Partimage, ntfsclone and dd to clone partition. However, clonezilla, containing some other programs, can save and restore not only partitions, but also a whole disk.
- By using another free software drbl-winroll, which is also developed by us, the hostname, group, and SID of cloned MS Windows machine can be automatically changed.
- Clonezilla Live: Allows you to use CD/DVD or USB flash drive to boot and run clonezilla (Unicast only)
- Clonezilla server edition: A DRBL server must first be set up in order to use Clonezilla to do massively clone (Both unicast and multicast are supported)
This Howto only covers Clonezilla server edition
How to setup a Clonezilla server
A DRBL server must first be set up in order to use Clonezilla to do massively clone.
When setting up the DRBL server, it is recommended to collect the MAC addresses of the client computers and let the DRBL server offer the same IP address for the clients every time it boots. This will keep you from cloning the system to incorrect or unknown clients. Besides, if you do not provide the static IP address to client, different operating systems (like GNU/Linux and MS Windows), they use different DHCP client ID. Therefore even it's the same client, when it boots GNU/Linux via DRBL, it will leases one IP address, then next time when it boots into local MS Windows, it will lease another different IP address. This is annoying sometimes. However, if you are 100% certain that no other computer will be involved in the DRBL environment, and you do not care about the different IP address leasing problem, you can use the range in dhcpd.conf. In this case, you can even use the "impatient method" to setup the DRBL environment.
Diskless Remote Boot in Linux (DRBL)
Setup the Linux Server
Install the GNU/Linux distribution and configure all network cards. In the following, we use "eth0" to connect the Internet, while eth1, eth2, eth3 are for DRBL environment(set the network card's IP addresses to be private IPs (i.e. 192.168.x.x, the following example, we set eth1:192.168.101.254, eth2:192.168.102.254, eth3:192.168.103.254...); Please remember this principle, private IP (e.g. 192.168.x.x) is used for DRBL environment.
nano -w /etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback #Gateway - auto eth0 iface eth0 inet dhcp pre-up iptables-restore < /etc/iptables.rules post-down iptables-save > /etc/iptables.rules #eth1 auto eth1 iface eth1 inet static address 192.168.101.254 network 192.168.101.0 netmask 255.255.255.0 broadcast 192.168.101.255 #eth2 auto eth2 iface eth2 inet static address 192.168.102.254 network 192.168.102.0 netmask 255.255.255.0 broadcast 192.168.102.255 #eth3 auto eth3 iface eth3 inet static address 192.168.103.254 network 192.168.103.0 netmask 255.255.255.0 broadcast 192.168.103.255
sudo /etc/init.d/networking restart
Your firewall rules will be overwritten when setting up the DRBL server. After completing the DRBL setup and successfully testing it, you can config your firewall using your own rules. Remember, in the DRBL environment, NFS, NIS, tftp, and dhcp services are required, so dot NOT block them in your firwall rules.
If you want to get better performance, you can do some tuning as follows. If reiserfs filesystem is available in your GNU/Linux distribution, it is recommended for its better performance compared with ext2/ext3. The current ubuntu (8.04) default setup uses ext3.
After Linux is installed on the server, make sure the hard disk drive DMA mode is on. It will accelerate the access speed of the server's hard disk drive. Use "hdparm /dev/sdx" to check to see if the DMA mode is on or off. If it is off, run "hdparm -d1 -c3 -k1 /dev/sdx" to turn it on. Replace the /dev/sdx to the /dev/sda if your IDE HD for this Linux system is in "Primary IDE."I couldn't get this to work with ubuntu. The result i got was: HDIO_GET_DMA failed: Inappropriate ioctl for device
If you have only one NIC, you may set two IP addresses, i.e. one in eth0 and another alias IP address in eth0:1. eth0 will be used for the DRBL server to connect to the public Internet while eth0:1 will be used for the DRBL environment. NOTE! This alias IP address will cause some problems if you do not provide static IP address to DRBL client via its MAC address. In this example, the DRBL server will lease IP address to any machine connected to eth0 if no MAC address is set in the DHCP service. Hence you'd better not to use alias IP if you do not know exactly what you are doing! Two or more NICs are recommended!
nano -w /etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback #Gateway - auto eth0 iface eth0 inet dhcp pre-up iptables-restore < /etc/iptables.rules post-down iptables-save > /etc/iptables.rules #eth0:1 auto eth0:1 iface eth0:1 inet static address 192.168.100.254 network 192.168.100.0 netmask 255.255.255.0 broadcast 192.168.100.255
Server Setup for clients
Install the program "drbl"
- add the DRBL key to your apt-key
apt-key add GPG-KEY-DRBL
- Edit /etc/apt/sources.list per the following:
nano -w /etc/apt/sources.list
If it's Ubuntu Hardy (8.04):
deb http://free.nchc.org.tw/ubuntu hardy main restricted universe multiverse deb http://free.nchc.org.tw/drbl-core drbl stable
If it's Ubuntu Gutsy (7.10):
deb http://free.nchc.org.tw/ubuntu gutsy main restricted universe multiverse deb http://free.nchc.org.tw/drbl-core drbl stable
If it's Ubuntu Feisty (7.04):
deb http://free.nchc.org.tw/ubuntu feisty main restricted universe multiverse deb http://free.nchc.org.tw/drbl-core drbl stable
If it's Ubuntu Edgy (6.10):
deb http://free.nchc.org.tw/ubuntu edgy main restricted universe multiverse deb http://free.nchc.org.tw/drbl-core drbl stable
If it's Ubuntu Dapper (6.06):
deb http://free.nchc.org.tw/ubuntu dapper main restricted universe multiverse deb http://free.nchc.org.tw/drbl-core drbl stable
If it's Ubuntu Breezy (5.10):
deb http://free.nchc.org.tw/ubuntu breezy main restricted universe multiverse deb http://free.nchc.org.tw/drbl-core drbl stable
Regarding the 1st line in the above, you can use other apt repository for Debian or Ubuntu. The 2nd line, however, is for DRBL-related programs. Do not change this. For alternate sources, go to: http://drbl.sourceforge.net/one4all/
If you want to use the DRBL's testing branch, the 2nd line is:
deb http://free.nchc.org.tw/drbl-core drbl stable testing
If you want to use the unstable branch of DRBL, set the 2nd line as:
deb http://free.nchc.org.tw/drbl-core drbl stable testing unstable
- Execute "apt-get update"
- Execute "apt-get install drbl" to install drbl program.
apt-get install drbl
Server Hardware configuration
If you are impatient, your network bandwidth to Internet is good, you can run "/opt/drbl/sbin/drbl4imp" to finish hardware configuration. "drbl4imp" uses the default values to setup the DRBL server. THIS IS VERY IMPORTANT! The default value might not fit your environment! It uses the "range" option in dhcp server so your DRBL client will not always get the same IP address. It also assumes each of the server's network card (except eth0) provides DRBL services to 12 clients. If you want the setup to fit your environment, please run steps.
Execute "/opt/drbl/sbin/drblsrv -i". Note: There is a space before the "-i". This is the example execution. If you are uncertain, just press Enter to accept the default value.
Set up the file system for the client in the Server
Taking NCHC's computer class room C as an example: There are 40 computers. In order to get DRBL to work more efficiently, we separated them to 4 subnets: 192.168.100.0, 192.168.101.0, 192.168.102.0 and 192.168.103.0. There are four Ethernet cards in DRBL server. One is for WAN and the others are for LAN. The IPs of DRBL environment (LAN) are 192.168.100.254, 192.168.101.254, 192.168.102.254 and 192.168.3.254. The services DHCP, TFTP, NFS, etc will run on eth0:1, eth1, eth2, and eth3.
NIC NIC IP Clients +-----------------------------+ | DRBL SERVER | | | |+-- [eth0] public IP +- to WAN | (ex. 188.8.131.52) | | | |+-- [eth0:1] 192.168.100.254 +- to clients group 1 [ 10 clients, their IP | | from 192.168.100.1 - 192.168.100.10] |+-- [eth1] 192.168.101.254 +- to clients group 1 [ 10 clients, their IP | | from 192.168.101.1 - 192.168.101.10] |+-- [eth2] 192.168.102.254 +- to clients group 2 [ 10 clients, their IP | | from 192.168.102.1 - 192.168.102.10] |+-- [eth3] 192.168.103.254 +- to clients group 3 [ 10 clients, their IP | | from 192.168.103.1 - 192.168.103.10] +-----------------------------+
- There are four modes available from DRBL version 1.6.3 or later:
- Full DRBL,
- Full Clonezilla,
- DRBL SSI (Single System Image)
- Clonezilla Box.
The network bandwidth and disk space requirement are higher in the former two modes, but all the system setting will be saved to server's disk, and every client can have its own individual setting. On the other hand, the DRBL SSI uses single system image for all clients, and the necessary individual settings of clients are created run-time when they boot. This will reduce the required disk space in the server since only one image is necessary. However, the disadvantage is every client can NOT have its own individual system setting (Users' setting will be saved to server). In DRBL SSI mode, once there are extra client nodes want to join DRBL environment, all you have to do is modify the dhcpd config file (dhcpd.conf), then use "/opt/drbl/sbin/dcs -> others -> gen_3N_conf" to create or run "/opt/drbl/sbin/drbl-3n-conf generate", the necessary files will be created. In this mode, theoretically one network card in the server can provide 253 clients. The fourth mode, Clonezilla box mode, is based on DRBL SSI mode, especially for clone system. If you want to use DRBL SSI mode, make sure your client has large memory (say > 512 MB), and all the hardware (especially the graphic card) in the clients are the same. Check this comparison table for these four modes.
/etc, /var of clients
modified files in /etc and /var of client after reboot
extra space in server per client
~ 50 MB
~ 50 MB
max client no per ethernet card in server
- Notes for network switch and NICs when using multiple NICs:
When you use multiple NICs to expand the bandwidth, we recommend you set the MAC addresses so that every node will get the same IP address all the time. (i.e. in the following step 3a, when you run "/opt/drbl/sbin/drblpush -i", it prompts "Do you want to fix the IP address of client connected to eth1 by giving MAC address ? [y/N]", choose "Y"). If you do NOT set MAC address (we will call it "range" from now), and you have only one 48-port network switch (or many switches but connected to be one), and you use four NICs (or more than two...) in DRBL server to expand the network bandwidth, a problem will occur (i.e. some clients will not lease IP from DHCP server) so it will not be able to boot. On the other hand, if your DRBL server uses four NICs to expand the network bandwidth (meaning that four NICs with four private subnets such as 192.168.100.x, 192.168,101,x, 192.168.102.x, 192.168.103.x), and you have exactly four switches that are separated and not connected to each other, then you can use range (i.e. you do not have to set the MAC address of clients). Remember, if you use N NICs to expand network bandwidth in the DRBL server, if using the "range" method, then you must have N switches and they can NOT be connected to each other.
Before executing step <3a>, you can do some customized config:
- If you have some specific directories in this DRBL server to share, such as /work1, then you can use text editor to open file /opt/drbl/conf/drbl.conf, edit the diskless_root_dir_ro_user_add="/work1"(If you want /work1 can only be read by clients, not writable), or diskless_root_dir_rw_user_add="/work1"(If you want /work1 to be readable and writable by clients. (Warning!!! drbl.conf is VERY IMPORTANT, be careful when you edit it!!!)
nano -w /opt/drbl/conf/drbl.conf
diskless_root_dir_ro_user_add="/work1" #read only
diskless_root_dir_rw_user_add="/work1" #read write
- If all the clients have their local harddisk, and the partition is formated (For example, /dev/hda1, its filesystem is ext3), then if you want the client to mount /dev/hda1 as /localwork when booting. Therefore you can edit /opt/drbl/conf/client-append-fstab, and its syntax is just like /etc/fstab. In this example, you can make /opt/drbl/conf/client-append-fstab like this:
nano -w /opt/drbl/conf/client-append-fstab
/dev/hda1 /localwork ext3 defaults 0 0
- (PS: You do not have to create the directory /tftpboot/node_root/localwork in DRBL server manually, later drblpush will do that for you)
- If you have extra services (such as apmd and bluetooth) to be on when client boots, you can edit /opt/drbl/conf/client-extra-service, let service_extra_added="apmd bluetooth".
nano -w /opt/drbl/conf/client-extra-service
- If you want to overwrite some or all automatically created hostnames later by "drblpush -i", you can edit "/opt/drbl/conf/client-ip-hostname" now. Check that file for the format. If some machines are not assigned, drblpush will use those automatically created hostname.
nano -w /opt/drbl/conf/client-ip-hostname
run <Step 3a>"/opt/drbl/sbin/drblpush -i". The software will auto-detect the system to figure out the argument. If the argument is not set up in the system, the system will request you to do that.
Note!!! If newer packages are installed in the server after this step, you have to run "/opt/drbl/sbin/drblpush -i" or "/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf" (This will loaded the previously saved settings) again so that newer packages will be deployed to clients.
/opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
Note!!! It is not recommended to turn on the system update automatically. Since If newer packages are installed in the server automatically, without running "/opt/drbl/sbin/drblpush -i", the programs for client might not be compatible with that newer in server. If you want to turn on system update automatically, remember to follow the above step to update the files in client automatically.
Setting up clients to use the DRBL environment
- o There are four different scenarios where you can make clients boot from network:
- the client has PXE network interface card,
- the client has a floppy drive,
- the client has a CDROM,
- the client has a local hard drive.
We use etherboot 5.4.3 as an example for cases 2-4. NOTE! With DRBL version 1.3.9 or later, if you want to use Etherboot, Etherboot version 5.4.0 or newer is required.
The client has a PXE network interface card
- Set the client's BIOS to boot from "LAN" or "network".
- Take one of the Asus motherboards for example, in this manual file.
- Usually you have to reboot it now, make the function re-read by BIOS.
- After rebooting, enter BIOS setting again, this time, in Page 4-35, you have to make LAN boot as the 1st boot device.
- That's it. Let client boot and enjoy DRBL!!!
The client has a floppy drive.
<Step 4a> Get the image file first.
- Use the "universal" image /opt/drbl-etherboot/etherboot-net.zdsk in the DRBL server. It supports most modern network cards. (Ref: here. If this universal image fails, try using specific image for client's network card, the image file is located in /opt/drbl-etherboot/. As an example, if you have a Realtek 8139 network card, use the image /opt/drbl-etherboot/rtl8139.zdsk.
<Step 4b> Insert the floppy to floppy drive in DRBL server
Run "cat /opt/drbl-etherboot/etherboot-net.zdsk > /dev/fd0" in the DRBL server.
cat /opt/drbl-etherboot/etherboot-net.zdsk > /dev/fd0
<Step 4c> Put this floppy to client's floppy drive, make sure the floppy is the first boot device in the client's BIOS. If everything was done correctly, after a few minutes, the clients will be waiting for you to login, All the accounts are same as the ones in server.
Client has a CDROM (Reference):
- 1. The "universal" image is located in /opt/drbl-etherboot/etherboot-net.iso
- Burn the ISO to a CD:
cdrecord -v speed=12 fs=16m dev=0,0,0 -data etherboot-net.iso
(If necessary, modify "dev=0,0,0", run "cdrecord -scanbus" to get your CD burner.)
- Ensure the PC is set to boot from CDROM, place the burned CD in the drive, and reboot. Done!
client has a local hard drive
- If the client has a local hard drive which is installed with the bootloader grub in GNU/Linux:
- Copy the file "/opt/drbl-etherboot/etherboot-net.zlilo" to client's directory "/boot/" in its harddisk
- Append one block in the client's /boot/grub/menu.lst or /boot/grub/grub.conf (depends on your distribution) like this:
title Etherboot-PXE kernel /boot/etherboot-net.zlilo
- Change the default boot to the corresponding one above, like "default 1", in menu.lst or grub.conf in client.
- If the client is running Microsoft Windows XP/2K on its hard disk:
You can install WINGRUB. Put the file etherboot-net.zlilo in C:\, and the files: C:\boot.ini and C:\GRUB\MENU.LST look like: (This method is only suitable for installing wingrub in BOOT.INI (Tool -> Install grub -> Boot from BOOT.INI). If necessary, you can use other modes provides by WinGRUB):
boot.ini: [boot loader] timeout=30 default=C:\GRLDR [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect C:\GRLDR="Etherboot" [ MENU.LST: [ timeout 7 title etherboot root (hd0,0) kernel /etherboot-net.zlilo title Windows at (hd0,0) root (hd0,0) chainloader +1 [
- If the client has local hard drive which is installed with Microsoft Windows 9x:
- Copy the file "/opt/drbl-etherboot/etherboot-net.com" to client's hard disk
- Rename it so that it is shorter in client, for example, "eb-net.com".
- Write a multi-boot config file in the client (e.g. add one paragraph to run "eb-net.com").
How to use Clonezilla server edition
As root, run "/opt/drbl/sbin/dcs" in DRBL server to switch clients' mode. You will see two menus: clonezilla-start and clonezilla-stop like this:
- Check clonezilla-start by "space" key, various modes will be shown:
- clonezilla-save-disk: clonezilla save disk mode
- clonezilla-restore-disk: clonezilla restore disk mode
- clonezilla-save-parts: clonezilla save partitions mode
- clonezilla-restore-parts: clonezilla restore partitions mode
- clonezilla mode
Again, check the mode you want by "space" key, then follow the menus to do it. Once the mode in DRBL server is ready, you can boot your clients via PXE to save or restore the image.
To stop clonezilla: As root, run "/opt/drbl/sbin/dcs", then choose "Clonezilla-stop". Or you can use "/opt/drbl/sbin/drbl-ocs stop".
- The following is an example of how to save an image from a single computer (called computer M) and then restore it to 39 computers in a 40-computer classroom:
- o Set the Clonezilla server to be clonezilla-save-disk mode: In the Clonezilla server,
- run "/opt/drbl/sbin/dcs", then choose "clonezilla-start" (use the space key to mark it). Next, choose"clonezilla-save-disk" (use space key to mark it)
o When computer M finishes the network boot, if you do not enter image and device name when running /opt/drbl/sbin/dcs -> clonezilla-start -> clonezilla-save-disk, a prompt will ask you to name the image and choose the device. Now enter the name (e.g. nomorems) and then choose the disk you want to save it to. Otherwise, it will use the image and device name you already inputted in the clonezilla server to save the image. o Once the image is saved, set the mode to be clonezilla-restore-disk in the Clonezilla server. As an example, in the Clonezilla server,
- run "/opt/drbl/sbin/dcs". Next, choose "clonezilla-start" (use space key to mark it). Next, choose "clonezilla-restore-disk" (use space key to mark it).
- o Set the Clonezilla server to be clonezilla-save-disk mode: In the Clonezilla server,
The program will ask you which source image to restore. In this example, we chose the image "nomorems."
- o Make sure the clients (i.e. the computers to be cloned) will boot from the network (PXE or etherboot) then turn on the clients to let them boot from network. o The clients will begin to clone the system image "nomorems" to their harddisks.
o Once all clients finish cloning, you can stop clonezilla by /opt/drbl/sbin/dcs -> clonezilla-stop.
# More examples are available here. http://www.clonezilla.org/related_article/
# PS: You can refer to DRBl-winroll to make the restored (cloned) MS Windows with a different hostname automatically. http://drbl-winroll.sourceforge.net/
- Steven Shiau (steven _at_ nchc org tw)
- K. L. Huang (klhaung _at_ gmail com)
- H. T. Wang (c00wht00 _at_ nchc org tw)
- Ceasar Sun (ceasar _at_ nchc org tw)
- Jazz Wang (jazz _at_ nchc org tw)
- Thomas Tsai (thomas _at_ nchc org tw)