General
cancel
Showing results for 
Search instead for 
Did you mean: 

making Linux HD Primary Master FROM Secondary Master

icedT
Frequent Advisor

making Linux HD Primary Master FROM Secondary Master

hi. just a confusion. . . can i make my Linux HD the Primary master from its current setup (secondary master)? My current setup now is WinXP primary master, Secondary Master Linux HD and Secondary slave is CDROM. . now i want to interchange the location my WInxp and Linux HD.
16 REPLIES
Ivan Ferreira
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

Are you talking about physically swapping drives? Yes you can.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Stuart Browne
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

Just be aware that if you do this, you'll need to mark the appropraite partition on the secondary master to be an 'Active' partition, and ensure it has a boot-loader (grub) installed into it's master-boot-record.
One long-haired git at your service...
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

okay.. my bootloader is LILO.. but wait isn't that IF i interchange them i MUST edit my lilo for the partitions involved? the primary hd (windows) is read as, hda (hda1 hda5) C: and D:
while my linux is read as hdc*
Ivan Ferreira
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

Yes, you have to edit your configuration files where the devices/partitions change. LILO and /etc/fstab are these files. You also probably need to re-install lilo after the disks changes, and modify the boot and root statements as required.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matti_Kurkela
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

Note that in Linux, IDE HDs are named according to their position on the bus, i.e.
/dev/hda = Primary Master
/dev/hdb = Primary Slave
/dev/hdc = Secondary Master
/dev/hdd = Secondary Slave
etc.

So, when you physically swap the disks around, your old /dev/hda will become /dev/hdc and vice versa.

As others have indicated, you'll have to re-configure your LILO bootloader.

Activating the correct partition may or may not be necessary: if LILO is installed in the Master Boot Record of the new disk, it can run things from any partition regardless of whether the partition is active or not. But if LILO is installed to the boot record of the individual Linux partition, that partition needs to be marked active so that the MBR will find and activate LILO.

You'll also have to check your /etc/fstab file in Linux. If your partitions have been identified using /dev/hd* style names, you must change them to match the new situation. If your /etc/fstab is using "LABEL=..." or "UUID=..." style definitions for Linux partitions, the system should be able to find the correct Linux partitions with no changes required.

Note that your WinXP may become very confused if you change the disks around.

MK
MK
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

