Clonezilla is a free, open source disk imaging tool that boots from its own live media and copies only the used blocks of each partition. Because the server is offline while Clonezilla runs, the image is always consistent: no open database files, no half-written logs. In this tutorial you will prepare an SSH image repository on Ubuntu 24.04, save a full disk image of a Linux server to it, restore that image onto another machine, and fix the settings that must be unique on every clone.

Prerequisites

To follow this guide you need:

  • A source server to clone. Clonezilla must boot from its own media, so this workflow fits dedicated and bare-metal servers you can boot from a USB drive or from an ISO mounted through the BMC/IPMI virtual media console. For a virtual server, your provider's snapshot feature is usually the simpler tool.
  • A target server with a disk at least as large as the used portion of the source disk (the same size or larger is simplest).
  • An image repository: a server running Ubuntu 24.04 with SSH access, a non-root sudo user and enough free space for the compressed image (plan for roughly 50-70% of the used space on the source).
  • Network connectivity between the source/target servers and the image repository on TCP port 22.
  • A maintenance window: the source server is powered off while the image is taken.

Step 1 - Preparing the image repository

Clonezilla mounts a remote directory over SSH (sshfs) and writes the image files there. Create a dedicated user and directory on the repository server so the images are isolated from the rest of the system:

sudo adduser --disabled-password --gecos "" clonezilla
sudo passwd clonezilla

Clonezilla Live asks for the password interactively, so set a strong one when prompted. Now create the image directory:

sudo install -d -o clonezilla -g clonezilla -m 0750 /srv/clonezilla

If UFW is enabled, allow SSH only from the network where the servers being cloned live. Replace your_server_network with that subnet, for example 10.0.0.0/24:

sudo ufw allow from your_server_network to any port 22 proto tcp

Check that the directory exists with the right owner and that there is room for the image:

ls -ld /srv/clonezilla
df -h /srv
drwxr-x--- 2 clonezilla clonezilla 4096 Sep 25 10:02 /srv/clonezilla
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       916G   41G  829G   5% /

Step 2 - Downloading and verifying Clonezilla Live

Download the current stable Clonezilla Live ISO for amd64 from the official page at https://clonezilla.org/downloads.php. On the same page you will find the SHA256 checksums for each release. After downloading, compute the checksum of your file:

sha256sum clonezilla-live-*-amd64.iso
3c1f0c5b2f...e91d  clonezilla-live-3.2.2-15-amd64.iso

Compare the value with the one published for that exact file name. If it differs, download the ISO again.

Step 3 - Creating the boot media

If you will boot the source server through the BMC/IPMI virtual media console, mount the ISO there and skip to the next step. To boot from a USB drive instead, write the ISO to it from a Linux workstation. First identify the USB device:

lsblk -d -o NAME,SIZE,MODEL,TRAN
NAME   SIZE MODEL              TRAN
nvme0n1 476.9G Samsung SSD 980 nvme
sdb     28.7G  SanDisk Ultra   usb

Write the image to the whole device (here /dev/sdb, not a partition like /dev/sdb1):

sudo dd if=clonezilla-live-3.2.2-15-amd64.iso of=/dev/sdb bs=4M status=progress conv=fsync

When the command returns, the drive is ready. On macOS or Windows, a graphical tool such as balenaEtcher or Rufus (in DD mode) produces the same result.

Step 4 - Preparing the source server

Clonezilla copies the disk as it is, so clean up before you power off. Remove large temporary files you do not want in the image and note the current network configuration, because you will need to change it on the clone:

