Menu

CLonezilla restore to VM doesn't boot

Help
Tim
2018-02-07
2018-02-21
  • Tim

    Tim - 2018-02-07

    I have a job to P2V a physical Linux machine to a Hyper-V virtual machine. In preparation for this as a test, I installed Ubuntu on a physical PC and then cloned it with clonezilla to a USB hard drive.

    In an attempt to clone back to a machine in Hyper-V I did the following:

    1. I plugged the USB hard drive into my Windows 10 laptop (running Hyper-V).
    2. Copied the cloned files folder onto the laptop and created a Windows share
    3. Created a new VM in Hyper-V as a Version 1 Hyper-V machine
    4. Added a virtual hard drive VHDX to the Hyper-V machine that was several GB larger than the original cloned drive
    5. Inserted the clonezilla CD to the VM
    6. Booted the VM to clonezilla and restored from the share

    On completion of the restore Clonezilla just says remove the disk and press Enter. When I press Enter it does nothing but scroll a line at a time, i.e. it accepts input but does nothing. I had to hard power off the VM. When it boots again it just gets a black screen with a blinking cursor and will not boot to Ubuntu. I have tried this with 'stable - 2.5.2-31' and 'alternative testing - 20180119-artful' and get the same results.

    Am I doing something completely wrong here or is there an obvious reason this is not working?

    Thanks.

     
  • Steven Shiau

    Steven Shiau - 2018-02-10

    No. However, looks like the boot loader was not restored or reloaded correctly. You can boot Clonezilla live again, then run:
    sudo ocs-install-grub auto
    If it does not work, then try to boot Ubuntu installation CD and find the tool from Ubuntu to fix the boot loader.

    Steven

     
  • Tim

    Tim - 2018-02-14

    Thanks Steven, I will try this and update with the outcome.

     
  • Tim

    Tim - 2018-02-21

    So, finally resolved. The physical box cloned ok, but was the booting that was the issue. I don't claim to fully understand the issue and why it occurred but this is how I fixed it. I have verified that this works on a couple of separate attempts. Also had the same issue with Ubuntu that I fixed in a similar manner.

    This might help others with a similar issue.

    Cheers,
    Tim.

    P2V of a CentOS box

    1. PC set disk to legacy BIOS boot (unsure of whether this is required with the latest Clonezilla image as I think it manages UEFI)
    2. Installed CentOS machine on physical PC
    3. Create a Gen 1 Hyper-V machine (not sure Gen 1 is definitely required)
      a. Identify disk size on physical box, VM disk needs to be larger
      b. Insert Clonezilla ISO, set boot order to CDROM first
      c. Disable Checkpoints (won't boot if using a passthrough USB hard drive for this)
      d. Attach USB hard drive, ' offline' the disk in disk management, and add it to the VM
    4. Capture machine with Clonezilla to external disk
    5. Restore with Clonezilla
    6. Fails to boot, but sees grub, attempts to boot, goes through the OS progress bar at the bottom of screen, drops to a dracut prompt
    7. Shutdown
    8. Boot to CentOS ISO
      a. Select Troublehooting
      b. Select Rescue a Centos System
      i. Select option 1
    9. Select recovery option 1
      a. # chroot /mnt/sysimage # to make the system use the root environment, as per instruction on screen
      b. # cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
      c. # dracut -f
      d. # exit
      e. # shutdown
    10. All appears to be working
    11. Power off VM
    12. Resize disk with partition editor in Ubuntu
    13. Done
     
  • Tim

    Tim - 2018-02-21

    Ubuntu was fixed via the commands at the bottom of this post

    https://www.howtogeek.com/114884/how-to-repair-grub2-when-ubuntu-wont-boot/

    Ubuntu not booting, no Grub:

    You’ll need to boot from a live CD or USB drive, as in the graphical method above. Ensure the version of Ubuntu on the CD is the same as the version of Ubuntu installed on your computer. For example, if you have Ubuntu 14.04 installed, ensure you use a Ubuntu 14.04 live CD.

    Open a terminal after booting into the live environment. Identify the partition Ubuntu is installed on using one of the following commands:

    sudo fdisk -l

    sudo blkid

    In the fdisk -l command, the Ubuntu partition is identified by the word Linux in the System column. In the blkid command, the partition is identified by its ext4 file system.

    If you have multiple Linux ext4 partitions, you can get an idea of which is which by viewing the size of the partitions and their order on the disk here.

    Run the following commands to mount the Ubuntu partition at /mnt/ubuntu, replacing /dev/sdX# with the device name of your Ubuntu partition from the above commands:

    sudo mkdir /mnt/ubuntu

    sudo mount /dev/sdX# /mnt/ubuntu

    sda1 means the first partition on the first hard disk device.

    Important: If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/ubuntu/boot instead. If you don’t know whether you have a separate boot partition, you probably don’t.

    Run the following command to reinstall grub from the live CD, replacing /dev/sdX with the device name of the hard disk above. Omit the number. For example, if you used /dev/sda1 above, use /dev/sda here.

    sudo grub-install --boot-directory=/mnt/ubuntu/boot /dev/sdX

    Restart your computer and Ubuntu should boot properly.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.