hmm sounds risky. . .i think i will not anymore move my Linux HD. . . It may be a one hell of a problem if i attempt to do that. . :(
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

ei guys.. WHAT IF.. i just stick to my current CMOS setup. Primary Master -WInxp and Secondary Master LInux.. BUT since my winxp does not boot (hangs)THEN outputs binary number(0,1)when i disconnected the Secondary Master HD.


the concern happened when i changed the battery of my motherboard.

Now i just want to completely format my winxp HD.. and since you guys said that primary master is read as /hda* then is there a clear possibility that I will be successful in my attempt? (since after reinstalling winxp,) linux will still read my windows hd..
Matti_Kurkela
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

It's hard to know for sure, from the little bits of information you've told so far.

It would be easier to analyze the situation if you could show us all of the following:
- the output of "fdisk -l /dev/hda" in Linux
- the output of "fdisk -l /dev/hdc" in Linux
- the contents of your /etc/lilo.conf file
- the contents of your Windows C:\BOOT.INI file (it may be hidden, so it might be easiest to find it using Linux)

In an IDE system, the BIOS normally boots the system from the first disk it finds. Some BIOSes have an option to change this.

In some older machines the boot order was specified using DOS-style C: and D: drive letters, so the actual meaning was quite obscure. "Boot from C:" meant "boot from the first detected hard disk", just as usual. But "Boot from D:" meant "find the first two bootable disks, swap them around so that the second bootable disk is presented to the OS (or bootloader like LILO) as the first one, then boot from it." With DOS, this actually causes the C: and D: drive letters to switch places.

Using the BIOS "Boot from D:" option with modern operating systems just causes lots of confusion since the BIOS can fool the bootloader but not the actual OS.

You say your WinXP boot started to fail after the failure of the motherboard battery. This suggests your BIOS's boot disk selection option might have had been set to a non-default value originally. The battery failure probably caused a reset to default values.

What I cannot understand as yet is how your LILO bootloader still works after the battery failure...

By "binary numbers" do you mean a repeated string like "01 01 01..."? This is actually a LILO error message, and it means BIOS is not liking the commands LILO is trying to use.

This suggests your LILO may be installed on the Primary Master disk BUT gets its configuration and other data from the Secondary Master disk. If so, wiping either of the two disks is likely to make the system unbootable unless some preparations are made in advance.

We'll need all the information I asked above to plan a way to straighten this.

You might want to download and burn yourself a Knoppix Live CD: it's a Linux installation that is completely self-contained on a CD-ROM, using RAM disk as a work area. It has a lot of tools available, so it allows you to do some serious system surgery if necessary.
See:
http://www.knoppix.org

MK
MK
Andrew Cowan
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

When you say swap your drives, do mean physically? If so you need to swap the jumpers on the, or change their sockets if they are installed with "cable select".

Remember that both Grub and the BIOS can only report what they see, and not physically change it.

If you swap the jumpers/cables, you now need to edit Grub and the Windows boot loader to point to the new locations.
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

ok thanks for replies..il give comments after.
btw im using LILO. and now.. since i cant use my windows HD.. i just use my LInux. and yes all of my installed linux in the secondary master HD is all working. and my files in windows are still accessible tru linux
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

- the output of "fdisk -l /dev/hda" in Linux
root@darkstar:~# fdisk -l /dev/hda

Disk /dev/hda: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 2449 19671561 c W95 FAT32 (LBA)
/dev/hda2 2450 4998 20474842+ f W95 Ext'd (LBA)
/dev/hda5 2450 4998 20474811 b W95 FAT32



- the output of "fdisk -l /dev/hdc" in Linux
root@darkstar:~# fdisk -l /dev/hdc

Disk /dev/hdc: 80.0 GB, 80026361856 bytes
16 heads, 63 sectors/track, 155061 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 19376 9765472+ a6 OpenBSD
/dev/hdc2 19377 38752 9765504 83 Linux
/dev/hdc3 38753 58128 9765504 83 Linux
/dev/hdc4 58129 155061 48854232 5 Extended
/dev/hdc5 58129 62003 1952968+ 83 Linux
/dev/hdc6 62004 62197 97744+ 83 Linux
/dev/hdc7 62198 64135 976720+ 82 Linux swap
/dev/hdc8 64136 66073 976720+ 83 Linux
/dev/hdc9 66074 68011 976720+ 83 Linux
/dev/hdc10 68012 77699 4882720+ 83 Linux
/dev/hdc11 77700 97075 9765472+ 83 Linux
/dev/hdc12 125998 155061 14648224+ 83 Linux
/dev/hdc13 97076 125997 14576656+ 83 Linux




- the contents of your /etc/lilo.conf file


to follow. .

- the contents of your Windows C:\BOOT.INI file

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect
Andrew Cowan
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

In order to boot the Windows disk simply edit the boot.ini to point to disk(1) and rdisk(1). Windows can sometimes have problems when you do this as there are many references in the registry that get broken. The best way to solve this is to boot from a Windows-CD and then load-up the rescue console and run the bootmgr repair utilities. I can't remember the names off hand but if you look for everything called boot and then run the man pages it is very simple to achieve. This will of course overwrite the Linux MBR so you will then ahve to boot Linux from CD and overwrite it again with Grub/LILO.
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

so do you mean that FROM THIS:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect


IT WILL BECOME LIKE THIS :

[boot loader]
timeout=30
default=multi(0)disk(1)rdisk(1)partition(1)\WINDOWS
[operating systems]
multi(0)disk(1)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect



************************************


then use slack CD.. mount the partition where my LILO.CONF resides.. then RE - RUN lilo /sbin/lilo -v

and it will be ok?

Andrew Cowan
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

That looks right to me. You have two ways of doing this though. If you boot your Linux distro and then:
dd if=/dev/sda of=/tmp/boot.lnx bs=512 count=1

You can then leave the Linux disk as is and then add an extra OS entry to the Windows boot loader, copy the "boot.lnx" file onto the Windows volume, and boot like that, either way will work, it just depends on whether you prefer LILO or Windows boot.

The bad news is that whenever you patch either OS it will overwrite the MBR and so be prepared to repeat this procedure in the future.
icedT
Frequent Advisor

Re: making Linux HD Primary Master FROM Secondary Master

****************************************

1

That looks right to me. You have two ways of doing this though. If you boot your Linux distro and then:
dd if=/dev/sda of=/tmp/boot.lnx bs=512 count=1


2

You can then leave the Linux disk as is and then add an extra OS entry to the Windows boot loader, copy the "boot.lnx" file onto the Windows volume, and boot like that, either way will work, it just depends on whether you prefer LILO or Windows boot.


3

The bad news is that whenever you patch either OS it will overwrite the MBR and so be prepared to repeat this procedure in the future.

***************************************


uhm,,,, sir i am sorry but item 1 and 2 are quite blurred to me... can you explain it in a detailed manner if its ok? :)


item 3 pertains to re running LILO.. do i get it correct?
Andrew Cowan
Honored Contributor

Re: making Linux HD Primary Master FROM Secondary Master

1 Boot your Linux distro and then:
dd if=/dev/sda of=/tmp/boot.lnx bs=512 count=1

To do this open a shell session. The command creates the (of) file "/tmp/boot.lnx" and it is 512 characters long. The input file (if) is the name of the disk device that contains the Linux boot loader that LILO starts when you boot the machine. This is like creating a boot floppy in DOS. When you copy this file to your Windows partition, you can then edit the Windows "boot.ini" as follows:

Open a DOS Window:
cd \
attrib -s -h -r boot.ini
edit boot.ini

c:\boot.lnx="Linux"

# Save the changes you made to BOOT.INI and then return to the command prompt and type:

attrib +s +h +r boot.ini

# If you wish to change the order of the selections in the boot manager screen (e.g. to make Linux appear before Windows), just change the order of the relevant lines in BOOT.INI. Likewise, if you wish Linux to be the default selection, change the text after the "default=" line to:

default=c:\boot.lnx

Close the DOS Window and reboot.

You should now be able to boot Linux from Windows.