GeodSoft logo   GeodSoft

Dual and Multi Booting FreeBSD, Linux, and OpenBSD

Linux Installs

All Red Hat 7.2 Linux install options related to dual or multi booting start with the choice of automated partitioning, manual Disk Druid, or fdisk ("experts only") and end with the boot loader install screen immediately after disk partitioning. That is the only part of the Linux install that will be discussed here.

Linux can put only one of its own partitions in a primary partition. It can put several or all of its partitions in an extended partition. This is similar to DOS which can have only one logical drive letter in a primary or secondary partition but several in an extended partition.

Linux's fdisk performs hard disk partitioning similar to that provided by FreeBSD's and OpenBSD's fdisk. Linux's fdisk can create empty partitions and label them with any type as place holders for another system to fill in. Fdisk goes a little further in that it creates the Linux specific partitions inside an extended partition that are more like the operating system specific partitions provided by disklabel in FreeBSD and OpenBSD. If you start with fdisk, Disk Druid is still used to assign mount points for both the primary partitions and Linux partitions contained in the extended partition.

When you start fdisk, if it's brain dead, as indicated by the "too many partitions" message discussed previously, only the display options will work; no changes can be saved to disk. Assuming fdisk is working properly, you should start with 'p' to see how the current disk is partitioned. If there is old partition information you don't want, then use the 'o' option to clear all existing partitions. Use 'p' frequently to track changes that you are making. Linux's fdisk changes are not written to disk until you exit with the 'w' option.

Assuming you have a clean disk, when you use 'n' to create a new partition, you will be prompted for extended or primary; type a 'p' for primary. You will then be prompted for the partition number from 1 to 4. Typically you'll start with 1. Then you will be prompted for the starting cylinder. Fdisk keeps track and defaults to the first available; normally press enter here for the default, unless you have a clear reason for leaving unused space on the disk.

After the starting cylinder, you will be prompted for the ending cylinder. If you haven't already made your basic partitioning decisions by starting with a BSD install, this is your first important choice. You should have a very clear idea of how much space you plan to allocate to each system. At a minimum, you should know how much space you plan to allocate to the Linux system. What's left is what you're going to give to FreeBSD and or OpenBSD.

Though fdisk prompts for cylinders it also accepts kilobytes, megabytes, and gigabytes and will round to the nearest cylinder if you give a size specification. The prompt does not show gigabytes but it does work, and if you have a large hard disk this may be more convenient. With this notation you can enter "+100m" for 100MB or "+3g" for 3GB. Don't forget the "+" sign as a prefix. All cylinder numbers are one higher than in OpenBSD or FreeBSD because Linux counts cylinders from 1 instead of 0.

Assume you have a drive with 10GB usable space and have decided you want at least 3GB for Linux. This leaves 7GB for any BSD systems you will install. You may enter "+7g" for the ending cylinder of the first partition to allocate one large slice for one BSD system. Next use 't' to change the partition type. You'll be prompted for the partition number which is 1. Then you'll be prompted for the hex code for the partition type. It's "a5" for FreeBSD and "a6" for OpenBSD. At the type prompt you can use 'l' to get a listing. After entering the type, it's a good idea to use 'p' to confirm that you've done what you intended. FreeBSD shows as a "BSD/386" system and OpenBSD shows as "OpenBSD".

If at any point you make a mistake, just continue and when you get back to the prompt, use a 'd' to delete the erroneous partition. When prompted, enter the partition number you just created.

The most important decision on any dual or multi boot system is how to do the initial partitions. If there is any chance that you will want to add a third system later, even if the disk has ample room, some partitioning choices will make an additional system very difficult or impossible and others very easy. The normal Linux way, after 1 slice had been reserved for a BSD system would be to create a second primary partition of approximately "+20m" for a "/boot" partition or "+250m" for a "/" partition and then use another primary slice for another file system. If you do this, you'll only be able to add another system by clearing the Linux install and starting over.

If you have any doubt and think that you may want to install 2 or more FreeBSD systems or a FreeBSD and OpenBSD system, then save the two slices you don't think you need at this time. You can create two slices and allocate them to some unknown type such as "a8" or you could jump right to partition to 4 and not create any partitions 2 and 3. If you intend to let Disk Druid assign partitions inside of a single extended partition, then you must allocate slices 2 and 3 to something else or Disk Druid will take them for Linux.

7GB makes for a rather large test FreeBSD system. Instead of making slice 1 this large, you could make it only 3GB, which is still generous as a minimum FreeBSD system takes a little over 100MB. You could then create an unknown type 4GB slice or simply leave 4GB unallocated in the middle of the disk. You could allocate it to a slice for FreeBSD and use it as a /tmp file system until you decide on another use, at which time you could reallocate it to a different slice type or split it in two if you installed Linux entirely in an extended partition leaving both primary partitions for other uses.

