Linux Installation Issues

To get the most from installing Linux, you need to understand Linux disk partitions and how to mount them. Ideally you'll do everything right during the Linux installation. If you also want to have linux on a thumb drive, you need to understand a little about dual booting and modifying the BIOS settings.

While people use the terms, BIOS and CMOS interchangeably, they're two different things. CMOS (Complementary Metal Oxide Silicon) describes the technology of the IC used to store the startup information for a computer. It's where intructions are stored for booting the machine. The information stored on the CMOS chip is kept fresh by a battery. If that battery fails or is removed all the stuff stored in the CMOS chip is lost.

The BIOS (Basic Input/Output System) is the information that gets stored in the CMOS chip. When the computer starts to initialize it queries the BIOS for installed devices like hard disks, CD drives, the amount of memory and all the other odds and ends about the physical devices on the computer. You can edit the BIOS if you need to change something though that's rarely necessary (you need to change the boot order to put the USB thumb drive ahead of the hard disk if you want to boot from a thumb drive). You will mostly access the BIOS just to confirm that all the devices were correctly recognized.

What all this means means is that you edit the BIOS settings, not the CMOS. This distinction probably doesn't matter but it's handy to understand what you're actually doing before you talk about it.

If the BIOS understands a thumb drive and you can make the thumb drive the first in the boot order and boot from it Any subsequent operating system install will see the thumb drive as a legitimate target and will install itself there. With most OS's you'll install from a CD or DVD so you have to make the CD drive first in the boot order, the thumb drive second and then the hard disk(s). This way you can boot from the CD/DVD and the thumb drive will be available for installation.

For the most general purpose and most flexible BIOS boot order settings, put the CD/DVD drive first, a USB thumb drive second and the fist hard disk third. If there is no CD/DVD in the drive, the BIOS will try the USB thumb drive. If one isn't inserted or if it isn't bootable, the BIOS will then try the first hard disk. Installing Linux from a CD/DVD
Stick the Linux installation CD/DVD in the drive and start the machine (or reboot). If you're installing to a hard disk there's only a couple of things to be careful about: if there's already an operating system installed and bootable on the hard disk, you have to pay attention to where it's installed (the partition) or you could over write it. Do that and it's gone. Secondly, you need to decide how you will boot the new installation.

