Gparted moved Linux partition -- no longer boots

10,343

It would appear that Grub is looking for Ubuntu in the wrong place. As the files are still there, nothing should be wiped. You will just need to fix Grub.

Fixing Grub with Boot Repair

The easiest way to do that is with "Boot Repair"

First boot into the live CD. Then install "Boot Repair" itself.

Enter these commands if you run Ubuntu 12.04

sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair && (boot-repair &)

For Ubuntu 14.04

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo sed 's/trusty/saucy/g' -i /etc/apt/sources.list.d/yannubuntu-boot-repair-trusty.list
sudo apt-get update
sudo apt-get install -y boot-repair && (boot-repair &)

And for Ubuntu 14.10

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo sed 's/utopic/saucy/g' -i /etc/apt/sources.list.d/yannubuntu-boot-repair-utopic.list
sudo apt-get update
sudo apt-get install -y boot-repair && (boot-repair &)

This will also start the program after it has been installed.

Once the GUI opens up, click on the Recommended repair. This will reinstall the Grub2 boot-loader and find your Linux partition in its new location.

The guide uses steps from this source. Read it if you want more information.

Alternatively here is how to with the terminal only.

Share:
10,343

Related videos on Youtube

kalaracey
Author by

kalaracey

Updated on September 18, 2022

Comments

  • kalaracey
    kalaracey over 1 year

    I have a MacBook Pro with Mac OSX installed and Ubuntu 12.04. I wanted to resize my Ubuntu partition, so I booted to a 10.04 liveCD and used GParted to "move/resize" my Ubuntu partition.

    Unfortunately, I think GParted defaults to moving it 1000MiB to the right (i.e., adds 1000MiB of unallocated space to the left, and moves the partition right), something I didn't realize until after I had started the process.

    In addition to doing this, I reduced its sized by ~10GiB (9.77GiB in the screenshot) from the right, and added an ext3 partition in that unallocated space (I'm trying to do Linux From Scratch)

    How can I repair my system so that I can boot my Ubuntu 12.04 system? Perhaps it is something to do with Grub? I use the rEFIt Boot Manager, so everytime at boot, I have the option to load either OSX or Linux. I have already gone through the option to sync/update the MBR in rEFIt.

    Here is a screenshot of GParted from my livecd booted up after the move:

    enter image description here

    Something very fortunate, though, is that in File Browser, in the left-hand panel, I can mount the "132 GB Filesystem", which is my 12.04 Filesystem which I moved and can no longer boot. I can browse it, and read files from it. Here is a screenshot:

    enter image description here

  • kalaracey
    kalaracey almost 12 years
    I installed and ran boot-repair, but gee, it's taking its time. It's been "Scanning systems. This may require several minutes..." for hours now. Is this normal? I do have a relatively large drive.
  • TrailRider
    TrailRider almost 12 years
    It may take some time, but hours seems a bit odd. I've not heard of it taking that much time...not sure why it would take that long unless it's having problems finding the Linux kernel Images, not sure why it would not be able to find them though.
  • kalaracey
    kalaracey almost 12 years
    Do you think I should do ... && sudo boot-repair?
  • TrailRider
    TrailRider almost 12 years
    boot repair should already run with sudo privileges. Have you tried to shut down boot repair and run it again? (you can find it in the dash) if so did it still freeze? I assume that the window to select the repair never came up, it just froze at the first window with the bar running back and forth?
  • kalaracey
    kalaracey almost 12 years
    It froze at the same place (with the bar running back and forth, with the same message as I said in the first comment), but I went to terminal, and I did Control-C, and it switched to the GUI screen described in your post and in the documents. I clicked the button, then I got an EFI issue, saying that I was in legacy MBR mode, not EFI mode (or something along those lines; if what's happening now doesn't work, which I'll describe next, I'll go back and reproduce), but I had the ability to continue. Now it is at "Purge and reinstall of GRUB of: sda4 (upd). This may require several minutes..."
  • kalaracey
    kalaracey almost 12 years
    Note: I rebooted the liveCD and reinstalled boot-repair, and when it froze, I did control-C and it kept going, I did not relaunch Boot-Repair like you described in your comment. If what I'm doing now doesn't work I'll try fully quitting out of boot-repair and starting it again.
  • TrailRider
    TrailRider almost 12 years
    I just checked the homepage of boot repair and it does mention EFI so you should not be having any problems. If it fails again but gives you a pastebin url, make sure you edit your question to include it.
  • kalaracey
    kalaracey almost 12 years
    Unfortunately, I was unable to recover my partition. Boot-repair put grub not on the same partition as my Ubuntu installation, but in the EFI partition. This worried me at first, but it was actually very cool.. Didnt know you could do that. Your solution semi-worked, and probably would have worked if I had done boo-repair in MBR mode instead of EFI mode. So, I'll give you a check.
  • MadMike
    MadMike over 9 years
    The yannubuntu-boot-repair-trusty.list file didn't work with my Ubuntu 14.04 Live-USB. Looking into the linked "Ubuntu Community Documentation the installation-process seems to have changed. I adapted it here accordingly
  • ignis
    ignis over 9 years
    @MadMike Since this question is explicitly about 12.04: is your updated procedure compatible with 12.04? If not, please clarify what applies to 12.04 and what applies to 14.04
  • MadMike
    MadMike over 9 years
    @ignis Thanks for pointing that out. I corrected it and also did some rearranging of the whole answer... I hope I didn't overdo it. :P
  • nonNumericalFloat
    nonNumericalFloat about 3 years
    Bad question; Is there an update for this on Ubuntu 20?