Originally Posted by Tim Johnson
I have ubuntu 9.10 on /dev/sda6 (root) and /dev/sda7 (home) on a
gateway computer with sata hard drive. My target configuration is
Slack 13.0 on /dev/sda1 (root) and /dev/sda2 (home). My last
slackware installation was 10.00 in 2004. At that time lilo was
(to the best of my memory) the only option.
1)Do I know have a choice of grub or lilo?
2)Are there any preparations that I might need to do to preserve
boot access to my current ubuntu installation?
3)I am very curious about http://www.slackware.org/install/bootdisk.php
. I don't even have
a floppy disk drive on my computer. That looks like the instructions for
my first install of slack back in 1995 or 1996.
Comments, caveats and (especially) links to documentation clarifying
question 1, 2 and 3 are invited.
Here is a quick explanation of partitions and booting.
A standard PC hard disk partition table supports four main partitions. There are two types of main partitions, Primary and Extended. You can only create one Extended partition, and all the rest of the partitions must be Primary. You can also create four Primary partitions with no Extended partition.
An Extended partition is essentially a container for any number of Logial partitions. Logical partitions are not "seen" in the partition table, but are recorded inside the Extended partition. Most partitioning programs find and display the Logical partitions along with the Primary and Extended partitions.
In Linux, Primary partitions have partition numbers from 1 through 4. An Extended partition has one of the numbers from 1 through 4 but that number usually doesn't show up as a separate device name. Logical partitions inside an Extended partition have numbers 5 and above.
When you first start the computer the BIOS always loads the first sector of the hard disk (the Master Boot Record) and executes the software there if the signature bytes at the end of the sector are correct. The first hard disk sector (MBR) has both the master boot code and the partition table. The default MBR software searches the partition table for the first Active (Boot) partition, then loads and executes the first sector (boot sector) of that partition. Installing a boot loader to the MBR replaces the default code and starts the boot loader immediately. The BIOS does not know or care about partitions, it is only the software in the MBR, or the boot loader that knows or cares anything about partitions.
Each Primary partition can have a partition boot sector containing boot software to start a boot loader. If additional sectors have to be loaded, the software in the partition boot sector has to load those other sectors. The default MBR software just loads the first sector of the partition. If you install a boot loader to a partition boot sector, then it writes the appropriate software in the boot sector. A partition boot sector is never loaded directly. Either the MBR software, or some boot loader chains to it.
Thus there are five places (boot sectors) where you can "install" a boot loader (the MBR and four Primary partition boot sectors). Only the MBR is guaranteed to be loaded and executed since the BIOS always does that. If you leave the default code in the MBR (I recommend that) then you can change the default partition boot sector (and boot loader) by changing the Active (Boot) flags for the partitions. When you install a boot loader to the MBR then that boot loader ALWAYS starts first and you must install different MBR software to change the default.
Logical partitions (in an Extended partition) do not have boot sectors, and should not contain the software (files) for a boot loader. You cannot "install" a boot loader to a Logical or Extended partition. A Logical partition CAN contain an operating system loaded by a boot loader. Only the boot loader has to be in some Primary partition. The Linux kernel and initrd can be placed in a Logical partition, and so can the root file system "/". Windows (the WINDOWS folder, etc.) can can also be located in a Logical partition, but the Windows boot loader (NTLDR, bootmgr) cannot.
With a complicated multi-boot configuration it may be desirable to put ONLY the boot loaders in Primary partitions and put all the rest of the operating system files in Logical partitions. The Primary partitions containing a boot loader can be quite small.
The BIOS does not know about partitions, only hard disk sectors relative to the beginning of the hard disk. The BIOS does know about hard disks. I really mean hard disks and not drive letters, partitions or Linux device names. Each hard disk has an 8-bit ID. Boot sector software usually has a hard disk ID for the first hard disk.
Here are the hard disk IDs (and floppy disk IDs) used by the BIOS.
80 (hex) - First hard disk (hda, sda, hd0)
81 (hex) - Second hard disk (hdb, sdb, hd1)
82 (hex) - Third hard disk (hdc, sdc, hd2)
83 (hex) - Fourth hard disk (hdd, sdd, hd3)
00 (hex) - First Floppy Drive (floppy, fd0)
01 (hex) - Second Floppy drive (fd1)
Although an operating system treats a CD/DVD drive similarly to a hard disk, the BIOS does not. There are no BIOS functions to access a CD-ROM drive. The BIOS can load and start a boot image from a CD/DVD. The BIOS supports booting from CD/DVD in two different ways, "emulation" and "no-emulation".
With emulation, the boot image on the CD/DVD appears to be a normal floppy or hard disk, and is accessed using the normal BIOS functions for those. Any real floppy or hard disk drive is assigned the next available ID. Older operating system boot CDs such as Windows 98 use emulated floppy mode. Newer operating systems and newer BIOS software supports no-emulation booting that just loads boot software into memory and does not make the CD appear to be some other device. The no-emulation software has to have any required drivers to access the disk controller and CD/DVD drive. Windows NT (and later) use no-emulation mode. A small Linux system that fits on one floppy and loads a RAM disk can be written as a floppy-emulated CD boot image. Larger Linux systems require some kind of no-emulation loader. For example, one can install GRUB to the boot image of a CD and GRUB can access the CD-ROM to load the kernel and initrd.
What is "chaining"? Since each of the five boot sectors must have enough software to completely load some boot loader, any boot loader can start a different boot loader, by "jumping" to the software in the boot sector for the other boot loader. When chaining, a boot loader, reads the boot sector, and then starts executing the software in the sector (the new software never returns). This allows a boot loader to start any other boot loader without knowing anything about the other boot loader or the file systems the other boot loader supports. Only the location of one 512-byte sector has to be known.
GRUB and LILO can directly read and chain to any sector (or file). Windows boot loaders (NTLDR and bootmgr) can only chain to software contained in files. You can copy a boot sector from the hard disk into a file and then chain to the file. The file has to be placed in a file system that the boot loader chaining to the file understands (EX: NTFS/FAT16/FAT32 and NOT ext3 for Windows).
An advantage of using files is that you can "patch" the software in the files. You can also have any number of files, while you are limited to only the five actual boot sectors for directly starting a boot loader. One reason to "patch" boot code is to support boot loaders on the second hard disk. As long as the files contain the correct software (or copy of a valid boot sector) you can start boot loaders even that are not installed to any of the five boot sectors. That allows you to support more than five boot loaders.
You can use GRUB with Slackware but you have to install it yourself. It isn't automatically installed and configured by Slackware setup. Either install LILO first and then change it later, or use the "chroot" command after installing Slackware (before rebooting) and install GRUB. Make sure that you use the latest, patched GRUB included on the Slackware CD (or web site) to support 256-byte inodes.
The partitions "/dev/sda6" and "/dev/sda7" are both logical partitions inside an extended partition. You should not normally place the boot loader in a logical partition. You probably have a boot loader already located in some primary partition (sda1 through sda4).
This can be a bit confusing because there are two parts to the boot loader. The first part is the boot sector where you "install" the boot loader. The boot sector can be the MBR or one of the four primary partition boot sectors. The second part is the set of files making up the boot loader program. Those files are usually located in one of the four primary partitions. I always prefer to "install" a boot loader to the same partition boot sector where the rest of the boot loader program files are located. If you don't install anything else to the MBR, it usually chains to the Active partition's boot sector. Thus you can do exactly the same thing by marking the correct partition Active (Boot) as you can by installing a boot loader to the MBR.
To install Slackware to "sda1" you have to create and format the first primary partition using ext3 (or some other Linux compatible filesystem). You can put "/home" in "sda2" if you create and format the second primary partition to contain the filesystem for "/home". If there is no free space at the beginning of the hard disk then you have to shrink and move, or delete existing partitions.
May I suggest that it is better to place "/home" in a logical partition (in the extended partition) since it cannot contain boot loader files or a boot sector. That will allow creation of an additional primary partition for some other OS later.
The files that you should put in a primary partition are the boot loader program and the boot menu file. You can put the Linux kernel and files there too, but you can also put them in a logical partition instead. Logical partitions are "sda5", "sda6", etc.
To preserve your existing Ubuntu installation, back up the "menu.lst" and other GRUB files (probably located in "sda1"). Make sure that you do not delete "sda6" or "sda7", or use "cp -a" or "tar" to back the files up to somewhere else.
To make Ubuntu boot again, add it to the GRUB menu for Slackware in "sda1". If you want to keep a separate copy of GRUB for Ubuntu, then create a "sda3" partition and put the GRUB for Ubuntu there. Then add a menu entry to Slackware GRUB to chain to Ubuntu GRUB. If you put Slackware "/home" in a logical partition then you can install Ubuntu grub to "sda2" instead.
To successfully install multiple operating systems it is important to understand how the system is partitioned and configured first. What are the partitions? What software is installed to the MBR? What software is installed to each possible Primary partition? Where are the files for each operating system?
Next plan how you will configure the partitions, where you will place the software (files) for each boot loader, and where (to what sector) you will "install" each boot loader. Will you use the default MBR software (and Active/Boot flags) or start a boot loader directly?
Have the required boot discs in order to install or repair the boot loaders, format or resize partitions, etc. Back up important files even if you don't expect to lose them. Things can go wrong.
Re-size and move/copy the partitions to configure the hard disk as planned. After you have the partitioning correct, install the first boot loader or standard MBR software to the MBR. Next install the boot loader for each Primary partition boot sector. Configure the menus during or after installation of boot loaders. LILO is configured before installation of LILO. GRUB "menu.lst" can be configured before or after installing GRUB.
What makes boot configuration complicated is the number of choices. There are a lot of ways you can configure the five boot sectors and boot loader menus.