Re: How to restore MBR and LILO

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: How to restore MBR and LILO
On Tue, 2004-08-03 at 12:33, Josef Lowder wrote:
> Joe first wrote:
> >> ... I have tried all the remedies I could find on the 'net, including:
> >>         /sbin/lilo -v
> >> which produces the following response:
> >>   Unrecognized token "! Please edit /etc/lilo.conf before running lilo!"
> >>   at or above line 20 in file '/etc/lilo.conf'
> >> I checked /etc/lilo.conf on hda6 and it looks fine to me.
> >> Can't figure out what else to try.
> >> Any suggestions?

>
> Craig wrote:
> > boot from the D*mn small Linux cd and run " fdisk /dev/hda -l "and
> > view the partitions. They may have been renumbered - Partition Magic
> > is capable of changing things in ways that you may not anticipate.
> >
> > I think that you are going to have to chroot to the root directory
> > of your Linux installation and actually run lilo again (lilo -v)
>
> ----------------------------------------
> Here is the result f fdisk /dev/hda -l
>
> Disk /dev/hda: 4099 MB, 4099866624 bytes
> 128 heads, 63 sectors/track, 993 cylinders
> Units = cylinders of 8064 * 512 = 4128768 bytes
>
>    Device  Boot    Start       End    Blocks   Id  System
> /dev/hda1             419         993     2318400    5  Extended
> /dev/hda2   *           1         418     1685344+   b  Win95 FAT32
> /dev/hda5             419         425       28192+  83  Linux
> /dev/hda6             426         764     1366816+  83  Linux
> /dev/hda7             765         898      540256+  83  Linux
> /dev/hda8             899         993      383008+  82  Linux swap

>
> Partition table entries are not in disk order
> ----------------------------------------
>
> I was unable to execute 'chroot' (don't know what syntax to use),
> so I used sudo passwd to get to root, mounted /mnt/hda6, cd'd
> to /mnt/hda5/root and typed: lilo -v ...
> But I still got the same error response.
>
>    Unrecognized token "! Please edit /etc/lilo.conf before running lilo!"
>    at or above line 20 in file '/etc/lilo.conf'

>
> What am I doing wrong?
> Where is the MBR? hda1? hda5? What is in each of those?
>

----
guessing that /dev/hda6 is your root dir...

it's been a while since I did an emergency disk boot/restore but I
vaguely recollect that on the RH linux rescue...

it would mount things in /tmp/sysimage

it really doesn't matter how you do it - if it is logical.

cd /tmp
mkdir sysimage #if it doesn't already exist
mkdir sysimage/root
mount -t ext2 /dev/hda6 /tmp/sysimage/root
chroot /tmp/sysimage/root

at this point, your root directory has changed to that which is on
/dev/hda6 - depending upon what is on /dev/hda5 and /dev/hda7 - you may
be able to ignore them but you can probably now get a clue by
cat /etc/fstab
My guess would be /dev/hda5 is /boot and /dev/hda7 is /usr or hopefully
(because this would cause a whole lot less headache), hda7 is /var. You
can mount them with a command similar to above...
mount -t ext2 /dev/hda5 /boot #verify from /etc/fstab
mount -t ext2 /dev/hda7 /var #verify from /etc/fstab

At this point, you should review your /etc/lilo.conf to make sure that
it points to the right 'devices' and once satisfied, issuing the command
lilo -v
should write the proper lilo without error

The mbr is located on /dev/hda - and not within any partition.

Again, it's been a while since I did anything like this and this isn't
gospel but it's bound to be close and someone may correct or offer some
missing steps. I also haven't used lilo for a long time as Red Hat
switched to grub somewhere about 7.2

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss