Coaxing Linux Hard Drive to Boot

The Problem

I had a hard drive onto which I had manually copied the files from another booting hard drive. I needed to get this new drive to boot. The machine from which the original hard drive came only has a slot for one IDE drive and the cable only has one connector. To get around this, I removed the original hard drive, connected it into a Linux test bed machine, and copied all the files onto that machine’s hard drive; then I shutdown the system, connected the new hard drive, and copied the files onto it.

I had all the data, but the drive was not configured to boot. I knew I needed to run /sbin/lilo with the appropriate settings in lilo.conf. This was complicated because the drive was /dev/hdb in the test machine, but would be /dev/hda in the machine where I needed it to boot. I tried several variations of settings in lilo.conf, but I never was able to get the machine to boot.

Along the way, I messed up the boot set up for /dev/hda in the test bed system. I managed to recover from that by using a RedHat Linux Crash Recovery Kit.

By disconnecting the primary drive in the test bed and changing the jumpers so the new hard drive was primary (not slave), the same procedure made that disk bootable.

The Solution

In the instructions that follow, text following "> " is a Linux command that should be entered from the command line.

1.Boot from Crash Recovery Kit

I used a CD-ROM that I created from a RedHat Linux installation, but any similar kit should work. This kit installs the system on a RAM disk.

2.Follow the Kit instructions

In my case that was:

At the "boot:" prompt hit ENTER
At the "tinker login:" prompt type root
> install-cdrom
(enter CD-ROM device name; in my case that was "hdd")
> /cdrom/sbin/install-utils

3.Mount the Hard Drive

> mkdir /newhd
> mount /dev/hda1 /newhd

4.Run LILO

> mv /boot /boot_curr
> ln -s /newhd/boot /boot
> /newhd/sbin/lilo -C /newhd/etc/lilo.conf



This page is not intended to be a primer on how LILO works. For that, I recommend the LILO User’s Guide by Werner Almesberger, which should be installed at /usr/doc/lilo/doc/

Note: lilo may need to be replaced with a name that includes a version number, such as lilo-0.24.

Send me reports of any errors or suggestions you have about my Linux pages.