Cloning multiple computers with Clonezilla SE
Attack of the Clones
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
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.