0

I need to decrease the size of bootable EBS in AWS, I tried to rsync all data to another bootable drive (clearing everything before) but after that I can not boot it (empty log from EC2 dashboard and cannot connect through ssh), I tried to set grub but faced with error grub-install: error: embedding is not possible, but this is required for cross-disk install. And I remember about Clonezilla. Clonezilla can clone only unmounted local devices. Can I run Clonezilla on EC2 in some way and operate it through the ssh? Or maybe I can do the same action manually on EC2 with attached device that I want to clone?

2 Answers 2

1

Reopening this question, for those of you want to make CloneZilla in AWS with Serial Console After making the clonezilla VM, you can start the normal clone operation the way you want.

  1. Create a new EC2 instance
  2. Modify the disk bigger size (do not extend in the OS)
  3. In the OS, for the extra space, create secondary partition, format it, mount it (mount to /mnt)
  4. Download the clonezilla zip file (https://clonezilla.org/livehd.php)
  5. After downloading the zip file, follow the guide to unzip to partition 2.
  6. Change the dir name "live" under /mnt as another name (for the grub to work)
    mv live live-hd
  1. Change /etc/grub.d/40_custom to boot to the second disk
  2. Modify the /etc/grub.d/40_custom, the kernel argument, to include serial console in AWS Below is example of /etc/grub.d/40_custom (you can modify further to create default user's password).
    menuentry "Clonezilla" {
         set root=(hd0,4)
         linux /live-hd/vmlinuz  boot=live union=overlay username=user config components quiet noswap nolocales edd=on nomodeset ocs_live_run=\"sudo bash\" ocs_live_extra_param=\"\" keyboard-layouts=en ocs_live_batch=\"no\" locales= vga=788 ocs_prerun="dhclient" nosplash live-media-path=/live-hd bootfrom=/dev/nvme0n1p2 ocs_daemonon="ssh" console=ttyS0,115200n8 ocs_live_run_tty=/dev/ttyS0 toram=live-hd,syslinux,EFI
         initrd /live-hd/initrd.img
    }
  1. Update grub to grub menu
      grub-set-default "Clonezilla"
      update-grub2
  1. Reboot the VM
  2. It will boot to clone zilla (check serial console)
  3. After it fully boot, you are landed in the bash
  4. Change password of user: passwd user
  5. Now you can login via ssh

PS: If you want to modify the squashfs (I didn't do it)

    cd /tmp; 
    mkdir clonezilla_iso; 
    unsquashfs clonezilla_iso/live/filesystem.squashfs; 
    chroot squashfs-root /bin/bash

Make your change, and exit the chroot

Repack

    mksquashfs squashfs-root/ clonezilla_iso/live/filesystem.squashfs -noappend -always-use-fragments
0

Try creating a new Instance of the same type as the Instance that you want to duplicate, but in the size you want to make it. Then, detach the Volume and Terminate the new Instance. Duplicate the partitions from the old Volume to the new volume and attach the new volume as /dev/sda1. (When I've tried to build a new boot Volume by hand, I always seem to be missing something and it never works. But, you build a new Instance just to get the pre-built Volume, it always works for me.)

Also, you might want to try spinning up a free-tier Ubuntu Instance and installing Clonezilla (sudo apt-get install drbl). I much prefer using Clonezilla than trying to command line a partition duplication out. Lazy? Maybe, but it usually works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .