After I restored the /dev/sda3 partition of my laptop using the clonezilla backup of another Ubuntu system I had taken earlier, I had to make the system bootable using grub2. Clonezilla had only put the ubuntu image on /dev/sda3 and not installed the grub in /boot folder of /dev/sda3 or the stage 1 files in /dev/sda.
1. Make the ubuntu installation bootable
(a) Use a live cd(Ubuntu) to boot up and mount the ubuntu partition
(/dev/sda3) at mount point /mnt
sudo fdisk -l
sudo mount -t auto /dev/sda3 /mnt
(b) Install grub
sudo grub-install --boot-directory=/mnt /dev/sda
(c) Update grub to identify the win7 instln loc at /dev/sda1
2. Reboot. After rebooting the system, I could boot into my Ubuntu instln without any problem. But when I tried to boot up my win7 from the grub the system halted with the following error :-
Status : 0xc000000e
Info : The boot selection failed because a required dev is inaccessible.
A little bit of search on google suggested that the boot files of win7 were
corrupted somehow during the process.
3. Getting win7 up and running :-
Boot up the machine using a win7 recovery disk and after selecting the
language etc click on Next button. In the next screen press Shift +F10
to get a terminal and execute the following commands :-
c:/> bootrec /fixboot
c:/> bootrec /fixmbr
c:/> bootrec /rebuildbcd
(this gave an error......Couldnot detect any windows installation!)
To fix this, type the following commands at the Windows Recovery
c:/> bcdedit /export C:\BCD_Backup
c:/> cd boot
c:/> attrib bcd -s -h -r
c:/> ren c:\boot\bcd bcd.old
c:/> bootrec /RebuildBcd
Close the terminal window and exit.
4. On the next attempt I booted up both my win7 and Ubuntu without any problem.