Ubuntu – Deleted swap partition. Now it is booting to grub rescue


I have dual boot system, but while booting my system with window 7, I deleted swap partition mistakenly. Now it is showing no such partition grub rescue.

I installed very important software in Ubuntu and I don't want to reinstall it again. Is there any method to resolve it?

Best Answer

You don't need Internet connection, just you need Ubuntu in CD/Flash.

Boot from live CD/Flash and do steps:

  1. After booting from live Ubuntu, first of all open gparted and check if you installed Ubuntu in which partition ex:/dev/sdaX, where X is your installed partition (Type gparted in dash and open it).

I am consider for example you installed Ubuntu on /dev/sda4 and I explain steps.

  1. Then mount /dev/sda4 by the following commands (you can replace it by partition that you will see in gparted application):

    sudo mount /dev/sda4 /mnt
    for i in /sys /proc /run /dev;do sudo mount --bind "$i" "/mnt$i";done
  2. Now we mounted the /dev/sda4 that installed Ubuntu here. just run below command to switch to root directory of Ubuntu patrtition:

    sudo chroot /mnt
  3. And run below command to install grub to main partition /dev/sda:

    grub-install /dev/sda
  4. Update grub and exit and reboot your system. it will fix.

    sudo reboot

I hope this helps.

Related Question