1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
Documentation for hard disk configuration
The script setup_harddisks.pl partitions and formats the local disks.
It uses all configuration files in /fai/disk_config/ which are also
defined as classes. Lines beginning with # are comments.
The following example is a configuration for the first IDE disk "disk1"
and for the second SCSI disk "disk2". The numbering of the disks comes
from the order in /proc/partitions.
# <Type> <mount point> <Size in mb> [mount options] [;extra options]
disk_config disk1
primary / 200 defaults,errors=remount-ro
logical /home 100-300
logical /scratch1 10- defaults,nosuid ; -i 15000 -m 0
disk_config disk2
primary /tmp 300-500 rw ;ext2
primary /backup preserve2 rw
logical swap 50-100
logical /scratch2 100-300 rw ;-m 30
logical - preserve7
logical /var 100 ;-j
logical /var/tmp preserve9 ;format
primary /tmp/mytmp -300
Every disk configuration starts with the command "disk_config"
followed by "diskX" where X is the number of the HDD. The Linux device
names "/dev/hda" and "/dev/sda" corresponds to disk1, disk2 is equal to
"/dev/hdb" and "/dev/sdb" and so on.
After this command
for each partition a line containing the type, mount point and size is
added. Mount options and additional parameters for mke2fs -- separated
from the mount options by a semicolon -- can be added.
Type:
There are two types of partitions: primary and logical. Primary
partitions are bootable, but there is a maximum of four primary partitions on
each disk. The Linux root filesystem must be of this type.
All other partitions are called logical. Because logical partitions
are gathered internally in one big primary partition, only three
primary partitions can be used if logical partitions are defined.
Normally only one primary partition for the root file system is
created and all others are logical, like disk1 in the example above.
Mount point:
The mount point is the full path (beginning with a slash) for the
filesystem. The value "swap" defines a Linux swap partition. Both types
will be automatically added to /etc/fstab. A dash "-" indicates that
the partition will not be mounted and can be used for other types of
filesystems (VAT, UFS, MINIX, ...)
Size:
This is the size of the partition in megabytes. This value is rounded
up to fit to a cylinder number. There are several forms to define the
size:
"200" means about 200MB, no more no less
"100-300" sets a 100MB minimum and a 300MB maximum
"10-" sets a minimum of 10MB and a maximum of the disk size
"-300" sets a minimum of 1MB and a 300MB maximum
By default, a new filesystem (currently of type ext2 or swap) will be
created, and all data on the partition is lost. The meaning of
"preserve<no>" will be described later.
Calculating the partition size:
If an interval is defined for several partition sizes, the script
maximizes the values by preserving the ratio between them.
Mount options:
The mount options will be copied to /etc/fstab. An empty field sets the
option to "defaults" (see mount(8)).
Extra options:
The last field is a space separated extra options list. The following
options are known:
boot : make this partition the boot-partition (the
linux root filesystem is the default)
-i <bytes> : Bytes per inode
(only ext2/3 filesystem)
-m <blocks> : Reserved blocks percentage for superuser
(only ext2/3 filesystem)
-j : Create the filesystem with an ext3 journal
-c : Check for bad blocks
ext2 : flag the partition as ext2 instead of auto in /etc/fstab
ext3 : flag the partition as ext3 instead of auto in /etc/fstab
swap : swap partition
dosfat16 : DOS 16bit FAT file system
winfat32 : Win95 FAT32 file system
reiser : create a reiser file system, not an ext2
xfs : xfs
format : Always format this partition even if preserve
writable : mounts a preserved partition writable
lazyformat : Do not format if partition has not moved
The order of the extra options is not relevant. For more information
see mke2fs(8).
Thus, we have the following interactions between -j, ext2 and ext3 :
<no option> : an ext2 fs flagged as auto in the fstab
-j : an ext3 fs flagged as auto in the fstab
ext2 : an ext2 fs flagged as ext2 in the fstab
-j ext2 : an ext3 fs flagged as ext2 in the fstab
-j ext3 : an ext3 fs flagged as ext3 in the fstab
ext3 : an ext2 fs flagged as ext3 in the fstab !!BAD!!
The use of auto in the fstab for ext3fs enable a non-ext3 enabled kernel or
tool to cope with these partitions.
Preserving partitions:
It is possible to preserve the size of a partition or additionally to
preserve the existing data on this partition. To preserve only the
partition size, the number of the partition must be unchanged and the
size must be specified as "preserve<no>". The number <no> is the
device number (used by /dev/hda*, or see output of "df") of the
partition. Primary partitions are numbered from one to four, the
numbers for logical partitions begin at five.
Problems were reported (feb 2003) when using more than two primary
partitions and trying to preserve a logical partition. If you have
this problem, try to use only two primary partitions.
In this example, the partitions' numbers (= device number) are also
shown for disk disk2:
primary /tmp 300-500 # 1
primary /backup preserve2 # 2
logical swap 50-100 # (3) 5
logical /scratch2 100-300 # (3) 6
logical - preserve7 # (3) 7
logical /var 100 # (3) 8
logical /var/tmp preserve9 # (3) 9
primary /tmp/mytmp -300 # 4
The first two partitions are of type primary, so they get the numbers
1 and 2. The logical partitions start at 5 and the last gets number
8. All logical partitions define the primary partition 3, but this
number is not used. So, if you want to preserve /dev/hda7 you have to
insert a minimum of two logical partitions before it.
Lazyformating partitions:
Is another method to preserve partitions after they were formatted once.
This is useful to design systems which can be reinstalled without loosing
data on partitions like /home or /var/log or /var/lib/mysql or whatever.
You can even lazyformat the swap partition to gain a minor installation
speed improvement after the first installation!
Notes:
If your have a separate partition /boot, you must add the extra option
"boot" to make it your boot partition. Otherwise your system will not
be bootable. By default (if no boot option was specified) the root
partition (/) will become the boot partition. setup_harddisks will
write some variables containing the information about boot partition
and boot device to /tmp/fai/disk_var.sh.
|