LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can Grub /LILO be installed on the logical partition? (http://www.linuxquestions.org/questions/linux-newbie-8/can-grub-lilo-be-installed-on-the-logical-partition-393047/)

canaan 12-15-2005 03:37 AM

Can Grub /LILO be installed on the logical partition?
 
I hava only one hard disk of 40G and have already installed Win98 and Win2000 on it. Now I want to install Fedora Core 4.

There are one primary partition and one extended partition for it. To make it clear I use the term of linux to describe the current partition info:

/dev/hda1 FAT32 4G the boot partition for Win98 and win2000
/dev/hda5 NTFS 10G the partition to store the WINNT
/dev/hda6 FAT32 10G data storage for both WIN98 and Win2000
/dev/hda7 NTFS 10G for Win2000
/dev/hda8 NTFS 6G for Win200

Since there are many data on hda6 and hda7, so I only want to use the last logical partition to install FC4.

Also I don't want to install Grub in the MBR.

My plan is to delete the logical partition hda8 by windows disk manager. And then create partition during the installation of FC4.

Since I don't update the extended partition, can I create new primary partition on the released space?

Since linux supports to be installed and booted from extended partition, can I just create logical partition for / partition(say /dev/hda8 of 4G) and swap partition (say /dev/hda9 of 1G) and install FC4 on them? can I install Grub on the newly created logical partition (/dev/hda8)? If yes, where did the Grub is stored? in the boot sector of newly created logical partition(/dev/hda8)? If no, why? Thanks!

syg00 12-15-2005 04:46 AM

Quote:

Originally Posted by canaan
Since I don't update the extended partition, can I create new primary partition on the released space?

No - merely deleting a logical partition will provide you with free space within the extended. This is not available for primary(s) unless you shrink the extended.
Quote:

Since linux supports to be installed and booted from extended partition, can I just create logical partition for / partition(say /dev/hda8 of 4G) and swap partition (say /dev/hda9 of 1G) and install FC4 on them?
Yes
Quote:

can I install Grub on the newly created logical partition (/dev/hda8)?
Yes
Quote:

If yes, where did the Grub is stored? in the boot sector of newly created logical partition(/dev/hda8)?
Yes. But also requires space for the stage2 files (typically /boot), and maybe stage 1.5 - your planned arrangement should accomodate all this o.k.

pixellany 12-15-2005 09:15 AM

1. Get rid of Windows 98---2000 is bad enough, and it will do anything 98 will do.
2. Seriously consider getting another 40Gb drive. They are cheap and will give you a LOT more flexibility.
3. If the bootloader (Windows, Grub, Lilo, etc.) is on the hd, it MUST be in the first sector---technically it is not in a partition.
4. Consider putting your Linux bootloader on a floppy--this avoids messing with the Windows installation.

I would recommend a clean install in your situation. Windows (1) and Linux will fit on the same drive, but not leave much room for data.

Install Windows first, then Linux. The Linux installer will let you chose a partitioning scheme, choose how the bootloader is installed, etc.

Obviously, back up all your data before starting.

syg00 12-15-2005 11:03 AM

Quote:

Originally Posted by pixellany
3. If the bootloader (Windows, Grub, Lilo, etc.) is on the hd, it MUST be in the first sector---technically it is not in a partition.

Not true.
Only Microsoft loaders enforce writing to the MBR of the primary BIOS bootdisk upon installation.
lilo and grub do not - they can be installed to a partition sucessfully. It's done all the time, and chainloading used to activate them. In fact you don't even need a loader in the MBR, if you choose to load from floppy or CD.

pixellany 12-15-2005 03:47 PM

I stand corrected....

I understand grub on a floppy--pointing to where the rest of the code is.

If using only a hard drive, and putting grub on some random partition, how does the system find it? Do you not have to put **something** in the first sector?

syg00 12-15-2005 06:12 PM

Certainly - if only using the HD. As I said, other options exist.
The BIOS goes looking for loader code in the initial sector of each of the devices in your list of boot devices. Has to find one somewhere to proceed.
And of course stops looking when it finds one - hence the ability to use boot CDs to override the HD boot.

I wasn't suggesting that anyone run with no loader code in the (HD) MBR - merely pointing out it was possible.

pixellany 12-15-2005 06:25 PM

Actually, I think we have been saying the same thing...Let's test:

Using grub, Stage 1 needs to in the first sector of either a hard disk or a floppy.

For a CD, do we speak of sectors, or is there a new langauge to learn?.....;)

