Having done the layout you should now have a detailled description on what goes where. Most likely this will be on paper but hopefully someone will make a more automated system that can deal with everything from the design, through partitioning to formatting and installation. This is the route one will have to take to realise the design.
Modern distributions come with installation tools that will guide you
through partitioning and formatting and also set up /etc/fstab
for you automatically. For later modifications, however, you will need
to understand the underlying mechanisms.
When you start DOS or the like you will find all partitions labeled
C:
and onwards, with no differentiation on IDE, SCSI, network or
whatever type of media you have. In the world of Linux this is rather
different. During booting you will see partitions described like this:
Dec 6 23:45:18 demos kernel: Partition check: Dec 6 23:45:18 demos kernel: sda: sda1 Dec 6 23:45:18 demos kernel: hda: hda1 hda2
SCSI drives are labelled sda
, sdb
, sdc
etc, and
(E)IDE drives are labelled hda
, hdb
, hdc
etc.
There are also standard names for all devices, full information can be
found in
/dev/MAKEDEV
and /usr/src/linux/Documentation/devices.txt
.
Partitions are labelled numerically for each drive hda1
, hda2
and so on. On SCSI drives there can be 15 partitions per
drive, on EIDE drives there can be 63 partitions per drive. Both
limits exceed what is currently useful for most disks.
These are then mounted according to the file /etc/fstab
before
they appear as a part of the file system.
First you have to partition each drive into a number of separate partitions.
Under Linux there are two main methods, fdisk
and the more screen
oriented cfdisk
. These are complex programs, read the manual very
carefully.
Partitions come in 3 flavours, primary
, extended
and logical
.
You have to use primary
partitions for booting, but there is a maximum
of 4 primary partitions. If you want more you have to define an extended
partition within which you define your logical
partitions.
Each partition has an identifier number which tells the operating system
what it is, for Linux the types swap(82)
and ext2fs(83)
are
the ones you
will need to know.
There is a readme file that comes with fdisk
that gives more in-depth
information on partitioning.
Someone has just made a Partitioning HOWTO which contains excellent, in depth information on the nitty-gritty of partitioning. Rather than repeating it here and bloating this document further, I will instead refer you to it instead.
Redhat has written a screen oriented utility called Disk Druid which
is supposed to be a user friendly alternative
to fdisk
and cfdisk
and also
automates a few other things. Unfortunately this product is not quite
mature so if you use it and cannot get it to work you are well advised
to try fdisk
or cfdisk
.
The
Ranish Partition Manager
is another free alternative,
while
Partition Magic
is a popular commercial alternative which also offers some
support for resizing ext2fs
partitions.
Note that Windows will complain if it finds more than one primary partition on a drive. Also it appears to assign drive letters to primary partitions as it finds disks before starting over from the first disk to assign subsequent drive names to logical partitions.
If you want DOS/Windows on your system you should make that partition
first, a primary one to boot to, made with the DOS fdisk
program.
Then if you want NT you put that one in.
Finally, for Linux, you create those partitions with the Linux fdisk
program or equivalents. Linux is flexible enough to boot from both
primary as well as logical partitions.
Sometimes it is necessary to change the sizes of existing partitions while keeping the contents intact. One way is of course to back up everything, recreate new partitions and then restore the old contents, and while this gives your back up system a good test it is also rather time consuming.
Partition resizing is a simpler alternative where a file system is first shrunk to desired volume and then the partition table is updated to reflect the new end of partition position. This process is therefore very file system sensitive.
Repartitioning requires there to be free space at the end of the file space so to ensure you are able to shrink the size you should first defragment your drive and empty any wastebaskets.
Using
fips
you can resize a fat
partition,
and the latest version 1.6 of fips
or fips 2.0
are also able to resize fat32
partition.
Note that these programs actually run under DOS.
Resizing other file systems are much more complicated but one
popular commercial system
Partition Magic
is able to resize more file system types, including ext2fs
using the resize2fs
program.
In order to get the most out of fips
you should
first delete unnecessary files, empty wastebaskets etc.
before defragmenting your drive.
This way you can allocate more space to other partitions.
Id the program complains there are still files at the end
of your drive it is probably hidden files generated by
Microsoft Mirror or Norton Image.
These are probably called image.idx
and image.dat
and
contain backups of some system files.
There are reports that in some Windows defragmentation programs you should make sure the box "allow Windows to move files around" is not checked, otherwise you will end up with some files in the last cylinder of the partition which will prevent FIPS from reclaiming space.
If you still have unmovable files at the end of your DOS partition you should get the DOS program "showfat" version 3.0 or higher. This shows you what files are where so you can deal with them directly.
Repartitioning is as dangerous process as any other partitioning so you are advised to have a fresh backup handy.
In Microsoft products all the way up to Win 98 there is a tricky bug
that can cause you a bit of trouble:
if you have several primary fat
partitions
and the last extended partition is not a fat
partition
the Microsoft system will try to mount the last partition as if
it were a FAT partition in place of the last primary FAT partition.
There is more information available on the net on this.
To avoid this you can place a small logical fat
partition
at the very end of your disk.
Since some hardware comes with setup software that is available under DOS only this could come in handy anyway. Notable examples are RAID controllers from DPT and a number of networking cards.
md
)
Being in a state of flux you should make sure to read the latest documentation on this kernel feature. It is not yet stable, beware.
Briefly explained it works by adding partitions together into new
devices md0
, md1
etc. using mdadd
before you activate
them using mdrun
. This process can be automated using the file
/etc/mdtab
.
The latest md
system uses a /etc/raidtab and
a different syntax. Make sure your RAID-tools package matches
the md
version as the internal protocol has changed.
Then you then treat these like any other partition on a drive. Proceed with formatting etc. as described below using these new devices.
There is now also a HOWTO in development for RAID using md
you
should read.
Next comes partition formatting, putting down the data structures that will
describe the files and where they are located. If this is the first time it
is recommended you use formatting with verify. Strictly speaking it should
not be necessary but this exercises the I/O hard enough that it can uncover
potential problems, such as incorrect termination, before you store your
precious data. Look up the command mkfs
for more details.
Linux can support a great number of file systems, rather than repeating
the details you can read the man page for fs
which describes them in
some details. Note that your kernel has to have the drivers compiled in
or made as modules in order to be able to use these features. When the time
comes for kernel compiling you should read carefully through the file system
feature list. If you use make menuconfig
you can get online help for
each file system type.
Note that some rescue disk systems require minix
, msdos
and ext2fs
to be compiled into the kernel.
Also swap partitions have to be prepared, and for this you use mkswap
.
Data on a partition is not available to the file system until it is mounted
on a mount point. This can be done manually using mount
or automatically
during booting by adding appropriate lines to /etc/fstab
. Read the
manual for mount
and pay close attention to the tabulation.
fstab
During the booting process the system mounts all partitions
as described in the fstab
file which can look something
like this:
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/hda2 / ext2 defaults 0 1
None none swap sw 0 0
proc /proc proc defaults 0 0
/dev/hda1 /dosc vfat defaults 0 1
This file is somewhat sensitive to the formatting used so it is best and also most convenient to edit it using one of the editing tools made for this purpose.
Briefly, the fields are partition name, where to mount the partition,
type of file system, when to mount, when to dump for backup
and when to do fsck
.
Linux offers the possibility of parallel file checking (fsck
)
but to be efficient it is important not to fsck
more than one
partition on a drive at a time.
For more information refer to the man page for mount
and fstab
.
Having constructed and implemented your clever scheme you are well advised to make a complete record of it all, on paper. After all having all the necessary information on disk is no use if the machine is down.
Partition tables can be damaged or lost, in which case it is
excruciatingly important that you enter the exact same numbers
into fdisk
so you can rescue your system.
You can use the program printpar
to make a clear record
of the tables. Also write down the SCSI numbers or IDE names
for each disk so you can put the system together again in the
right order.