Changing Linux on Slave Drive to Master Drive

Status
Not open for further replies.

wheninrome

TS Rookie
I have Windows XP installed as the master drive (hda) and Mandriva 10.2 Linux on the slave drive (hdb). I want to physically remove the WinXP hard drive from my computer and make Linux the only drive. I boot up the computer using LILO, which is installed on hda. So how do I do all of this without messing up the bootloader settings?
 

jobeard

TS Ambassador
First, save the existing /etc/lilo.conf; cp /etc/lilo.conf /etc/lilo.0901705.conf

Second, read manpage re mkbootdisk. you may need this to recover the as-is configuration

Third, I found it a lot safer to work out my LILO configuration using a floppy boot disk rather than my hard disk. To do this, you must replace the boot=/dev/hda with boot=/dev/fd0 in the lilo.conf file. That way, if I messed up any of the configuration in my lilo.conf file, I could take out the boot disk and boot into Linux as before. Once I was happy everything booted fine using the floppy disk, I then changed my lilo.conf back to use boot=/dev/hda and ran /sbin/lilo a final time to upload my changes.

man 8 lilo explains the program options
man 5 lilo.conf explains each line in the conf file

before you make changes, issue the following as documentation
...mount
later, this command will show /dev/hda? on / type ext2 (r/w)
when you're successful

Your existing LILO config should be at /etc/lilo.conf and will contain
items like:
boot = /dev/hdb? (first HD, some partition number suffix)
... bunch of stuff best left alone
image = ... whatever it says
.label = ... your lilo prompt at boot time
.root = ... /dev/hdb? (note it matches line 1)
other = /dev/hda1 (first HD, 1 partition)
.label = WinXP (the lilo prompt for XP)
.table = /dev/hda

delete the lines from OTHER to the bottom,
change hdb? to hda? (ie the same partition number, just different drive)
save the modification to disk

create the LILO floppy: try the -t option to see what it would do before doing it,
and use boot= /dev/fd0 until you're pleased with the result.

power down and move the 2hd to the end of the cable (cable select)
and set as master if needed. the first hd can be used later via /etc/fstab

insert the floppy and boot from it (you may need to change BIOS)

if all is well, you will see your full system running and the command mount
will verify the results.
Now you can change the boot= /dev/fd0 back to boot= /dev/hda?
and do the update for real.

booting from the HD should be safe and give you what you want.

ISSUE: /etc/fstab lines containing HDxy will need adjusting
If you have several MOUNTABLE devices, this table may interfer with your
results.
Until booting the HD works, rename this file with the 'mv' command.

Moving the cable connector will swap hda and hdb notations.
When you recable the original HD, you have two options:
use the space as DOS FAT or reformat as Linux ext{2,3}
If you reformat the original, then all hda entries can be deleted.
Any hdb entries in the saved fstab file need to become hda

Modifications to /etc/fstab can be utilized immediately via
login as root or the su command

The new hdb will need a mount-point, so cd /
mkdir /originalHD
and then you can mount eg 'mount /dev/hdb /originalHD'
Another typical location for mounts is /var/mnt/xxx
 
Status
Not open for further replies.

Latest posts