Modifying Your Partitions and Help on LILO

Last updated: September 9, 1999

If you were really careful during installation (or can predict how much hard drive space you'll need later on), you might not need to read this, but if you suddenly decided or found out that you want to extend your partitions, shrink or extend your swap space, added a new hard drive, or something of that sort, I'll explain how to do those things for you right here.

First, type fdisk when you're root at the Linux prompt. You might remember this from installation, when you were setting up your partitions for Linux to use.

You probably also want to be able to boot any new partitions using LILO (if you're using LILO). First you have to edit /etc/lilo.conf so that LILO will know which partitions are there to boot. As of now I still haven't figured out everything about LILO, but it would help to take a look at your lilo.conf and figure it out to an extent; you can also read the lilo.conf manual page by typing man 5 lilo.conf. The first entry put down is the one LILO will boot if you just press 'enter' or leave it alone. On my system, I have LILO boot Linux on default and boot my Windows FAT partition when I type "dos". Here's what my lilo.conf file looks like:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz
        label=linux
        root=/dev/hda2
        read-only
other=/dev/hda1
        label=dos
        table=/dev/hda

After you edit /etc/lilo.conf, don't immediately reboot. Type lilo at the command prompt and see if it displays something like this (with no error message; if there is, then edit lilo.conf until you get it right):

Added linux *
Added dos

The asterisk (*) after linux shows that it boots Linux if I don't enter anything or just press Enter. If you have more than two bootable partitions, then it should show whatever partitions you enabled in /etc/lilo.conf. Using the image label in lilo.conf is only for your Linux or Unix-based partitions with boot images, and the label other is used for other types of partitions.

The way it is set up as of now, it loads Linux on default. What if you want it to load to your DOS/Windows setup? Notice that the "image" block is there first. It loads whatever is there first, so if you switched the "other" block to be first, then it would load DOS/Windows on default. Let's say you wanted to boot into DOS/Windows first:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
other=/dev/hda1
        label=dos
        table=/dev/hda
image=/boot/vmlinuz
        label=linux
        root=/dev/hda2
        read-only

Upon making that change and re-running lilo as root, you would get the nice output of:

Added dos *
Added linux

That indicates that, since the "dos" line had the asterisk, it is the one that will be booted into by default.

If you're like me, you may want to have many separate image entries in /etc/lilo.conf for the sake of having an option to boot other kernels. This can be any valid Linux kernel, such as previous versions, development versions (if you're brave), or differently configured versions of the same kernel. It really doesn't matter. (If you have no idea what I'm talking about in this paragraph, there is no need to worry.)

Another common problem people have with LILO is that the computer reads the hard drive, starts to display "LILO", but then stops when it only displays "LI". A possible solution might be to add the line linear somewhere in /etc/lilo.conf; I heard it's a disk geometry problem. If you have another solution to this, I'd sure appreciate it if you shared it. So if that problem appears, you should boot a kernel using LOADLIN.EXE, which should be on your Linux distribution's CD-ROM, and a copy of the kernel (a file called vmlinuz).

I can't predict all the possible uses you might have, but I'll just list some basic pieces of information you might want to use to format, repartition, and make swap space.

To make Linux mount a filesystem that you want automatically, you should edit /etc/fstab. It is read each time you boot up Linux. Here's what mine looks like:

/dev/hda2               /                       ext2    defaults        1 1
/dev/hda4		/usr/local/src		ext2	defaults 	1 1
/dev/hda5               swap                    swap    defaults        0 0
/dev/fd0                /mnt/floppy             ext2    noauto          0 0
none                    /proc                   proc    defaults        0 0

The configuration I have is for Linux to mount my main partition (/dev/hda2) on /, mount my second ext2 Linux partition (/dev/hda4) to /usr/local/src, enable my swap space (/dev/hda5), and to mount the /proc filesystem to /proc (/proc contains information about your system and the hardware; it's not part of the actual harddisk). When it says defaults I think it automatically mounts it to where you specified. The entries are separated after each line.

Suggestions

Stefan had a suggestion about the problem with LILO's tendency to sometimes only display the "LI": "It's a little bit annoying if you've spent 2h or more on installing your Linux and then discovers that the LILO doesn't work. I can't even count the hours I've spent to solve this problem. Then I finally discovered another solution. To be sure that this problem never occurs, I do a fdisk /mbr from a windows/dos boot diskette before installing my linux. In this way you rewrite the boot-table on your boot harddisk and the geometry-problem, or whatever it is, never occurs.".


Copyright © 1997-1999 Joshua Go (joshuago at users dot sourceforge dot net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.