COMP421
Unix Environment for Programmers
Lecture 03: Installing Unix_____________________________________

Jeff Wiegley, Ph.D.
Computer Science
jeffw@csun.edu

09/12/2005

     

“Unix gives you just enough rope to hang yourself – and then a couple of more feet, just to be sure.”–Eric Allman

1


Requirements_________________________________________

2


Disk Partitions:______________________________________

Hard drives are just a collection of sectors (usually 512 bytes per sector).

Windows (and many x86 operating systems) divide the hard disk into partitions

There are two kinds of partitions:

  1. Primary (There can be up to four primary partitions defined)
  2. Logical (There can be any number of logical partitions and they are all stored in the “extended” primary partition.

This is x86 specific, not Unix specific. Windows uses this partitioning scheme as well but Solaris on Sparc hardware uses a different system.

3


Partition Purpose:___________________________________

4


Booting:_______________________________________________

A computer is a very expensive brick until something starts executing.

This presents a chicken and egg problem:

The computer solves this by executing the BIOS program by default.

The only thing the BIOS knows how to do is to load the 512 byte program stored in the master boot record and start executing it.

The master boot record that is written by a windows installation is also simple:

5


Reasonable Partitioning Example:_________________

Let’s say I want to have a computer that can run both Windows and Linux.

In general, the Linux file-system can’t be mixed with the Windows file-system.

It is best to allocate some partitions to be used by Windows and others to be used by Linux.

6


Simplest Scheme:____________________________________

Assuming that you had a 60gig drive and your purpose was to install Linux for COMP421 a minimal partition allocation would be:

Active?PartitionPrimary?Size Type Purpose






Yes 1 Yes 43 GigNTFS Windows XP
No 2 Yes 16 GigLinux (83) /
No 3 Yes 1 Gig Linux Swap (82)swap space

“Swap” space is the area used as virtual memory to make a machine appear as though it has more physical memory. Linux can locate its swap contents as either a file or as a partition. Partitions are more efficient.1

7


Better Scheme :______________________________________

Assuming that you had a 60gig drive and your purpose was to install Linux for COMP421 and you wanted some flexibility:

Active?PartitionPrimary?Size Type Purpose






Yes 1 Yes 43 Gig NTFS Windows XP
No 2 Yes 128 MegLinux (83) /boot
No 3 Yes 8 Gig Linux (83) /
No 4 Yes 9 Gig Extended
No 5 No 1 Gig Linux Swap (82) swap space
No 6 No 8 Gig Linux native (83)/home

This scheme allows you to reinstall Linux over and over again without having to backup user files located in /home. As long as you don’t re-format the contents of that partition you can simply mount it as /home again.23

8


I NEED WINDOWS!!!! :____________________________

If you edit the partition table with fdisk or any other editor and just change partition sizes you will destroy any existing data on the drive!!!!

“But I don’t want to lose my windows data”

Partition Magic is a program that can resize NTFS partitions without destroying the contents.

ntfsresize is a free program for Linux that can resize NTFS partitions.

9


Knoppix to the rescue!______________________________

Klaus Knopper is a brilliant person that developed the “Knoppix” bootable CD. (You can download a free ISO image from http://www.knopper.net/knoppix-mirrors/index-en.html Version 3.9 fits on a CD; version 4.0.1 requires a bootable DVD.

Chicken/Egg solved because you can boot/run knoppix, use ntfsresize to shrink the windows partition down. Then you have room left to create Linux partitions in.

10


Windows Drive Letters:_____________________________

Windows has this silly notion of drive “letters”.

Windows is very, very fussy about what its “installation” drive is.

If you install to what Windows thinks is Drive “D” and then later windows thinks that same partition is drive “C” you’re screwed. Basically if you do anything to alter driver letter assignments you’re screwed.

Windows assigns drive letters to partitions in a particular order.

This is the main reason why the two partitioning schemes presented earlier have windows as the first partition.

When you had a single partition, windows assigned the drive letter “C” to it when the operating system was installed.

Leaving it the first partition guarantees that it will still get enumerated as “C” when more than one partition exists.

11


File-system types____________________________________

Unix gets installed to a hard drive which holds the file-system. This file-system is where the first real choices come into play. The file-system “type” is an important decision and there are many to choose from:

12


File-system choice:___________________________________

basically the file-system “type” describes the advanced data structures and disk layout used to represent and store files. Since it’s basically a data structure it defines what the performance of file operations will be.

If in doubt, choose ext3 as it is supported ubiquitously and has efficient, reliable performance characteristics.6

13