ip -br addr
cat /etc/netplan/*.yaml

Clonezilla supports ext2/3/4, XFS, Btrfs, LVM and most common file systems. It copies only used blocks on those. On file systems it does not recognize, it falls back to a sector-by-sector copy, which is slower and produces a larger image.

Shut the server down cleanly:

sudo poweroff

Step 5 - Saving the disk image

Boot the source server from the Clonezilla media and choose the default entry, Clonezilla live (VGA 800x600). Then work through the text menus:

  1. Choose your language and keep the default keyboard layout.
  2. Select Start_Clonezilla, then device-image (work with disks or partitions using images).
  3. Select ssh_server as the image repository.
  4. Configure the network: choose dhcp if the network has a DHCP server, otherwise static and enter the server IP, netmask, gateway and DNS.
  5. Enter the repository IP address (your_repository_ip), port 22, the account clonezilla and the directory /srv/clonezilla. Accept the host key and type the password when asked.
  6. Choose Beginner mode, then savedisk (save the whole local disk as an image).
  7. Enter an image name such as web01-2026-09-25 and select the source disk (for example sda or nvme0n1).
  8. Accept the default compression, skip the file system check unless you suspect corruption, answer Yes to check that the saved image is restorable, and choose not to encrypt the image unless the repository is untrusted.
  9. Choose poweroff as the action when the job finishes.

Before it starts, Clonezilla prints the equivalent command line. It looks similar to this and is worth saving, because you can reuse it for scripted runs:

/usr/sbin/ocs-sr -q2 -c -j2 -z9p -sfsck -senc -p poweroff savedisk web01-2026-09-25 sda

Clonezilla asks for confirmation and then copies each partition, showing throughput and remaining time. When it finishes, it checks the image and powers the server off.

Verifying the image on the repository

Back on the image repository, list the new image directory:

sudo ls -lh /srv/clonezilla/web01-2026-09-25
-rw-r--r-- 1 clonezilla clonezilla   4 Sep 25 10:41 disk
-rw-r--r-- 1 clonezilla clonezilla 1.2K Sep 25 10:41 Info-img-size.txt
-rw-r--r-- 1 clonezilla clonezilla  25 Sep 25 10:41 parts
-rw-r--r-- 1 clonezilla clonezilla  18G Sep 25 10:40 sda2.ext4-ptcl-img.zst
-rw-r--r-- 1 clonezilla clonezilla 1.1K Sep 25 10:22 sda-pt.sf
...

The exact file names depend on your partition layout and compression, but you should see a partition table file (sda-pt.sf) and one image file per partition. Power the source server back on if it stays in service.

Step 6 - Restoring the image to a target server

Boot the target server from the same Clonezilla media and repeat the menu steps up to the repository connection. Then:

  1. Choose Beginner mode and restoredisk (restore an image to a local disk).
  2. Select the image web01-2026-09-25 and the target disk.
  3. Answer Yes to check the image before restoring.
  4. Choose reboot or poweroff as the final action.

Clonezilla shows a warning that all data on the target disk will be erased and asks twice for confirmation. The equivalent command line is:

/usr/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -j2 -k0 -p reboot restoredisk web01-2026-09-25 sda

If the target disk is larger than the source, Beginner mode keeps the original partition sizes. Expert mode offers the -k1 option to create the partition table proportionally, or you can grow the last partition and file system after the first boot with growpart and resize2fs.

Step 7 - Giving the clone its own identity

A restored clone is identical to the source, including values that must be unique on every machine. Boot the clone with its network cable disconnected or its switch port isolated if the source is still running, so both servers do not answer on the same IP address. Then log in on the console and fix the following.

Set a new hostname:

sudo hostnamectl set-hostname web02

Update the name in /etc/hosts if it appears there:

sudo nano /etc/hosts

Regenerate the machine ID, which systemd, DHCP clients and monitoring agents use to identify the host:

sudo rm /etc/machine-id
sudo systemd-machine-id-setup
Initializing machine ID from random generator.

Create new SSH host keys so the clone does not impersonate the source:

sudo rm /etc/ssh/ssh_host_*
sudo ssh-keygen -A
sudo systemctl restart ssh

Edit the Netplan configuration and set the clone's own IP address:

sudo nano /etc/netplan/50-cloud-init.yaml

Apply it and check the result:

sudo netplan apply
ip -br addr

The file name under /etc/netplan/ may differ on your system; use the one you saw in Step 4. Finally, review anything else tied to the old identity: TLS certificates for the old hostname, cron jobs that should run on only one server, application IDs and cluster membership.

Troubleshooting

Clonezilla cannot connect to the SSH server. Check from another machine that ssh clonezilla@your_repository_ip works and that UFW allows the source network. If the repository only allows key-based authentication, enable password authentication for the clonezilla user with a Match User clonezilla block in /etc/ssh/sshd_config, or use Clonezilla's expert shell to set up a key.

"Destination disk is too small". The target disk is smaller than the source disk's partition layout. Restore to a larger disk, or shrink the source partitions before imaging.

The clone does not boot. Make sure the target firmware uses the same boot mode as the source (UEFI or legacy BIOS). An image of a UEFI system needs UEFI on the target.

The clone has no network. The interface name often changes on different hardware (for example eno1 versus enp1s0). Check it with ip -br link and update the Netplan file.

Conclusion

You created a consistent, offline image of a Linux server with Clonezilla, stored it on an SSH repository, restored it to another machine and gave the clone its own identity. Keep dated images before risky changes such as distribution upgrades, and test a restore periodically so you know the image works. As next steps, consider restoring images to many machines at once with Clonezilla SE (DRBL) over PXE, or complementing full images with file-level backups taken with a tool such as restic.