canaan 12-15-2005 08:52 PM

Thank you syg00 and pixellany for your replies.

So if my arrangement is OK, then what will the boot process be?

If I don't activate the extened partition /dev/hda2, the following depicts my understanding of the boot process, is it correct?
1. MBR on the first sector of my HD is loaded;
2. windows boot loader on the boot sector of /dev/hda1 (this is for win98/2000) is loaded(since the partition /dev/hda1 is active);
3. NT loader is loaded;
4. LILO/Grub on boot sector of /dev/hda8 is loaded(this need I to put a bootsect file on the root partition of windows, i.e./dev/hda1);

Then if I activate the extened partition /dev/hda2(I know this can not be done by fdisk of DOS, and the utility provided by linux, activate, supports to activate an extended partition), what will be the boot process? Since DOS-MBR only knows to find a partition marked as active, in this case, the LILO/Grub is on the boot sector of logical partition /dev/hda8, while not the boot sector of extened partition /dev/hda2, how can the LILO be found and loaded by the DOS-MBR?

Is there any other possible boot processes based on my settings:
First sector of /dev/hda : DOS-MBR
Boot sector of /dev/hda1 : windows boot loader
Boot sector of /dev/hda8 : LILO/Grub

Thanks!

syg00 12-15-2005 09:10 PM

Basically you have it correct.
Do not make any Linux partition active/bootable. It is not used (nor required), and will cause issues with the microsoft installers if you need to re-install in the future.

The ntldr code will present you with whatever you specify in boot.ini. After you have copied the boot sector record over, add an entry for it in boot.ini, and you can choose either to boot.
Nothing else required.

Not my recommended way of doing it, but will work fine.
Don't attempt this with lilo - every time you update the conf file you need to rerun the lilo command, and then re-copy the altered boot sector record across to Windows again.
Gets to be a PITA - was the reason I gave up on lilo years ago.

canaan 12-15-2005 09:35 PM

Understood.

Let me make my question more clear as below.

I remember that DOS-MBR can choose any partition marked as active(primary or extended), so If I installed the LILO boot sector on the boot sector of extended partition /dev/hda2 instead of logical partition /dev/hda8, I think I don't need the NT loader, just mark /dev/hda2 as active(this will make the /dev/hda1 as inactive) then I can boot linux through
1. MBR on the first sector of my HD is loaded;
2. LILO/Grub on boot sector of /dev/hda2 is loaded;

But now if I install LILO boot sector on logical partition /dev/hda8, and only activate /dev/hda2, can I still boot my linux as above, I think I can't.

syg00 12-16-2005 02:58 AM

No, I suspect you don't understand.

- M$oft loaders *ONLY* load from primary partitions. No ifs, no buts. I just went and checked, as I haven't looked at a Win98 loader in years.
- Marking a second partition as active does not "unmark" any previously marked partition. In fact this messes with M$oft installers something chronic.
- I don't know if you can mark an extended partition as active - the concept is so "off the wall" I've never even considered it.
Only logical partitons (not extended) have filesystems, so can contain boot sector records.
If you could write a loader to an extended partition, you would be over-writing the partition table - you really don't want to do that.

Do as you wish - just don't expect anyone to rescue you if you decide to proceed on the "off the wall" path.

canaan 12-16-2005 03:52 AM

Quote:

Originally Posted by syg00
- M$oft loaders *ONLY* load from primary partitions. No ifs, no buts. I just went and checked, as I haven't looked at a Win98 loader in years.

Do you mean the DOS-MBR only check for primary partitions whether it is active? (The Extended Partition is not checked) Is there any reference that I can have a look? If this is right, the followings are not worth reading.

Quote:

