Package: fai
Severity: normal
Tags: patch

Moin,

on LinuxTag I promised Thomas Lange to incorporate README.disk_config
into the FAI guide proper, here is a patch that accomplishes just that.

Diego

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-powerpc
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Index: fai-guide.sgml
===================================================================
RCS file: /cvs/debian-boot/fai/doc/fai-guide.sgml,v
retrieving revision 1.130
diff -u -r1.130 fai-guide.sgml
--- fai-guide.sgml      19 May 2005 08:59:07 -0000      1.130
+++ fai-guide.sgml      4 Jul 2005 13:17:47 -0000
@@ -1132,8 +1136,8 @@
 the disk layout or to preserve the data on certain partitions. It's
 done by the command <prgn>setup_harddisks</prgn>, which uses
 <prgn>sfdisk</prgn> for partitioning. The format of the configuration
-file is described in
-<file>/usr/share/doc/fai/README.disk_config</file>.
+file is described in <ref id="diskconfig">.
+
 <p>
 During the installation process all local filesystems are mounted
 relative to <file>/tmp/target</file>. For example
@@ -1742,8 +1746,10 @@
 
 <sect id=diskconfig>Hard disk configuration<p> 
 
-The format of the hard disk configuration files is described in
-<file>/usr/share/doc/fai/README.disk_config.gz</file>. The config file
+The script <prgn>setup_harddisks.pl</prgn> partitions and formats
+the local disks. It uses all configuration files in
+<file>/fai/disk_config/</file> which are also defined as classes.
+Lines beginning with # are comments. The config file
 <file>/fai/disk_config/FAIBASE</file> is a generic description for
 one hard disk (IDE or SCSI), which should fit for most installations. If you
 can't partition your hard disk using this script <footnote><p>Currently
@@ -1752,7 +1758,181 @@
 write the new partition table, create the file systems and create the
 files <file>/tmp/fai/fstab</file> and <file>/tmp/fai/disk_var.sh</file>, which
 contains definitions of boot and root partitions.
+
+<p>
+The following example is a configuration for the first IDE disk <tt>disk1</tt>
+and for the second SCSI disk <tt>disk2</tt> The numbering of the disks comes
+from the order in <file>/proc/partitions</file>.
+
+<example>
+# &lt;Type&gt; &lt;mount point&gt; &lt;Size in mb&gt; [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
+</example>
+
+Every disk configuration starts with the command <prgn>disk_config</prgn>
+followed by <tt>diskX</tt> where <tt>X</tt> is the number of the HDD. The
+Linux device names <file>/dev/hda</file> and <file>/dev/sda</file>
+corresponds to <tt>disk1</tt>, <tt>disk2</tt> is equal to
+<file>/dev/hdb</file> and <file>/dev/sdb</file> and so on.
+<p>
+After this command for each partition a line containing the type, mount
+point and size is added. Mount options and additional parameters for
+<prgn>mke2fs</prgn> -- separated from the mount options by a semicolon --
+can be added.
+
+<taglist>
+  <tag>Type</tag> <item> <p>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.
+  <p>
+  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 <tt>disk1</tt> in the example above.
+
+  <tag>Mount point</tag> <item> <p> The mount point is the full path
+  (beginning with a slash) for the filesystem. The value <tt>swap</tt>
+  defines a Linux swap partition.  Both types will be automatically
+  added to <file>/etc/fstab</file>.  A dash <tt>-</tt> indicates that
+  the partition will not be mounted and can be used for other types of
+  filesystems (VAT, UFS, MINIX, ...)
+
+  <tag>Size</tag> <item> <p> 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:
+  <example>
+       "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
+  </example>
+  <p>
+  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
+  <tt>preserve&lt;no&gt;</tt> will be described later.
+  <p>
+  Calculating the partition size:
+  If an interval is defined for several partition sizes, the script
+  maximizes the values by preserving the ratio between them.
+
+
+  <tag>Mount options</tag> <item> <p>The mount options will be copied
+  to <file>/etc/fstab</file>. An empty field sets the option to
+  <tt>defaults</tt> (see <manref name="mount" section="8">).
+
+
+  <tag>Extra options</tag> <item> <p>The last field is a space
+  separated extra options list. The following options are known:
+  <example>
+boot         : make this partition the boot-partition (the
+               linux root filesystem is the default)
+-i &lt;bytes&gt;   : Bytes per inode
+               (only ext2/3 filesystem)
+-m &lt;blocks&gt;  : 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
+  </example>
+  <p>
+  The order of the extra options is not relevant. For more information
+  see <manref name="mke2fs" section="8">.
+  <p>
+  Thus, we have the following interactions between <tt>-j</tt>,
+  <tt>ext2</tt> and <tt>ext3</tt> :
+  <example>
+&lt;no option&gt; : 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!!
+  </example>
+  <p>
+  The use of auto in the fstab for ext3fs enable a non-ext3 enabled
+  kernel or tool to cope with these partitions.
+</taglist>
+
+<p>
+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 <tt>preserve&lt;no&gt;</tt> The number
+<tt>&lt;no&gt;</tt> is the device number (used by <file>/dev/hda*</file>,
+or see output of <prgn>df</prgn>) of the partition. Primary partitions
+are numbered from one to four, the numbers for logical partitions
+begin at five.
+<p>
+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.
+<p>
+In this example, the partitions' numbers  (= device number) are also
+shown for disk disk2:
+
+<example>
+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
+</example>
+
 <p>
+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 <file>/dev/hda7</file>
+you have to insert a minimum of two logical partitions before it.
+
+<p>
+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
+<file>/home</file> or <file>/var/log</file> or
+<file>/var/lib/mysql</file> or whatever. You can even lazyformat
+the swap partition to gain a minor installation speed improvement
+after the first installation!
+
+<p>
+If your have a separate partition <file>/boot</file>, you must add the
+extra option <tt>boot</tt> to make it your boot partition. Otherwise
+your system will not be bootable. By default (if no boot option was
+specified) the root partition (<file>/</file>) will become the boot
+partition. <prgn>setup_harddisks</prgn> will write some variables
+containing the information about boot partition and boot device to
+<file>/tmp/fai/disk_var.sh</file>.
 
 <sect id=packageconfig>Software package configuration<p>
 The script <prgn>install_packages</prgn> installs the selected software

Reply via email to