Friday, February 26, 2016

Extend the Ubuntu partition size with available free space in Windows ( Dual boot system)

 Scenario:

I have dual boot system with Windows 8 and Ubuntu. Ubuntu partition has very less space 15 GB so I was unable to install and run the programs effectively. I had 100 GB free on other partition so I merged that free space into Ubuntu partition. I followed the following steps which worked fine for me without losing anything. (*Pics are for reference)

STEPS: 
1.  Boot the computer with the Linux live CD or USB.
2. Start GParted in live Ubuntu session, Most of the cases installed , if not than install from software manager.

3. If you have swap partition(s), right click on it/them and select swapoff (Edit: you can skip this as your snapshot does not show any swap used), 




4.  As Gparted  can add the space from space preceding and space following, we need to add the empty unallocated partition ahead of Ubuntu partition.


5.(WARNING: moving /boot partition may cause boot failure!) Now right click your extended partition /dev/sda2 (in your case) and select Resize/Move option, and drag the slider left to cover the unallocated space. Repeat the process with /dev/sda5 to cover the space created in the extended partiton. And then click the Resize/Move button, 




6.   After specifying such move and resize options, from the menu select Edit -> Apply All Operationsor click the apply button in the toolbar. The resize and particularly move option will take a long time depending on the size of the files to be moved. So wait patiently. 


7.      After creating unallocated partition before the Ubuntu partition you can add those partition as on step 5 &6 to its main partition. You can on the Swap by right clicking on the Swap partiion.
8.      You should then be done! Reboot to see if every thing is fine. If something went wrong and  you're unable to boot, try boot-repair to fix it.
9.     Install Boot-Repair in Ubuntu
Ø  connect to the Internet
Ø  open a new Terminal, then type the following commands (press Enter after each line):
Ø  sudo add-apt-repository ppa:yannubuntu/boot-repair
Ø  sudo apt-get update
Ø  sudo apt-get install -y boot-repair && boot-repair
10. Launch Boot-Repair from either :
    1. the Dash (the Ubuntu logo at the top-left of the screen)
    2. or by typing 'boot-repair' in a terminal
11. Then click the "Recommended repair" button. When repair is finished, note the URL (paste.ubuntu.com/XXXXX) that appeared on a paper, then reboot and check if you recovered access to your OSs. If the repair did not succeed, indicate the URL to people who help you by email or forum.

12. It may be that Windows option may not be displayed in Grub. On that case open the Ubuntu and go to Terminal and update the Grub.
 sudo apt-get update grub

13. It may be that you are getting window option but on clicking it , new windows comes stating you to repair your window due to some corruption on. If it occurs follow the following steps:

  •     Insert the live CD or USB for your windows and boot from it by changing boot sequence from your BIOS
  • Select to repair the windows and move to the Command line repair mode from the advance option.
  •  In the command line, type the following command to fix your boot error
        bootrec /fixmbr
        bootrec /fixboot
        bootrec /rebuildbcd

  •  Exit from the command line and reboot your computer in normal mode.


14. Hopefully now you might get extended partition without losing your data.