CLONEZILLA - Set up Clonezilla in GRUB on a Debian-based VPS

From IT-Arts.net


Return to Wiki Index


Prerequisites

Before proceeding, ensure you have the following:

  • A Debian-based VPS with root access
  • SSH access to the VPS
  • A Clonezilla image stored on a remote server or accessible via SSH
  • GRUB installed and configured correctly on the VPS

Preparing Clonezilla for GRUB

Clonezilla can be booted from a network or locally, but in this case, we will use it through GRUB to perform an image restoration process.

Download Clonezilla Live ISO

First, download the Clonezilla Live ISO image. It will be used as a bootable image in the GRUB menu. You can download the latest version from the official Clonezilla website or mirror.

wget https://sourceforge.net/projects/clonezilla/files/clonezilla_live_stable/2.7.3-29/clonezilla-live-2.7.3-29-i686-pae.iso

Mount Clonezilla ISO to a directory

Next, mount the Clonezilla ISO to a directory in order to access its files.

mkdir /mnt/clonezilla
mount -o loop /path/to/clonezilla-live-2.7.3-29-i686-pae.iso /mnt/clonezilla

Copy Clonezilla Files to /boot/clonezilla

To make Clonezilla available in the GRUB bootloader, copy the necessary files from the mounted ISO to a directory in the `/boot` partition.

mkdir -p /boot/clonezilla
cp -r /mnt/clonezilla/* /boot/clonezilla/

Create GRUB Boot Entry for Clonezilla

Now, you will need to configure GRUB to include Clonezilla as a boot option. Open the GRUB configuration file for editing.

nano /etc/grub.d/40_custom

Add the following configuration to the file:

menuentry "Clonezilla" {
  set root=(hd0,1)   # Adjust the partition according to your setup
  linux /boot/clonezilla/vmlinuz boot=live config quiet
  initrd /boot/clonezilla/initrd.img
}

This configuration tells GRUB to load Clonezilla when selected. The root partition may differ based on your VPS setup, so make sure to adjust `(hd0,1)` accordingly.

Update GRUB Configuration

After saving the changes, update GRUB to apply the new boot entry.

update-grub

Setting Up Clonezilla for SSH Restoration

Now, you'll set up Clonezilla to restore disk images over SSH.

Prepare Remote Server with Disk Image

Ensure the Clonezilla disk image you want to restore is stored on a remote server. The server should have SSH access enabled.

For example, you may use a remote server at `remote-server.com` with a directory `~/clonezilla_images/`.

Configure Clonezilla to Use SSH for Restoration

When booting into Clonezilla via GRUB, you can use the `-r` option to restore an image from a remote server over SSH. This is done by modifying Clonezilla’s boot command line.

Modify the GRUB entry you created earlier to include the SSH details. Open the `/etc/grub.d/40_custom` file again and update the boot entry:

menuentry "Clonezilla (Restore via SSH)" {
  set root=(hd0,1)  # Adjust the partition according to your setup
  linux /boot/clonezilla/vmlinuz boot=live config quiet ssh=1
  initrd /boot/clonezilla/initrd.img
}

This configuration tells Clonezilla to initiate an SSH session for network-based restoration.

During the restoration process, Clonezilla will prompt you to enter the IP address, SSH username, and password of the remote server. For example:

  • Remote Server: `remote-server.com`
  • Directory: `/home/user/clonezilla_images/backup.img`
  • SSH User: `user`
  • SSH Password: `password`

Restore Process

Once you've booted into Clonezilla, select the "Restore via SSH" option from the GRUB menu. Follow the on-screen prompts to connect to the remote server and select the disk image to restore.

Clonezilla will handle the restoration over SSH, making it easy to bypass the VPS provider's limits.

Troubleshooting

If you encounter issues during the setup, here are some common problems and solutions:

Issue: GRUB Menu Does Not Display Clonezilla

  • Solution: Ensure that you've updated GRUB properly using the `update-grub` command. Double-check your `/etc/grub.d/40_custom` file for syntax errors.

Issue: Clonezilla Fails to Connect to Remote Server

  • Solution: Verify that SSH is enabled on the remote server and that the SSH credentials (username, password, IP address) are correct. Ensure the firewall is not blocking the connection.

Issue: Clonezilla Cannot Find Disk Image

  • Solution: Confirm that the path to the disk image on the remote server is correct. You can test the SSH connection using a tool like `ssh` or `rsync` to ensure that the server is accessible.