Showing posts with label Grub Recovery. Show all posts
Showing posts with label Grub Recovery. Show all posts

Monday, January 9, 2012

Recover or Rescue Grub from live Ubuntu CD

In Last Post We Have Discussed About Restoring Windows From Grub.This Post Explains A Method Of Restoring Linux Installations Like Ubuntu Using Linux Live Desktop Cd Or a Server Cd.

Steps To Be Followed.

1.Boot From The Ubuntu Or Any Linux Variant Live Cd.
2.Open Terminal .

Applications> Accessories> Terminal.
3. In Terminal type sudo fdisk -l   . 
    It will display all the Available partition on the disk.


Identify the partition which have Linux under System column is your drive in which ubuntu linux is installed. 


4. Mount the ubuntu partition drive
       sudo mount /dev/sdXX /mnt  (example 'sudo mount /dev/sda11 /mnt' ,Here XX Stands For Your Drive.)


5.Only if you have a separate boot partition: 
            sudo mount /dev/sdYY /mnt/boot.


 6.  Mount the virtual file systems: 
            
            sudo mount --bind /dev /mnt/dev
        sudo mount --bind /proc /mnt/proc 
        sudo mount --bind /sys /mnt/sys


7. To ensure that only the grub utilities from the LiveCD get executed, mount /usr     
     sudo mount --bind /usr/ /mnt/usr 
     sudo chroot /mnt  


8. If there is no /boot/grub/grub.cfg or it's not correct, create one using 
            update-grub 
      or  update-grub2


9.Now reinstall Grub  
         grub-install /dev/sda     


 10. Verify the install 
        sudo grub-install --recheck /dev/sdX


11. Exit chroot : CTRL-D on keyboard.


12. Unmount virtual filesystems:  
           sudo umount /mnt/dev 
           sudo umount /mnt/proc
           sudo umount /mnt/sys 


If you mounted a separate /boot partition:  
           sudo umount /mnt/boot 


13. Unmount the LiveCD's /usr directory: 
          sudo umount /mnt/usr


14. Unmount last device: 
           sudo umount /mnt
15. Reboot. 
         sudo reboot.


NOTE: If you are getting /usr/sbin/grub-probe: error: cannot stat 'aufs'  error then the possible reason is that you didn't follow the commands listed above. Specifically you did not do chroot.


Credits:Sidh.

Sunday, January 8, 2012

Remove Grub & Restore Windows.

Recently I Came With a Serious Problem Which Freaked Me Out.Though I'm Not New To Linux I did a Blunder. I Hope So many New Users With Linux Would Have Been Into The Same Rabbit Hole Like Me. I Have Done Dual Booting With Ubuntu Latest Version 11.10 Over Windows With Wubi(Windows Based Ubuntu Installer,It Will Make Your Work Easy in Installing Ubuntu On Windows Machine.) .
Out of Curiosity I Deleted The Linux( Ubuntu ) Partition By Logging into Windows With Disk Manager. Then i was Gifted with a GRUB Rescue Command Prompt.  


When i Rebooted I was Welcomed With a Grub Prompt Instead of Menu to select Operating System. I Kinda Freaked Out. I Tried Some Random Commands But It Didn't Worked . then i Took The Help Of Mr. Google was  able to get into my Windows . 


I Have decided To Make a Post To Help Out The "New Users" Who Have no idea of what They are Playing With.Here Are The Steps To Restore Your Previous "windows Boot Manager".


Things You Need :
1.Windows Boot CD OR DVD (or The System Repair CD).


Steps:
1.Boot With Your Cd.
2.Select the Recovery option.
3.Navigate up to The Command Prompt.
4.Then type Following Commands.



Type            :    Diskpart          And Press Enter.
then Type  :    Select disk 0         And press Enter.( Here Select Disk Zero).
Then Type :   List Volume          


A List of Existing Drives Would Be Resulted. Identify the Drive Letter of Cd/Dvd.


Microsoft Windows [Version 6.1.7100]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
X:\Windows\system32> diskpart
Microsoft DiskPart version 6.1.7100
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: VIRTUAL-7
DISKPART> select disk 0 
Disk 0 is now the selected disk.

DISKPART> list volume 
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     P                               CD-ROM          0 B  No Media
  Volume 1     R     Drive 1   NTFS   Partition    100 MB  Healthy
  Volume 2     U     Drive 2   NTFS   Partition     11 GB  Healthy    System
  Volume 3     R     Da           NTFS  Partition     20 GB  Healthy    Boot

Type:  Exit.

5. Using The Drive Letter You Identified .Go to that Drive ( For Example In Above Drive P Is The System Repair Drive) 
Type P:

Ex:X> P:

6.Type: cd \boot And Press enter

Type: bootsect /nt60 SYS /mbr   And press enter.

This Command should find the "Active" partition with the System files and boot code and restore your Windows Boot Manager.

7. Restart And Get Back Your Good Old Windows .