"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, linux-questions-only@ssc.com
Starshine Technical Services, http://www.starshine.org/


(?) How Many Ways Can I Boot Thee: Let Me Count Them

From Wilke Havinga on Tue, 17 Nov 1998 (from the L.U.S.T List)


>I understand that Linux cannot be on the slave drive.

(!) You misunderstand. Linux can be installed on most combinations of devices. You can have the kernel on any drive where your loader can find it (for LILO that means anywhere that your BIOS can access, for LOADLIN.EXE --- a DOS program that means anywhere that DOS can access).
You could put your kernel completely outside of any filesystem, laying it out at some arbitrary location on some hard disk. So long as you can get your loader code to find it --- you can load that kernel. (You could use the /sbin/lilo utility to prepare this particular set of LILO boot blocks and maps --- since it needs to find the kernel image and it's a linux program. However you could hand craft your own maps if you were really determined to have a kernel laying on the unused portion of track zero or on some part of your disk that was between or after the defined partitions).
Once the kernel is loaded it looks for a root filesystem. For any given kernel there is a compiled-in default. This can be modified using the 'rdev' command (which performs a binary patch of the kernel image). It can also be overridden by supplying the kernel with a command line parameter (root=). There are a number of kernel command line parameters (all of the form: option=value) --- these can be passed to it via the LILO "prompt" or the /etc/lilo.conf append= directive, or on the LOADLIN command line (among others).
Read the BootParam HOWTO and man page (section 7 of the man pages) for details about kernel parameters.
You can boot a kernel directly from a floppy (just dd the kernel image to the raw floppy). You can also use LILO on a floppy. You can create a bootable DOS floppy with a copy of LOADLIN and a linux kernel on it (with an AUTOEXEC.BAT if you like). You can even use the SYSLINUX package (available as DOS and linux binaries). This modifies a (non-bootable) DOS formatted floppy to boot a Linux kernel (and is used by the Linux Router Project and Red Hat boot diskettes).
It is also possible to boot Linux from some sorts of FlashROM and ROMdisk emulators and from other forms of ROM installation. You can even boot Linux across a network using a boot prom for those ethernet cards that support them (for example).
Igel makes PC hardware with embedded versions of Linux for their line of X terminals, thin clients and "Ethermulation"/"Etherterminals" (thse boot from flash). http://www.igelusa.com. Also there are many discussions of alternative boot methods and devices that are regularly discussed on the "Embedded Linux" mailing list at 'http://www.waste.org/mail/?list=linux-embedded'

(?)
>Hmm... That's odd, because I have Linux on a slave HD right here on this
>computer and it works fine. I'm certain it doesn't have trouble getting
>at drives on the secondary controller, either.

Booting with LILO? Or Loadlin?

[prior partition dicussion snipped] Don't forget, Linux needs a swap partition.

This is not entirely true, if you have enough RAM (like, >64MB will be enough for most people) you don't need one. It's only that RedHat requires you to have one (which I find pretty annoying sometimes because you can have only 4 partitions on a drive, especially on large drives).

(!) While technically you are correct, you don't need a swap partition, this is bad advice.
You'll find that you performance suffers dramatically without one. Although I make a couple of 64M swap partitions available on my system (allowing Linux to load balance across a couple of spindles if it should ever need to), it typically used about 30K of swap even when I have plenty of RAM free (most of it is used in file/cache buffering).
Read the kernel list archives and search for the term "swap" and you'll find that the consensus among the kernel developers is that you need swap to get decent performance out of the current kernels. Some have even reported that using 100 or 200K RAM disk with a swap file on it will dramatically improve the performance over using all of your memory as straight RAM.
So, Red Hat's insistence may be irritating --- but it is not wholly without cause.
You are wrong about the number of permitted partitions per drive. You can have four primary partition entries. One of those can be an "extended" partition. That extended partition can have "lots" of partitions. Let's look at an example from 'antares', my decade old 386DX33 with 32Mb of RAM and a full SCSI chain:
Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders
Units = cylinders of 608 * 512 bytes

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/hda1   *        1        1      107    32509    4  DOS 16-bit <32M
/dev/hda2          108      108      684   175408   a5  BSD/386
.... and old FreeBSD partition that I haven't used in a couple of years. This is the boot drive. I use LOADLIN to get into Linux.
Disk /dev/sda: 64 heads, 32 sectors, 1908 cylinders
Units = cylinders of 2048 * 512 bytes

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/sda1   *        1        1       32    32098+  83  Linux native
/dev/sda2            5       32      102    72292+  82  Linux swap
/dev/sda3           14      102     1907  1847475    5  Extended
/dev/sda5           14      103      236   136521   83  Linux native
/dev/sda6           31      236      495   265041   83  Linux native
/dev/sda7           64      495     1248   771088+  83  Linux native
/dev/sda8         1184     1248     1907   674698+  83  Linux native
Whoa nelly! I have 3 primary partitions: 1 2 3 --- the third defined the entended partition. Therein I have 5, 6, 7, and 8 --- another four partition on that same drive. I think I've gone upto 10 at least once --- though I don't know of a limit to these extensions.
Disk /dev/sdb: 64 heads, 32 sectors, 532 cylinders
Units = cylinders of 2048 * 512 bytes

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/sdb1            1        1       17    17392   83  Linux native
/dev/sdb2           18       18      532   527360    5  Extended
/dev/sdb5           18       18      532   527344   83  Linux native
Lookie! A disk with two primaries, one defining an extended partition that contains a single Linux fs.
Disk /dev/sdc: 64 heads, 32 sectors, 2063 cylinders
Units = cylinders of 2048 * 512 bytes

   Device Boot   Begin    Start      End   Blocks   Id  System
/dev/sdc1            1        1     2063  2112496   83  Linux native
... Oh. One that just has one partition on it.
(The rest of this SCSI chain consists of a CD, a CDR, a 4mm DAT autochanger tape drive, and an old magneto optical drive).

(?) So if you intend to run RedHat (which is probably the easiest to install) you need 2 partitions for Linux indeed.

(!) Yes. However, you can just put these in extended partitions (one primary partition is labeled as "the 'extended' partition" --- then all partitions defined within that are called "extended partitions" --- an irritating bit of terminology that serves to confuse).

(?) Wilke Havinga

(!) I hope that helps.


Copyright © 1998, James T. Dennis
Published in The Linux Gazette Issue 35 December 1998


[ Answer Guy Index ] office largedisk links yamaha magickeys
passwd ftproot pvtmail netware crypto
relay project bootmethod sysadmin ipscript
loopfs mrtg slimscan rpm modutil libc dell remoteroot


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]