Originally Posted by syg00
- Marking a second partition as active does not "unmark" any previously marked partition. In fact this messes with M$oft installers something chronic.

Some tools can help to do mark the extended partion active and mark the previous active partion inactive, so I think I can do this anyway, right?;) I know this way may cause some issues of M$. But my idea is as below:
I want to use DOS-MBR(the Master Boot Sector) to load LILO(the Partition Boo sector) then load linux or other OSes.

So if DOS-MBR don't check extended partition for the active flag, then I can only install LILO on the partition boot sector of a primary partition.

Quote:

Originally Posted by syg00
- I don't know if you can mark an extended partition as active - the concept is so "off the wall" I've never even considered it.

activate utility from Redhat can do this.

Quote:

Originally Posted by syg00
- Only logical partitons (not extended) have filesystems, so can contain boot sector records.
If you could write a loader to an extended partition, you would be over-writing the partition table - you really don't want to do that.

I also have the same concern as you. That's why I post another question in this forum. But I DO have seen some documents mention about the boot sector of extended partition. Refer to "LILO Generic boot loader for Linux Version 21 User's guide" please(section 1.1).

Quote:

The LILO boot sector is designed to be usable as a partition boot sector. (I.e. there is room for the partition
table.) Therefore, the LILO boot sector can be stored at the following locations:
 boot sector of a Linux floppy disk. (/dev/fd0, : : :)
 MBR of the first hard disk. (/dev/hda, /dev/sda, : : :)
 boot sector of a primary Linux file system partition on the first hard disk. (/dev/hda1, : : :)
 partition boot sector of an extended partition on the first hard disk. (/dev/hda1, : : :)3
3Most FDISK-type programs don't believe in booting from an extended partition and refuse to activate it. LILO is ac-
companied by a simple program (activate) that doesn't have this restriction. Linux fdisk also supports activating extended
partitions.

Quote:

Originally Posted by syg00
Do as you wish - just don't expect anyone to rescue you if you decide to proceed on the "off the wall" path.

I only want to make it clear whether my idea is feasible or not. Thanks!

pixellany 12-16-2005 09:10 AM

I'm finding this discussion increasingly confusing. Without getting into **extended** partitions, my understanding is that the hd starts with 63 sectors (#0-#62) of "overhead"---used for boot loaders, partition tables and ??.
Then, starting in sector 63, is the first partition. (More precisely, 63 is the beginning of the space available for partitions)

For all of my installs, I find the bootloader in sector 0, followed by a partition table with four entries, and ending with a "signature"---55aa (hex).

When there are more than four partitions on the disk, one of the first four entries is an extended partition, and there is another partition table on the 2nd sector (#1).

The way I read it, boot sectors are not part of partitions.

canaan 12-19-2005 09:18 PM

From my understanding, the extended partition also has Boot Record that is called Extended Boot Record, and it contains partition tables for the extended partitions. It will has two entries, one for the logical partition of itself, and the second points to the next Extended Boot Record(also contains the partition table), so that the extended partition table are chained.

Simple my question as below:
I will install linux on the third logical partition(/dev/hda8) of my disk as below,
/dev/hda1 FAT32 4G the boot partition for Win98 and win2000
/dev/hda2 EXT 36G DOS exended partition
/dev/hda5 NTFS 10G the partition to store the WINNT
/dev/hda6 FAT32 10G data storage for both WIN98 and Win2000
/dev/hda7 NTFS 10G for Win2000
/dev/hda8 ext3 5G linux root partition
/dev/hda9 swap 512M linux swap

If I use the logical partition as the linux partition, and choose to install LILO in the boot sector of linux partition, where will this LILO boot sector located?
The first sector(partition table sector) of the logical partition /dev/hda8(that contains the partition table), or the boot sector of logical partition /dev/hda8(almost the 63 sector of that partition)? or anywhere else?

Refer to the following structure of a logical partition of exteneded partition:

|partition table sector|unused|boot sector|inode part |root dir part|data part|
|partition table sector|unused|boot sector|inode part |root dir part|data part|
|partition table sector|unused|boot sector|inode part |root dir part|data part|


All times are GMT -5. The time now is 05:38 AM.