<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d23884446\x26blogName\x3dJust+Another+Tech+Blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://justanothertechblog.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://justanothertechblog.blogspot.com/\x26vt\x3d-484221019928432923', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Just Another Tech Blog

Anything and everything having to do with technology, computers, science, and most of all... Linux! The documentation of my Linux endeavor.



Moving Partitions and GRUB Errors...

Tuesday, June 05, 2007

Summer has finally come! And with summer comes the onset of my latest project: install and review a new Linux distro every week (until mid-July that is, when I am off for Germany)! I want to experience what Linux really has to offer, so I am leaving Ubuntu for a while (although it will still be on my hard drive) and trying out a number of different distros that have piqued my interest over the last few years.

In preparation for this project, I first had to decide where I was going to house these new distros on my hard drive. In other words, it was time to update the my partition scheme. Before, I had a fairly basic layout: just a /home partition (about two thirds of my hard drive), a / (root) partition (about a third of my hard drive), and a swap partition (one gigabyte). If I wanted to try out new distros, I would have to change things up a bit. So, I pulled out my handy dandy Gparted LiveCD and started moving things around:
  • To start off with, I shrank my home partition from about 160 gigs to around 100.
  • Next, I had to move my root partition over a bit to the "left". Since my root partition was 60gigs and every single byte had to be copied over to the new sector , this did take a while... about 4 and a half hours to be exact.
  • After that, I simply created a new partition of again, around 60 gigs formated in ext3 style.
GParted made all these steps exceedingly easy, and after the desired operations where complete, my new partition layout was ready to go. My plan is to use a common /home partition for my distros, and a common swap space. The extra partition can be split up further to give me even more room for distros (right now, I plan on only having two install at one time: Ubuntu (current) and one other distro- but that may well change). As I was soon to see, the fun was just beginning.

Upon reboot, I was greeted by... nothing. No GRUB. "No problem," I thought to myself, "I'll just pull out the Unofficial Super GRUB disk and have GRUB restored in no time!" So, I go ahead and boot up into the LiveCD. Or try to... Seems I few settings in my BIOS were mixed up, and booting from a CD or DVD was third on the boot list. After switching that around, the Super GRUB disk booted flawlessly, and after navigating through a few menus and pressing ENTER a few times, I was told that GRUB was restored (chalk up another victory for SGD!). Again: or so I thought...

Yes, GRUB was back, BUT every time I tried to select an operating system from the list, I recieved the rather cryptic error message:

Error 22: partition not found
Great... were my partitions screwed up? Would I never see my precious Ubuntu install again? After the initial shock, the problem solving and trouble-shooting part of my brain jumped into action. Not for long however, as I decided to retire for the night (the GRUB error would haunt my dreams... literally!). So, this morning, I got up and set to working trying to get GRUB working again. I reconsidered the error, and in a way it made sense. I moved my root partition, and now GRUB can't find it. OK, well, I don't like it... but I should be able to fix it.
First on my list: check the menu.lst file. Booting into a Ubuntu LiveCD I had lying around, I quickly browsed the GRUB configuration files and took a close look at my menu.lst file. Nothing strange there, it was just how I had left it.
Next, I tried reinstalling GRUB. To do this, I booted into the Ubuntu LiveCD again, and opened up a terminal. The follow should have done the trick:

$ sudo grub
grub > find /boot/grub/stage1
grub > root(hd1,2)
grub > setup (hd1)
grub > quit

A bit of explanation: "find /boot/grub/stage1" will return the value in the form hd?,?. The two ?s should be used in the next steps (ie: for me, it returned hd1,2 so I used hd1,2 in the root and setup commands).
Hoping that this would work, I rebooted. Fingers crossed, I watching anxiously as GRUB loaded. I selected Ubuntu from the list and... * heart sinks * "Error 22: Partition not found". Great... Now what?

Not wanting to spend for ever figuring this out, I did a minimal install of Ubuntu 6.10 on my new partition. In doing this, I hope that GRUB would be reinstalled and reconfigured freshly. Again.. no luck. I tried reinstalling and setting up GRUB using the above method using the values for the new partition I had just installed Ubuntu on (I did this because I now probably had 2 GRUB configurations on 2 different partitions, and the old configuration was being used (being on the "nearest" parition, and already being setup). A nice stream of logic I suppose... but again, no go.

Then, the thought hit me, "What if this isn't GRUB's fault, and its my BIOS sending it the wrong value or something." I thought back to when I configured the boot order, and remembered maybe switching the order of my hard drives. Interesting... I thought I was on to something. Entering the BIOS of my motherboard, I hit F9, which restored the "optimal defaults." This basically reset all my settings (I lost my perfect overclock... but hey, that can be redone). Fearing the worst once again, I restarted and chose Ubuntu (7.04) off the GRUB menu. What do you know! It worked! The whole time, the problem had merely been a mixed up setting in my BIOS!

To say the least, I am incredibly relieved now, and will sleep in peace tonight (no random interruptions of my dreams by Linux, partitions, and GRUB).

Now I can go ahead with my project of installing a new Linux distro every week. First on the list: Fedora 7 (in light of the recent release). Other distros I will be trying: PCLinuxOS, openSUSE, Gentoo, Mandriva, Debian, and maybe a few others (depends on how much time I have!). I'll be posting updates regularly!
posted by linnerd40, Tuesday, June 05, 2007


4 Comments:

Glad you got it sorted out. Never happened to me... same Linux installs up and running uninterrupted for years... you can back up (and restore) your MBR by the way. It's a single command with dd.

commented by Anonymous Anonymous, 3:19 AM  

Hi fren , i heard that HDRc is very good in data recovery. So , if u wish to check it then www.hdrconline.com is their site.
glad you got it sorted out.

commented by Anonymous Anonymous, 6:56 AM  

looks like u might have some views on this problem. I ghosted my red hat linux everything went ok. when i use this new hard drive it stays on
GRUB and nothing. I know i am missing grub partition. I tried to use following command
grub > find /boot/grub/stage1

system doesn't find. So i can't do anything to play with grub. What do u think i should do in this case.i tried find /boot
find/boot/grub
nothing
thanks

commented by Anonymous Anonymous, 9:02 AM  

Hi,
Perhaps your ghost of red hat linux did not grab the boot partition (if you had a separate partition) or maybe it didn't grab the boot loader correctly.
Here are some things you can try:

Try this

Try using this (read documentation on web page)

Read through this too, to see if anything applies (great resource to bookmark)

I hope this helps somewhat,
Good luck!

-linnerd40

commented by Blogger linnerd40, 8:16 AM  

Add a comment