Follow the install prompts (I'm assuming a Fedora installation here) until you get to the disk partitioning method. Choose Custom. You do not want to use the defaults or it will trash any existing operating systems and files currently installed. You will have to choose where the installation is to be installed - carefully.

NOTE:
Linux sees hard disks as being composed of file systems. A physical disk is usually HD for IDE disks and SD for SCSI disks. Each disk is aasigned a letter so that the first IDE disk is hda, the second is hdb and so on. If SCSI then they're sda, sdb, sdc, etc. Each partition on a disk is assigned a number, so the first partition on the first IDE disk will be hda1, the next is hda2. In reality we don't care about the hd or sd designation since Linux can report a SATA disk as a SCSI so all we really care about is the disk and partition designations. All disks live in the /dev directory so the full name for the first partition on the first IDE disk is /dev/hda1.

Here's what Linux sees when it looks at hard disk with Windows Vista and Fedora installed on the same drive (dual boot configuration):

Device Boot Start End Blocks Id System
/dev/sda1 1 3825 30720000 7 HPFS/NTFS
/dev/sda2 3825 6375 20480000 7 HPFS/NTFS
/dev/sda3 * 6375 8924 20480000 7 HPFS/NTFS
/dev/sda4 8925 14593 45536242+ 5 Extended
/dev/sda5 8925 8937 104391 83 Linux
/dev/sda6 8938 10212 10241406 83 Linux
/dev/sda7 10213 11232 8193118+ 83 Linux
/dev/sda8 13447 13573 1020096 82 Linux-swap
/dev/sda9 13574 13828 2048256 83 Linux
/dev/sda10 13829 14593 6144831 83 Linux
/dev/sda11 11233 11742 4096543+ 83 Linux
/dev/sda12 11743 13446 13687348+ 83 Linux
You probably won't care what the "Start", "End" and "Blocks" columns are; its just Linux housekeeping for the disk. The "Id" column tells you what kind of file system lives on the partition (in column 1). Linux knows about lots of different file system types but it can't necessarily use them. Here's a list of file system types:

0 Empty 1e Hidden-W95-FAT1 80 Old-Minix be Solaris-boot
1 FAT12 24 NEC DOS 81 Minix/old Linux bf Solaris
2 XENIX-root 39 Plan-9 82 Linux swap c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden c6 DRDOS/sec (FAT-
5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx
6 FAT16 42 SFS 86 NTFS volume set da Non-FS data
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set 8 AIX
4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility 9 AIX bootable
4f QNX4.x 3rd part 8e Linux LVM df BootIt a OS/2 Boot Manag
50 OnTrack DM 93 Amoeba e1 DOS access b W95 FAT32
51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O c W95 FAT32 (LBA)
52 CP/M 9f BSD/OS e4 SpeedStor e W95 FAT16 (LBA)
53 OnTrack DM6 Aux a0 IBM Thinkpad eb BeOS fs f W95 Ext'd (LBA)
54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD
f4 SpeedStor 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin
boot f2 DOS secondary 17 Hidden HPFS/NTF 64 Novell Netware
b7 BSDI fs fd Linux raid auto 18 AST SmartSleep
b7 BSDI 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3 75 PC/IX

You will generally just use the typee 7 (NTFS for Windows), 82 (for swap) and type 83 for the Linux Ext3 file system type (the default with most distros). If you look at the layout above ( here), you'll see 12 partitions on one physical hard disk. Three of those are for Vista, the rest are Linux. The star (*) next to /dev/sda3 means that Vista partition is "active" or bootable. The /dev/sda4 is the default for the extended partition. Notice that /dev/sda8 is reserved for Linux swap (also where your current configuration hides when you "hibernate" the machine). The /dev/sda5 is the /boot partition where all the Linux boot information resides. The rest of the Linux install is scattered over the remaining partitions.

It's not necessary to do any of this of course. You can just put the whole install on one partition and save some hassle but you may regret it. By spreading your programs and data over several partitions, it's much easier to protect it from loss or corruption. If there's only one partition (the way most vendors ship their computers), then if you have to re-install, you wipe out everything and have to start over. Same with Linux. Divy up the install over several partitions now and save some trouble later (see this). Here's my (current) partitioning scheme:

/dev/sda5/boot
/dev/sdb6/usr
/dev/sdb7/usr/local
/dev/sdb9/home
/dev/sda10/
/dev/sdb11/var
/dev/sdb12/files

Since I'm using partitions 1,2 and 3 for Vista and partition 4 is extended and partition 8 is for swap, my Linux installation is chopped into 7 pieces. Notice I also added a directory I've named /files. This is where I download stuff and configure from source. It's my default download location for all firefox downloads.

I mount /usr/local separately since that's where everything ends up after compiling as a general rule (some distros prefer /opt). I also mount /home in its own partition. I don't really have to parition for /var but some useful stuff ends up there over time. The whole idea is to preserve a working configuration. If I have to re-install (and I always do eventually), I can re-use these partitions without formatting them and all my goodies will still be there.

This is the same technique I've used on coporate servers and mostly for the same reasons. The difference is corporations are paranoid about downtime and data loss so this scheme has the additional benefit of disaster avoidance. I could, for instance, keep a recent rdist copy of, say, /var/mail, on a DVD. If the server got corrupted I could umount /var on the server, load the DVD and mount it on /var. I couldn't write to it, but I could at least recover files without shutting evrything down. Even better a USB hard disk. plug it in, mount it and you're back in business.

Since Linux doesn't care what's on a mass storage device or even what kind of device it is, all you have to do mount it. A USB disk can be running and backing stuff up in close to real-time while mounted under one name and unmounted and then re-mounted under another name. Let's suppose that the USB disk as mounted as /dev/sdb1 (notice it will be sdb, the second hard disk) in the directory, /recover. Maybe /var gets full because of enormous emails (not that unlikely if there's lots of users). so,

umount /recover
umount /var
mount /dev/sdb1 /var
mount /dev/sda11 /recover
Now /var has some breathing space and, since I re-mounted it elsewhere, I can go through it and see what I can fix.

This isn't really too likely in the real world but the capability's there. What's really neat is that you can make any directory a mount point. Suppose you have a web server (see this) that you'd like available on another machine. Do you install everything on the other machine, from scratch? No way. Get a USB thumb drive with the capacity you need, plug it in and then,

mkdir -p /media/USB/apache2
mount /dev/sdb1 /media/USB
cd /usr/local/apache2
find . -depth|cpio -pdv /media/USB/apache2
umount /media/USB
The mkdir -p command will make the all the directories you specify at one time (the -p option). The find command finds everything below the specified directory (the dot notation) and all its sub-directories (the -depth option). The output of this is piped to the cpio command which copies each file in each directory while perserving all path information, to the named directory.

The complete contents of /usr/local/apache2 with all the path information, ends up on the USB drive. Mount the disk on another machine (as /media/USB maybe) and use find and cpio to copy the files and directories to that machine using the same process above.

Now take the USB stick to the other server, insert it and mount it as /usr/local, restart the web server (service httpd restart) and the webserver will have everything you had on the original server.

These kinds of things are why you should have several disk partitions and use your mount points creatively. The best time to set it up is during the OS installation procedure. So, you're installing Linux, you're prompted for your preferred disk partitioning scheme and you choose, Custom, and off you go.

I've found that /boot needs about 100Mb, root (/) needs at least 2Gb, /usr should have 3Gb, /var about 2Gb, /home another 2Gb, /swap at least 1Gb, /usr/local about 2Gb and assign the rest to a downloaded files directory, (/files on my machine). These are good minimums, use more if you can. Also, if you're dual booting, consider what the other operating system needs. You may even want to add yet another OS or so, maybe have three or four on the same disk so plan it out and set your new partitions to match.

The Grub Bootloader
The next thing you have to figure out is how the new OS will boot. This is where the grub boot loader comes in. After you've set up your paritions, the next thing to pay attention to in the install is where you want to put the grub bootloader. the choices are either the Master Boot Record (MBR, see this) on the first hard disk (the default) or the first partition of the partition where Linux is installed.

This is kind of tricky. If you are dual booting, say Vista and Linux, it's probably because Vista was pre-installed on your computer and you're adding Linux. You should already know which partition on the disk holds the Vista installation and you configured the /boot partition of the Linux install to be on (hopefully) another partition. The grub bootloader can be on either partition.

If you are installing to USB thumb drive or a second hard disk, make sure to select the MBR on that disk, not the primary (Vista) disk. If you are installing the same physical disk that has the Vista installation, you will use the same disk but a different partition. You can still write to the MBR but you have to edit the Operating System choice to make sure that both show up on the boot menu and point to the right partition.

The Fedora install offers a list with your new install as one option and the other OS (called "Other"). Click Edit on each to specify the correct partition for each OS. In the Edit window change the name of each OS to whatever makes sense to you. What you enter here is what you'll see when you boot, as a menu choice. Determine the disk and partition in this window and the disk boot order. Don't panic if you screw up, when you re-boot, the grub boot menu allows you to change the settings if you get them wrong during the installation (we'll get to that).

While you're at the grub menu you can also add operating systems to the boot menu. Since most Windows installations will boot from the first partition of the first disk (hda1), you can assume that any computer with Windows intalled will do just that. If you want to add an OS later, you can create an entry now using either another disk or partition.

Once you get all that figured out (you really just have to do it to see how it all works and the process varies with different Linux distros), youll be ready to continue. Fortunately most distros use grub so the underlying mechanics of setting up the boot is the same.

When you re-boot later, grub will display its menu of operating systems choices. You may have to hit a key to see the menu. The grub bootloader will display the list you created during intallation. Use the arrow keys to select your OS and hit Enter to boot. If one of the choices won't boot, hit "e" instead and you can modify the OS boot options. The first line you'll see is the one with the OS name and the disk and partition it's supposed to boot from. You can hit "e" on that line to edit it.

The notation will something like, root(hda0,3). If the disk is wrong (hda0) you can change it. Same with partition (3). In most cases the disk and partition numbering begins with 0 so partition 3 is actually partition 4. If you were counting from 1 then you may have to change it. When you finished editting this line, hit Enter and then "b" to boot. Everything will now work perfectly of course.

After the grub configuration, your install will format the paritions and you'll be ready to start installing software. This step is also worth taking your time with.

Installing Software
Once the disk partitions are formatted, you need to select the software packages you want. The default is kind of ugly I think. Lots of fluff and the stuff you need to comile from source isn't installed by default. You may not care about the Open Office suite or sound or video or games, so why clutter up the disk? If you're installing to a large disk then it won't matter but if you are installing to a USB thumb drive or small partitions, it matters.

Having a GUI (graphical desktop) is handy, especially if you're just learning Linux, so install either Gnome or KDE. Go through the whole list of options for the desktop manager and select or de-select what you think you'll want (or not). Do the same in all the other categories. Now go back and do it again. Make sure you include ntfs-3g so you can talk to your Vista partitions. Include wicd if you have a wireless connection (see this). You want the development libraries and tools if you want to complie from source (install everything if you can). Get the X-Windows development package so you'll have all libraries.

You'll have to go through all the packages in all the lists to make sure you get a useable system. It's worth the effort to do as much as possible at this time to save headaches later. Once all that is done, the actual installation begins. It takes a while but you'll eventually be prompted to re-boot. If all went well you'll boot up into your new Linux system.

If you decide to remove software use yum remove or rpm -e to get as clean an uninstall as possible. If you want to add software try yum install or rpm -i. If you're feeling amibitious, try to install from source. Suppose you try to run a program and it complains about needing some additional package or library. The easiest way is to use yum or maybe aptget:

yum install glibc -y
yum install python -y
yum install gtk2 -y
This will download, install and add all the dependancies the package requires. Even better get the yumex add-on for yum and get a graphical interface. For rpm installs you have to first download the rpm package and then,
rpm -i package_name
To install from source you have to find the package you want, download it and then set it up. Most of these source packages are compressed archives with a tar.gz or .tgz or .bz2 extension. Download the file. Next uncompress and unarchive the file:
tar -zxvf package_name.tar.gz
This will create a new directory named for the package. Now cd in to that directory. Most of the time you'll just execute a configuration script,
./configure
If the script completes without errors you need to compile it and then install it:
make && make install
If this completes successfully you can now use the package. Any executables will usually end up in one of /usr/bin, /usr/sbin or /usr/local/bin. To find the files you have installed:
updatedb
locate some_file
To see what you've installed,
rpm -q | sort
If you've made it this far you have a working Linux system and you're ready to go. To find out more about actually using Linux, click here.

Using fdisk
Now that you have a working system, you may want to know how it evrything's arranged. You should probably start with the fdisk utility to see how your disk partitions look:

fdisk /dev/hda
This will look at the IDE disk (the "hd" part, the first partition is "a" so we're looking at hda). It might look kind of like this:
Device Boot Start End Blocks Id System
/dev/sda1 1 3825 30720000 7 HPFS/NTFS
/dev/sda2 3825 6375 20480000 7 HPFS/NTFS
/dev/sda3 * 6375 8924 20480000 7 HPFS/NTFS
/dev/sda4 8925 14593 45536242+ 5 Extended
/dev/sda5 8925 8937 104391 83 Linux
/dev/sda6 8938 10212 10241406 83 Linux
/dev/sda7 10213 11232 8193118+ 83 Linux
/dev/sda8 13447 13573 1020096 82 Linux-swap
/dev/sda9 13574 13828 2048256 83 Linux
/dev/sda10 13829 14593 6144831 83 Linux
/dev/sda11 11233 11742 4096543+ 83 Linux
/dev/sda12 11743 13446 13687348+ 83 Linux
Below this is a prompt, "Command (m for help):". If you hit "m" you'll see:
CommandAction
atoggle a bootable flag
bedit bsd disklabel
ctoggle the dos compatibility flag
ddelete a partition
llist known partition types
mprint this menu
nadd a new partition
ocreate a new empty DOS partition table
pprint the partition table
qquit without saving changes
screate a new empty Sun disklabel
tchange a partition's system id
uchange display/entry units
vverify the partition table
wwrite table to disk and exit
xextra functionality (experts only)
Chances are you'll never really change anything but you can at least see what's currently there and how Linux understands it. Another way to view how the disk(s) is organized is:
df -h
the df command show disk usage, available space and the mount point for the various partitions. The "-h" option means to display the output in an easy to read format (human readable). It looks like this:
FilesystemSizeUsedAvailUse%Mounted on
/dev/sda105.8G643M4.9G12%/
/dev/sda91.9G541M1.3G30%/home
/dev/sda113.9G286M3.4G8%/var
/dev/sda69.7G3.1G6.1G34%/usr
/dev/sda77.7G3.2G4.2G43%/usr/local
/dev/sda1213G1.5G11G13%/files
/dev/sda599M12M83M13%/boot
tmpfs950M52K949M1%/dev/shm
gvfs-fuse-daemon5.8G643M4.9G12%/root/.gvfs
/dev/sda220G4.9G15G25%/media/Utils
/dev/sda320G18G1.8G92%/media/Vista
/dev/sda130G14G16G47%/media/Downloads
If you want a nice graphical partition viewer that also offers the capability of managing the partitions, try gparted. The easiest way to get it is to
yum install gparted -y
To see your mount points from a different perspective try,
mount
You'll see the same information but you can also see the partition type. Partitions are mounted at boot time using the information in the /etc/fstab file. You can always mount and un-mount (umount) a file system by hand if needed but obviously some file systems can't be un-mounted since they're being used.

This information is useful is you get odd error messages or you see something strange in /var/log/messages or from the output of the dmesg command. It's also handy if you want to edit the bootloader configuration at /boot/grub/grub.conf.

The more you know about how your system is configured and where Linux puts things, the easier it is to troubleshoot when things go wrong. The best tool is your log files, usually in /var/log so scan them regularly to see what's going on.

Return to Contents Page