LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Switching a Linux installation from hda to hdc (http://www.linuxquestions.org/questions/linux-software-2/switching-a-linux-installation-from-hda-to-hdc-591397/)

TTL_2 10-12-2007 06:58 PM

Switching a Linux installation from hda to hdc
 
Hello, I had to switch a Debian Linux installation, where the harddrive was previously working as primery master (hda), to work as secondary master. There is LILO (GRUB did not want to install for some reason) installed on the MBR on the harddrive. I can boot the drive, but end up with a busybox and complanations, that nothing can found. I have a Linux live CD and I tried to modify the /etc/lilo.conf with a success. But I can not write the changed lilo.conf back to LILO on the MBR. Running lilo from the live cd ends with complains that it can not write to /boot/<some place>.
The /dev/hda may not be changed.

How is it possible to get the system back working? Or is reinstalling the whole system the only solution?

Tinkster 10-12-2007 08:13 PM

The easy option would be to boot of a install CD with a rescue
option, tell it which partition to boot of, and then edit your
lilo.conf and run lilo, installing it in the MBR of the new
primary HDD ...



Cheers,
Tink

jlinkels 10-12-2007 09:20 PM

Quote:

Originally Posted by TTL_2 (Post 2922372)
How is it possible to get the system back working? Or is reinstalling the whole system the only solution?

That is the Windoze solution if you have an MBR problem! :)

Why couldn't you write to the /boot directory? Were you root? Did you properly indicate where the MBR should have been written to? Are sure you edited lilo.conf on your /dev/hdc and not on /etc while you were running the live CD?

This is a but mind boggling, but when editing lilo.conf, you have to mount the /dev/hdc1 partition. It mounts most likely in /mnt/hdc1. Then edit lilo.conf in /etc/hdc1/etc/lilo.conf.

This done, run lilo with these parameters (not tested!)

lilo -b /dev/hdc -C /mnt/hdc1/etc/lilo.conf

Do also not forget to edit lilo.conf so it contains the correct boot device.

Another option might be to use the '-r" option to chroot into /mnt/hdc1 and use lilo like if you already had booted from /dev/hdc.

Googling for "install lilo" will come up with a number of hits on step-by-step instructions. The most likely error that you migh make is to forget to properly point to /dev/hdc at some point in the installation.

jlinkels

TTL_2 10-13-2007 03:29 AM

Thank you for answering
Quote:

Originally Posted by jlinkels (Post 2922466)
That is the Windoze solution if you have an MBR problem! :)

Why couldn't you write to the /boot directory? Were you root? Did you properly indicate where the MBR should have been written to? Are sure you edited lilo.conf on your /dev/hdc and not on /etc while you were running the live CD?

This is a but mind boggling, but when editing lilo.conf, you have to mount the /dev/hdc1 partition. It mounts most likely in /mnt/hdc1. Then edit lilo.conf in /etc/hdc1/etc/lilo.conf.

This done, run lilo with these parameters (not tested!)

lilo -b /dev/hdc -C /mnt/hdc1/etc/lilo.conf

Do also not forget to edit lilo.conf so it contains the correct boot device.

jlinkels

/mnt/hdc1/etc/lilo.conf was properly edited.

If I run the command you mentionend from the live CD, I get:
#lilo -b /dev/hdc -C /mnt/etc/lilo.conf
Ignoring entry 'boot'
Fatal: creat /boot/boot.0.300: Read only file system

There are zero matches for '/boot/boot.0.300:' at Google.

Then I tried the installation CD of Debian, but found only a rescue mode which let me mount /dev/hdc1 as /. I ran the same command there once again
The result was (while sitting in /etc):
#lilo -M /dev/hdc -C lilo.conf
/boot.1600 exsists -no /dev/hdc backup
The master boot record of /dev/hdc has been updated

After rebooting, the BIOS did not detect /dev/hdc as bootable device anylonger :-(

I discovered that I accidentally replaced -C by -M, rebooted into the installer CD again and ran
#lilo -b /dev/hdc -C /mnt/etc/lilo.conf

the good news, now the system is starting again.
(Until it crashes now while starting the X Server, I did set the driver to vesa before).
Thank you. :)

jlinkels 10-13-2007 09:26 AM

Good!

However I can recommend to migrate to Grub one day. If you can get it to work, it is really easier and more powerful than Lilo. To my surprise I have noticed that on some systems I upgraded Lilo is back. (Now I almost never boot my systems so it usaully remain unnoticed or unfixed) Grub is easier to change (you don't have to run Lilo after making a change) and you are able to change settings during the boot processes.

I don't know why you installation failed, and mine often does as well, but after some trying I usually succeed.

jlinkels

Tinkster 10-13-2007 02:48 PM

And lilo has a feature that grub is lacking: you can choose
which kernel/OS to boot on the next boot as a one off before
shutting the current session down. Now that's cool.

I install lilo where ever possible ;}


Cheers,
Tink

Junior Hacker 10-13-2007 03:20 PM

Quote:

Originally Posted by TTL_2 (Post 2922372)
There is LILO (GRUB did not want to install for some reason)

I get this all the time when installing grub to the partition, it will fail. So I go through the motions again choosing the same spot (partition), and it installs the second time around.

ghostdancer 10-13-2007 04:10 PM

It should not be difficult. Basically, put your disk as hdc, from here, boot from your rescue CD. Edit your lilo.conf and fstab so that they now reference to hdc instead of hda. After this is done, chroot to your root directory (if you mount your root in /mnt then cd into /mnt), run lilo. It should update all your boot information and mount the correct partition after it boots.

However, you may need another OS loader if your hdc is not the first boot disk.

jlinkels 10-13-2007 09:16 PM

Tinkster,

Grub has the functionality to boot once in the new kernel as well. http://www.gnu.org/software/grub/man...llback-systems

As a matter of fact it is easier to use than LILO where you have to issue a special command to boot once into the new kernel if I am not mistaken.

jlinkels

Tinkster 10-13-2007 09:58 PM

That's not the same.

If I, for instance, happen to work with a 2.6.21.5 kernel and
then compile a 2.6.23.1 myself ... I add that one to lilo.conf,
run lilo, and then e.g. invoke lilo -R 2.6.23 ... now, the next
time the box boots lilo will load that kernel. It's very handy
if you don't display the lilo menu (which I don't) by default.

The grub thing only allows for a "cascading fallback". Different
kettle of fish.


Cheers,
Tink


All times are GMT -5. The time now is 10:45 PM.