If you are not installing immediately, but considering using OpenBSD in the future, then you need to allow for the 1024 cylinder limit. If a 3GB partition starting at the first cylinder extends beyond or is very close to the 1024 cylinder limit, you'll not be able to install OpenBSD on this disk without first removing the system that is installed at the begining of the disk. Because FreeBSD installs comfortably anywhere on a disk, it might make the best sense to allocate slice 3 as the first partition starting at "+4g". Linux's fdisk will accept relative locations in kilobytes, megabytes, or gigabytes, for a partition's begining, and start the partition that amount after the displayed default value. Partition 4 will be the extended partition for Linux. It's an unconventional arrangement but when you're starting with two systems that can be placed anywhere on the disk and considering a third that has strict limits where it can be placed, it makes sense. The inner tracks shouldn't be significantly slower than the outer and as long as each system is contiguous, there shouldn't be more head movement with a system installed on the inner tracks than the outer, and on test systems minor performance issues shouldn't matter.

After you've created the extended partition for Linux you'll need to add the Linux specific partitions inside of it. If all 4 slices have been allocated, fdisk will not prompt for the partition type. If there is one or more available primary slice and an extended partition, fdisk's prompt changes from primary or extended to primary or logical and if you enter an 'l', will create the partition inside the extended partition. The start and end prompts are the same as for a primary partition. One partition will need to be made a swap partition. This is made by changing the type from the default 83 to 82. It's the same process weather the swap partition goes in a primary or a Linux specific partition. Those in the extended partition will simply use numbers 5 and higher. You can let swap creation wait, and do it Disk Druid when you assign format types and mount points.

With today's large hard disks, if you put all your Linux partitions in an extended partition at the end of the disk all partitions inside it will likely be outside the 1024 cylinder limit. If so, later when you assign the '/' mount point to one of them, Disk Druid will warn you that the system may not be bootable and that you should create a boot floppy.

