The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

Next Previous Contents

12. Implementation

Having done the layout you should now have a detailed 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.

12.1 Checklist

Before starting make sure you have the following:

12.2 Drives and Partitions

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.

12.3 Partitioning

It feels so good / It's a marginal risk / when I clear off / windows with fdisk! (the Dustbunny in an issue of User Friendly in the song "Refund this")

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. For the experts there is now also sfdisk.

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. If you want to use RAID with autostart you have to check the documentation for the appropriate type number for the RAID partition.

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.

Not to be outdone, Mandrakesoft has made an even more graphic alternative called Diskdrake that also offers numerous features.

Also the GNU project offers a partitioning tool called GNU Parted

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.

In depth information on DOS fdisk can be found at Fdisk.com and MS-DOS 5.00 - 7.10 Undocumented, Secret + Hidden Features which details even more bugs and pitfalls.

12.4 Repartitioning

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. Make sure you get the latest updates to this program as recent versions had problems with large disks.

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. If 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.

A freeware alternative is Partition Resizer which can shrink, grow and move partitions.

Some versions of DOS / Windows have a hidden flag for defrag, "/P that causes defrag to move even hidden files. Use at own risk.

Repartitioning is as dangerous process as any other partitioning so you are advised to have a fresh backup handy.

12.5 Microsoft Partition Bug

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.

More information on multi OS installations are available at V Communications but they keep rearranging the links continuously so no direct links can be offered here.

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.

12.6 Multiple Devices (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.

12.7 Formatting

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.

Some important notes on formatting with DOS and Windows can be found in MS-DOS 5.00 - 7.10 Undocumented, Secret + Hidden Features.

Note that this formatting is high level formatting, that writes the file system to the disk, as opposed to low level formatting that lays down tracks and sectors. The latter is hardly ever needed these days.

12.8 Mounting

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.

12.9 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, such as on the netfstool, a Tcl/Tk-based file system mounter, and kfstab, an editing tool for KDE.

Briefly, the fields are partition name, where to mount the partition, type of file system, mount options, 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.

12.10 Mount options

Mounting, either by hand or using the fstab, allows for a number of options that offers extra protection. Below are some of the more useful options.

nodev

Do not interpret character or block special devices on the file system.

noexec

This disallows execution of any binaries on the mounted file system. Useful in spool areas.

nosuid

This disallows set-user-identifier or set-group-identifier on the mounted file system. Useful in home directories.

For more information and cautions refer to the man page for mount and fstab.

12.11 Recommendations

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.

There is also a small script in appendix Appendix M: Disk System Documenter which will generate a summary of your disk configurations.

For checking your hard disks you can use the Disk Advisor boot disk available on the net. The disk builder required Windows to run. This system is useful to diagnose failed disks.

You are strongly recommended to make a rescue disk and test it. Most distributions make on available and is often part of the installation disks. For some, such as the one for Redhat 6.1 the way to invoke the disk as a rescue disk is to type linux rescue at the boot prompt.

There are also specialised rescue disk distributions available on the net.

When need for it comes you will need to know where your root and boot partitions reside which you need to write down and keep safe.

Note: the difference between a boot disk and a rescue disk is that a boot disk will fail if it cannot mount the file system, typically on your hard disk. A rescue disk is self contained and will work even if there are no hard disks.


Next Previous Contents


Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру