Cloning multiple computers with Clonezilla SE
Attack of the Clones

© Lead Image © Csaba Deli, 123RF.com
Managing a network of computers can be an involved process. Clonezilla SE lets you image and roll out multiple machines with ease.
Peace of mind is not measured in gigabytes, but it might as well be, because nothing causes a sys admin more turmoil, pain, and anguish than a dead disk. Clonezilla (see the "What Is Clonezilla?" box) has been coming to the aid of harried sys admins for almost two decades to help them duplicate entire disks, including all the data and partitions, with relative ease.
What Is Clonezilla?
Clonezilla [1] is an ncurses-based front end to a set of scripts that use several open source disk utilities such as Partimage, ntfsclone
, Partclone, and dd
. You can use Clonezilla to duplicate particular partitions and even entire disks. It will also restore partitions and help you mirror an old disk onto a bigger new disk.
Clonezilla supports a whole battalion of filesystems and then some. It can work its magic on partitions formatted as ext3, ext4, ReiserFS, XFS, JFS, FAT, NTFS, HFS+, and more. If Clonezilla encounters a partition type it doesn't understand, it will simply fire up the venerable dd
utility and still get the job done.
You also get options to compress the cloned images using either the gzip, bzip2, or LZO compression algorithms. You can keep them on a locally attached device (such as a USB disk attached to the computer), on another computer via the network, or even on the cloud.
Clonezilla is a weapon of mass cloning. If your computer empire extends only to a couple of computers, you'll be happy using Clonezilla through its Live environment. On the other hand, if you manage a small school or an office, you should install Clonezilla Server Edition (SE) [2] to clone and restore machines over the network.
To use a cloning solution effectively, it's best if the computers on your network have similar hardware components. If your network is made up of computers with different components, you will need to manage lots of different images.
For smaller networks, you can create a master image, copy it on to a removable USB disk, and deploy from that. On bigger networks, where you have a large number of computers to deploy, it's more efficient to deploy the image over the network, which requires setting up a dedicated cloning server. With Clonezilla SE, this means setting up a Diskless Remote Boot in Linux (DRBL) server that you can install on top of Debian or CentOS servers [3]. If you don't want to earmark a computer as a permanent DRBL server, you can use the DRBL Live CD [4] to convert any machine into a server to broadcast images created by Clonezilla to any computer on the network.
The DRBL Live CD is available both as an ISO that you can burn to a CD and as a compressed IMG file that you can transfer on to a USB disk either using dd
or via a graphical tool like UNetbootin.
In this tutorial, I'll use Clonezilla SE to create a master image from one machine on my network (see the "Test Lab" box), store it on the file server, and then automatically deploy it to multiple machines.
Test Lab
As shown in Figure 1, I have repurposed the computer that is usually used as a gateway server to act as the Live DRBL server. This machine has two network cards: eth0 and eth1. One of the network cards (eth0) is connected to the ISP router and is assigned an IP address by the router via DHCP. The other (eth1) is connected to a network switch. During the setup, I'll assign the DRBL server a static IP address (192.168.1.100).
All the other computers in the network are also connected to this network switch. My DRBL server will automatically assign them IP addresses. One of these computers on the internal network is a file server. Unlike the other machines, this file server has a static IP address (192.168.1.200). I've installed the openssh-server package on this computer, and all other computers in the network can SSH into this computer. I'll use it as the imaging repository that houses all the cloned images.
Configuring the Server
The first step is to create an image of the computer. Head to the computer that will act as your Live DRBL server and boot into the Live environment. Once the graphical environment is up, double-click the Clonezilla server icon on the desktop to initiate the process of configuring the server.
You'll now be prompted for some information to help get the DRBL server up and running.
First, Clonezilla will ask you for the network adapters' network configuration. In my test lab, one of the adapters gets an IP address assigned by the DHCP server running on the Internet router, while the second adapter connects to the LAN switch. You should assign this a static IP address (192.168.1.100 in my test) when prompted.
The next important step is to point the server to the location where the cloned images will be housed (Figure 2). This could be anything from a local disk, to a network location, or even a cloud drive.