Once both the slices for FreeBSD or OpenBSD are created and the Linux partitions set up in the extended partition (or using primary partitions if you've gone the "standard" way), you need to save your changes and exit fdisk with 'w'. The partition table will be updated as soon as you press enter. If you've made a mess of things you can quit with 'q' and lose your changes, leaving the disk as it was when you entered fdisk, and then start over, or clear the partition table with 'o', while remaining in fdisk.

When you select "Next" after finishing with fdisk, you will be in Disk Druid. The only difference between using fdisk and Disk Druid in manual mode is that fdisk lets you create non Linux type partitions and you will have full control over the size and physical order on disk of the Linux partitions you create. Once in Disk Druid, you can still add partitions if there is unallocated disk space or delete partitions and add new ones. You won't be able to control how Disk Druid positions any recreated partitions (if there is disk space or slices to give Disk Druid a choice). In other words Disk Druid will let you undo what you've just created in fdisk. You should avoid the add and delete options and use only the edit option. In the edit option you will only assign the partition format, ext3 by default, and the mount point. This should be all you want or you would not have used fdisk.

If you don't wish to control Linux partition locations inside of the extended partition you could use fdisk to only assign the primary and extended partitions and use Disk Druid to create the Linux partitions. There will be less items to complete per partition this way. If Disk Druid has no free primary partitions to work with, it will create all Linux partitions in the extended partition, but warn you about the potential boot problem if the '/' file system is mounted on a partition outside the 1024 cylinder limit.

Red Hat's Disk Druid may be used either manually or automatically to do everything. Disk Druid cannot create slices for other operating systems and doesn't let the user control the disk partition type. It uses all the primary partitions available, putting the boot partition in the first available primary partition and using any available additional primary partitions for the largest file systems. When no more primary partitions are available it creates an extended partition and starts adding Linux partitions in that. Sizes and mount points are assigned as the partitions are created, and partitions are shuffled dynamically as new ones are added. The user has no control over the order of partitions.

To use Disk Druid to set up Linux with other systems, the FreeBSD or OpenBSD system or systems must be installed first (or at least the slices for them created) but that sort of reverses the priorities. Disk Druid's main advantage is that if one or more systems are already installed and the disk wasn't cleaned first, Disk Druid may still let you install Linux without starting over. Anyone able to setup OpenBSD can use Linux's fdisk to do the same job and are much less likely to make a mistake in Linux's fdisk. If your reason for using Disk Druid is that fdisk is too difficult, you probably should not be trying to setup multi boot systems. Disk Druid can delete FreeBSD and OpenBSD slices, including used ones, as easily as any partitions it may have created. It prompts you for a confirmation before doing so and the changes are written as soon as you confirm.

The GRUB options, which immediately follow Linux disk partitioning, were discussed in the previous section.

As long as a Linux swap partition exists, Disk Druid will allow the creation of a new Linux system with only a '/' file system and does not care if any other Linux systems exist. Thus the maximum number of Linux systems that could exist on one hard disk is 14. There can be three primary partitions plus one extended partition which can hold 12 Linux partitions. This makes 15 partitions available to Linux, one of which must be used as swap, leaving 14 for actual systems.

To create such a system, I'd do the following. First determine the swap size, subtract that from the available disk space, and assuming the disk were large enough to hold 14 systems divide the remaining space by 14. For simplicity, assume there are 42GB of available space after swap was allowed for. This leaves fourteen 3GB partitions. Use fdisk to create three primary 3GB partitions. Then create an extended partition of 33GB plus the size of the swap partition which should equal the rest of the disk. In the extended partition create hda5 through hda8 as 3GB each. hda9 would be created at the predetermined size for the swap partition; this places the swap in the center of the disk. Hda10 - hda16 would be created at 3GB each.

Next use Disk Druid to mount '/' on hda5 and complete the install, installing GRUB into hda5 and creating a boot floppy. If you always install Linux into the extended partitions and always start the first system in hda5, then the same Red Hat 7.2 boot floppy will work for all 7.2 systems. If you start with different devices for the first system on various installs, you will need a different boot floppy for each boot device because the boot floppies are device specific, though they can be edited from a working Linux system. The syslinux.cfg file on the floppy will tell it to boot hda5.

Install GRUB into the MBR manually after the first install. Grub.conf should be adjusted each time before new install is performed; if it's not confusing to have a menu pointing to systems that are not ready yet, it would be more efficient to edit grub.conf once and set it up for all the systems that will be installed. If you install GRUB into the MBR during any subsequent Linux install, it will boot the latest install but make any other systems previously booted by GRUB, not available because the new system will have a new grub.conf file with only one entry.

There is more than one way to make the other systems bootable again but all are variations on the same approach: getting the GRUB installed in the MBR to use a grub.conf file that lists all the available systems. You may boot the system with the universal grub.conf file with a boot floppy or manually via grub. Then edit the grub.conf file to include the new system and reinstall GRUB from this system into the MBR as it was the first time. You may also mount the system with universal grub.conf file from the just installed system. Then you can update the local grub.conf file to include entries for all systems and leave the GRUB installed in the MBR, as is, pointing to the current system or add the current system to the universal grub.conf file and reinstall GRUB into the MBR, from the current system but using the original system as the GRUB root. For the former append the local grub.conf to the universal, copy the universal over the local and edit it to remove the duplicate system entries before the title sections as in:

#mount /dev/hda5 /mnt
#cd /boot/grub
#cat grub.conf >> /mnt/boot/grub/grub.conf
#cp /mnt/boot/grub/grub.conf .
#vi grub.conf ### To delete duplicate lines

For the second option, append the local grub.conf to the universal and reinstall grub to use the original system as its root as in:

#mount /dev/hda5 /mnt
#cd /mnt/boot/grub
#cat /boot/grub/grub.conf >> grub.conf
#vi grub.conf ### To delete duplicate lines
#grub
grub>root (hd0,4)
grub>setup (hd0)
grub>quit

It's easier to setup grub.conf first and only install GRUB into the first boot sector subsequently.

I'd install new systems as I needed them. They could be done in device order to keep things simple or working away from the shared swap drive to minimize head movement on the systems created first (and thus likely to be used the most) Hda10 or hda8 could be used as a shared /tmp between systems until it's used as a system, assuming you ever got to the fourteenth system.

Any Linux system, can mount any Linux partitions in the system not already included in /etc/fstab, so there is no need for a shared /tmp to share data. A shared and automatically mounted /tmp might be easier to remember than which system is on which device. A large shared /tmp may be very useful for doing full system backups of single partition systems as they go over much over 50% full.

As long as there is available space, Disk Druid appears to be able to create many more than 12 partitions in the extended partition (hda17, hda18, etc.) but they can't be used. Though they appear OK in Disk Druid, the resulting system cannot complete a boot sequence. Disk Druid actually creates an /etc/fstab with entries for the created "partitions". Each starts with LABEL=" mount point" rather than a disk device. The boot process drops into single user mode each time one of these is encountered. To complete the boot, you must use the root password to enter maintenance mode, and edit /etc/fstab to remove these entries. If you run fdisk while these exist, fdisk starts with a message to the effect that it's deleting partitions over 16.

If you are installing Linux in a system with OpenBSD, when you set the time, check the box that indicates the system clock is using UTC time. OpenBSD insists on this and if you don't set this in Linux, Linux and OpenBSD will display different local times, unless your time zone happens to be GMT.

transparent spacer

Top of Page - Site Map

Copyright © 2000 - 2014 by George Shaffer. This material may be distributed only subject to the terms and conditions set forth in http://GeodSoft.com/terms.htm (or http://GeodSoft.com/cgi-bin/terms.pl). These terms are subject to change. Distribution is subject to the current terms, or at the choice of the distributor, those in an earlier, digitally signed electronic copy of http://GeodSoft.com/terms.htm (or cgi-bin/terms.pl) from the time of the distribution. Distribution of substantively modified versions of GeodSoft content is prohibited without the explicit written permission of George Shaffer. Distribution of the work or derivatives of the work, in whole or in part, for commercial purposes is prohibited unless prior written permission is obtained from George Shaffer. Distribution in accordance with these terms, for unrestricted and uncompensated public access, non profit, or internal company use is allowed.

 
Home >
How-To >
Dual Boot >
linux.htm


What's New
How-To
Opinion
Book
                                       
Email address

Copyright © 2000-2014, George Shaffer. Terms and Conditions of Use.