reinstall grub2 after clone of hard drive

does anyone have a how-to on reinstalling grub2 after using clonezilla to copy a 12.3 install to a different disk?

Have a look at this article on the subject: Re-install Grub2 from DVD Rescue

And after you get up and running, have a look at this blog: GNU Grub2 Command Listing Helper with --help & Input - Blogs - openSUSE Forums

Thank You,

i’ve been working with that one and several like it all afternoon. it gets to the point
"Trying manual resume from /dev/sda2
resume device /dev/sda2 not found

i know it’s there, i’ve run mkswap on it from the rescue disk.

it dies with “Could not find /dev/root.”

here are the steps i took that finally made the system boot.

mkdir /mnt/tmp
mount /dev/sda1 /mnt/tmp
mount --bind /sys /mnt/tmp/sys
mount --bind /dev /mnt/tmp/dev
mount --bind /run /mnt/tmp/run
mount --bind /proc /mnt/tmp/proc
chroot /tmp/mnt
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda
mkinitrd

the mkinitrd kept giving me an error that it could not find hd(0,1). tried it anyway and the system booted. i’m not sure i needed to mount all four of those file systems.

so, was i sucessful? that depends. if i collect enough of my notes, i might be able to restore a clonezilla backup of a grub2 box should a drive fail.

but the real task was to see if a running 12.3 system could be moved to different hardware. i have tried in the past with centos and had mixed results. wanted to see how it would go with opensuse. it can be done, but it’s not pretty.

So another issue to look for is in the /etc/fstab file where disk-by-id is used by default and when wrong will keep a drive partition from mounting. The id will not be the same between different hard drives even if you think that are the same make and model. The YaST Partitioner can show you the by-id number.

Thank You,

Check /boot/grub2/device.map. It likely refers to old device (clone source). Replace with your current device name.

i discovered that late last night. never could figure out how to get grub2 to regenerate that file.

grub2 never generates device.map itself, nor does it need it (although it will use it if present). This file is generated by YaST2 bootloader module for compatibility reasons. Unfortunately there is no well defined procedure to replace drive (I could not make YaST2 update configuration to reflect drive swap whatever I did). It is definitely worth bug report, the practical problem is to devise reproducible test case (you do not change HDD every so often).

I tried openSUSE-13.2-NET-i586.iso on USB stick with target USB hard disk. The installation was fine, but did not boot. I succeeded with:

mkdir /mnt/tmp
mount /dev/sdb1 /mnt/tmp
mount --bind /sys /mnt/tmp/sys
mount --bind /dev /mnt/tmp/dev
mount --bind /run /mnt/tmp/run
mount --bind /proc /mnt/tmp/proc
chroot /mnt/tmp
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sdb
mkinitrd