25 August, 2014

Partitioning, GRUB and Boot-Repair

Tux, the Linux penguin
Tux, the Linux penguin (Photo credit: Wikipedia)
Sunday afternoon, 24-Aug-2014


I was configuring the pagefile.sys partitions in my Windows 8.1 laptop, which is currently also having dual-boot feature – yes, I am running Ubuntu Linux and Windows 8.1 in the same machine, and I am always enamored by the simplicity and ease of use of Linux. But that time I was in Windows, and having read some useful article which tells of how to make pagefile.sys work better, I proceeded to execute the necessary changes.

First point is to use a space in a drive other than where your OS is installed, and better yet, create a partition all for the page file’s use. However, you can’t ever get away from creating a page file in the OS’s same drive – this has its own use. So now, you need to have 2 partitions for the page file, one in the drive where your OS is installed, and another in a separate drive. How big is the size? This is a big question, and the standard answer is 1.5x your installed RAM size. Not exactly correct, the guy said. Primary use of page file is to move from RAM whatever memory of inactive programs into the page file. So how big is that? Not really big. Minimum? 1GB. Maximum, twice of that. So simple math would yield 2GB. That is all you need. Quite small, eh? Just enough. That is why you need to have the page file in the (usual) installation drive for the OS, which is C: drive, because of error and crashes, when there is no time to reach the other paging file in the other drive. To be convenient, just set aside 4GB to 8GB. How you divide between the 2 partitions, that is entirely up to you.

I thought that I was all set, and proceeded to go and create the partition, so I downloaded and installed EaseUS Partition Master, and get it to work on my requirements. Easily I identified where I would be slicing off the 8GB, and that was divided into 3.5GB from C: drive, and 5GB from P: drive. With the ease of use provided by EaseUS Partition Manager, that was a breeze. Just right-click on the drive, and drag either the bar on the left or on the right, to create a space before or after it. Really, it is all that easy. I clicked on OK, then on Apply, which asked for a restart.

I yielded. And that’s when the problem started.

GRUB failed, and it stopped on a prompt that I have never seen before. And it is indicating something like ‘unrecognized drive’ or ‘unknown drive’. I immediately guessed that it was the newly-partitioned space that is still pending processing. I remembered that it was after P: partition that the \sda14 formatted as EXT4 is located, and that might have impacted GRUB.

I almost panicked. Hey, it is only about 5 months since the last disaster happened – Ubuntu Linux installation was done by mistake, overriding Windows, and fortunately, I was able to recover much of my documents, especially the important ones.

I composed myself for some time, trying to figure out, what happened, and what can be done to do recovery. At least I reasoned to myself that Windows and Linux are still intact, since nothing was done, except that the additional partition may have affected GRUB – I still don’t know why.

And to verify my guess, I turned on my other laptop, thought hard on what I should be searching for, until I typed, ‘how to fix GRUB’. One guide told of doing some manual recovery using a Live Linux stick, which I could say works to a certain degree, but no completely. I got to see GRUB, but not the usual menu, which is supposed to show Windows and Linux. Only Linux shows, and when I selected it, it still didn’t boot up to Ubuntu Linux.

I continued to search for other possible recovery methods, and that is when I saw Boot-Repair – one that you install, and it will do the recovery for you.

I installed it, and run it. First time, I didn’t get it to work; I still wasn’t able to get GRUB boot into Linux.

I did another Linux Live stick session, and this time, using the data from the manual recovery article, which identifies the Linux installation partition, and the GRUB partition (which indicates ‘boot’). I went to the Advanced settings, and assigned the MBR to the partition carrying ‘boot’ ID, run the recovery as provided by Boot Repair apps, and that fixed the problem.

When I did a restart, I see the Windows and Ubuntu choices, and yes, there is another, I guess, from the previous run, where I didn’t specifically indicate the MBR partition. I guess I will look for ways to remove that, so it doesn’t cause any other problem, but point is, my GRUB was repaired, and that only took some time, about one hour or so.