For the test lab, I will select the ssh_server option and provide the necessary credentials for the DRBL server to connect to the network share (192.168.1.200 in the test) via SSH. After establishing the connection, the DRBL server will display the remote machine's disk usage (Figure 3). Then the server will work its magic and set itself up.

Once the server is done, you'll be asked whether you want to exercise control over all the computers or particular ones. In testing Clonezilla SE, it's a good idea to select the All option. Once you've mastered the process, you can select the second option that allows you to mark specific computers on your network for the cloning process. There's no inherent harm with the first option; the second option just gives you more control over the process.
Similarly, in the next screen select the Beginner option to ask Clonezilla to select the default option for as many parameters as possible. Once you're more comfortable with the process, you can take charge by selecting the Expert option, which allows you to customize the settings for various parameters.
Cloning Mode
You'll next have to select the mode for the Clonezilla instance. Since I am creating a master image, I'll choose the save-disk option to image an entire disk. When asked to enter the name of the device and the image, I suggest using the Later_in_client option. Thanks to this option, you'll be prompted to select the disk you want to clone later on while you're on the client.
Clonezilla will then ask you whether you'd like to use fsck
to check and repair the filesystem before initiating the cloning process. It's always a good idea to make sure the filesystem is in a consistent state before creating the image, so choose the -fsck option. If you're pressed for time and you know the filesystem is good, you can choose to skip the check.
Similarly, after creating the disk's image, Clonezilla can also check the disk to make sure it's restorable. Again, you can save some time by electing to skip this check, but I'd suggest you allow Clonezilla to make sure the image is restorable.
The penultimate step is to select the client action after it has been imaged. This is purely based on your preference; I usually select the poweroff option to shut down the client after its disk has been imaged.
Finally, you'll be asked if you'd like to break up the cloned image into smaller files for easier transportation. The figure is in megabytes, and it's usually a good idea to go with the default value (2000MB). If you don't want to split the image, Clonezilla suggests you replace the default value with a large number that's greater than the size of your disk, such as 1000000MB. However, remember that if the image repository has a FAT32 filesystem, this value cannot be larger than 4096MB since FAT32 can't read files that are larger than 4GB in size.
The server is now ready. You'll be returned to the prompt, but don't close the terminal window just yet. Now head over to the computer that you want to clone.
Preparing for Cloning
Make sure that the computer you want to clone is set to boot from the network. You'll need to head into the BIOS to change the default boot order; the exact process varies from one manufacturer to another.
Once you boot the computer after making the change, it'll pick up the DRBL server instance running over the network. You'll be shown a Clonezilla GRUB menu with a few entries. Select the default Clonezilla: save disk (choose later) as image (choose later) option (Figure 4). This entry is for the cloning task you've just set up in the previous step. The (choose later) is displayed because you deferred the decision to select the disk you wish to clone.
When the computer has booted, you'll be asked for the image's name. Go with the default option or customize it per your preference. Next select the hard disk you want to clone. If the computer has multiple disks, use the space bar to pick the one you want to image. It will then run fsck
on the disk before initiating the cloning process.
The image will now be created and transferred to the file server via SSH (Figure 5). Once that's done, the DRBL server is notified and the client is powered off as instructed in the previous step. You now have an image that you can clone to all the other computers in your network.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.
News
-
The GNU Project Celebrates Its 40th Birthday
September 27 marks the 40th anniversary of the GNU Project, and it was celebrated with a hacker meeting in Biel/Bienne, Switzerland.
-
Linux Kernel Reducing Long-Term Support
LTS support for the Linux kernel is about to undergo some serious changes that will have a considerable impact on the future.
-
Fedora 39 Beta Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.
-
UbuntuDDE 23.04 Now Available
A new version of the UbuntuDDE remix has finally arrived with all the updates from the Deepin desktop and everything that comes with the Ubuntu 23.04 base.