[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
restoring GRUB loading after partition/device rename
From: |
Gary S. Trujillo |
Subject: |
restoring GRUB loading after partition/device rename |
Date: |
Sat, 18 Sep 2010 23:07:21 +0000 |
Greetings.
My machine, a Compaq notebook, has become unbootable - almost - due to
a set of circumstances I'll describe later. First, though, here where
things now stand.
The MBR of the internal drive has what I believe to be a good copy of
GRUB2 (though it's not acting as I would expect - more on that subject
also a bit later), and several partitions, including several for
Windoze (which I'm using now to write this plea for help), and three of
special interest:
/dev/sda6 (previously known as /dev/sda8): ext4 file system
/dev/sda7 (previously /dev/sda6): ext3 Linux /boot partition
/dev/sda8 (previously /dev/sda7): Linux swap partition
My problem is that GRUB knows about these file systems under their
previous names, not the new ones.
Here's what happened...
After a recent install of Ubuntu, I began installing software using
apt-get. However, I didn't know that the /boot partition would be
used during that process, so I had only allocated 80MB, which I
discovered in the process of updating the system is insufficient.
Since the /boot and swap partitions were immediately adjacent to one
another, I carved a bit off of swap to give to /boot, so it would
have 200MB, which seems sufficient. That part worked fine - I backed
up everything in /boot, freed the space in both partitions, using
fdisk, re-partitioned and restored the previous contents of /boot. So
far, so good. Then I tried rebooting, and found myself looking at a
GRUB rescue prompt. After booting into Knoppix using a USB stick, I
saw that the partitions had been re-arranged as indicated above.
I've spent time poring over various descriptions of how to recover
from such a situation, including an article at:
https://help.ubuntu.com/community/Grub2
which, though helpful in some general ways, leaves me somewhat
confused. The claim is made in the article that, though the grub2
rescue mode has a reduced command set, it includes commands like
"help," "cat," "linux" and "reboot," none of which are actually
available.
I was finally able to boot into Windoze using the advice in a GRUB2
manual I got on this site - at http://gnu.org/software/grub/manual/
using:
set prefix=(hd0,x)/grub
set root=(hd0,x)
insmod normal
normal
("x" being "7" in my case, to boot from /dev/sda7).
I could select the partition containing Windoze, but not the Linux one,
for reasons I can understand that have to do with incorrect device
names being encoded into the "grub.cfg" file.
Here's how the partition table looks, as fdisk sees it:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 203776 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 27 28622 229697339+ f W95 Ext'd (LBA)
/dev/sda3 28623 30389 14180352 7 HPFS/NTFS
/dev/sda4 30389 30402 105656 c W95 FAT32 (LBA)
/dev/sda5 27 10406 83377318+ 7 HPFS/NTFS
/dev/sda6 11202 28622 139934151 83 Linux
/dev/sda7 10407 10432 208813+ 83 Linux
/dev/sda8 10433 11201 6176961 82 Linux swap /
Solaris
The /mnt/boot/grub/grub.cfg file is shown at
http://pastebin.ca/1943856 .
If I try to boot from the Linux partition, which is the first shown in
grub.cfg, and go into edit mode, I see that the boot device is
identified by means of a UUID designator, which is something I don't
understand at present. I tried replacing both the device name ("sda6"
to "sda7") and the UUID name in that edit session and rebooting, but
nothing useful happens (I don't recall at this point exactly what
happened, except that it wasn't a boot into Linux). Here's a snippet
from "grub.cfg": insmod ext2 set root='(hd0,6)' search --no-floppy
--fs-uuid --set 23fdef48-e848-4c3f-9001-efe958b8cdf7 set
locale_dir=($root)/grub/locale set lang=en insmod gettext
Someone in an IRC channel suggested I try using "Super Grub
2" (http://www.supergrubdisk.org/). Though it gives me some
interesting information, I haven't yet figured out how to use it to
solve my problem. I intend to go back to it while waiting for replies
to this trouble report, however. (I found a note in the Wiki that
serves as documentation for Super GRUB 2 that it can't deal with
separate boot partitions (which I'm using because I hope to eventually
be able to replace the file system I'm using with a KVM volume, so I
can use encryption - however, for the time being, I've copied what's
in /boot into the /boot directory on that file system, so it would be
possible to boot from /dev/sda6).
I should also mention that I understand, from the help.ubuntu.com
article and elsewhere, that it is not possible to simply edit the
"grub.cfg" file the way that was possible with respect to "menu.lst"
under plain old GRUB. However, the "update-grub" command seems to not
take an argument, so it's seemingly not possible to edit the file while
booted into another system, like the Knoppix live system I've been
using to poke around has made possible (and Knoppix only has an old
regular GRUB version of "update-grub" anyway).
My questions at this point are:
1. Why don't I have access to all the GRUB 2 commands indicated in
the article at https://help.ubuntu.com/community/Grub2 in GRUB2
rescue mode?
2. What's the easiest way to figure out what all I need to do to
get myself back into a bootable condition, and what's the best
procedure to use?
3. Are there any other good resources anyone can recommend?
Thanks in advance for any advice or assistance!
- restoring GRUB loading after partition/device rename,
Gary S. Trujillo <=