Proposal for a new disk configuration utility

Michael Tautschnig tautschn at model.in.tum.de
Sat Apr 29 15:05:09 CEST 2006


Hello everybody,

it has been discussed for quite a time now and many enhancements for
setup_harddisks have been posted and requested. To satisfy as many needs as
possible, at least slight changes to the current disk_config format are required
and probably setup_harddisks will be rewritten from scratch. Whereas the latter
is yet to be done, a proposal for a new format has been created by Thomas and
me. 

If you know EBNF, you can find a formal description of the input format below.
However, the comments and examples included should also help everyone to get a
quick idea of the way things work. Note, that the proposal is meant as a basis
for further discussion, any suggestions are welcome! 

For those of you who are already using LVM/RAID: Please check, whether the
format described below allows for configuring your exact setup using FAI -
thanks!

A few examples and explanations are given next, the differences to the previous
format are detailed later on.

================================examples=======================================
# Configure the device /dev/hda
disk_config hda   preserve:6,7   disklabel:msdos  bootable:3
# preserve the 6th and the 7th partition. Alternatively, 
# one could say preserve7 below. The disklabel is msdos, which is the default
# for x86. Furthermore the 3rd partition is made bootable, which would have
# happened as well by default as it is mounted as /
primary /boot     20-100        rw                  ext3
# create a primary partition /dev/hda1 with a size of 20 MB and mount it
# read-write as /boot; it is formatted using ext3 filesystem
primary swap      1000     sw         swap
# /dev/hda2 will be a swap space of 1000 MB
primary /         12000      rw                  ext3  -b 2048
# /dev/hda3 should be formatted using ext3 filesystem; when calling mkfs.ext3
# the option "-b 2048" is appended.
logical /tmp      1000      rw,nosuid		ext3
# create the logical partition /dev/hda5
logical /usr      preserve6      rw                  ext3
logical /var      10%-      rw                  ext3
# make /dev/hda7 at least 2000 MB
logical /nobackup 0-	rw                   xfs
# use mkfs.xfs to format the partition


# Create a softRAID
disk_config raid
raid1        /    sda1,sdd1  rw,errors=remount-ro    ext2
# create a RAID-1 on /dev/sda1 and /dev/sdd1, format using mkfs.ext2 and mount
# it as /
raid0        -    sdb1,sde1  default                 ext2
# create a RAID-0 on /dev/sdb1 and /dev/sde1


# config an LVM
disk_config lvm
pv  my_pv   md2,md3
# create the physical volume group my_pv on the (RAID) devices /dev/md2 and
# /dev/md3
my_pv:_usr	/usr			2048        rw,notail    reiser
# create the logical volume _usr on the physical volume group my_pv

================================examples=======================================



The major differences:
- the disk_config ... line allows for the keywords lvm and raid
- options may be appended to the disk_config line as well, but this may be
  subject to change
- the ";" is not used anymore, the options that were given there have now been
  split up
  * the filesystem is now an explicit parameter; note, that the order of
    filesystem/mount-options is not the same as for /etc/fstab, this should
    possibly be changed, but would result in a major change to the previous
    format of disk_config
  * any options to mkfs.xxx may be given
  * the "boot"-option is one of the options now given on the disk_config line
- support for LVM and RAID is completely new :-)



The complete EBNF grammar:

================================EBNF===========================================

file ::= <lines> EOF

lines ::= EOL
          /* empty lines or whitespace only */
          | <comment> EOL
          | <config> EOL

comment ::= #.*

config ::= disk_config lvm
           | disk_config raid
           | disk_config end
           | disk_config disk[[:digit:]]+( <option>)*
           | disk_config [^[:space:]]+( <option>)*
           /* fully qualified device-path or short form, like hda, whereby full
            * path is assumed to be /dev/hda */
           | <volume>

option ::= /* empty */
           | preserve:[[:digit:]]+(,[[:digit:]]+)*
           /* preserve partitions */
           | disklabel:(msdos|sun)
           /* write a disklabel - default is msdos */
           | bootable:[[:digit:]]
           /* mark a partition bootable, default is / */

volume ::= <type> <mountpoint> <size> <mount_options> <filesystem> <fs_options>
           | pv <name> <size>
           /* lvm pv */

type ::= primary
         /* for physical disks only */
         | logical
         /* for physical disks only */
         | raid[015]
         /* raid level */
         | [^/[:space:]]+:[^/[:space:]]+
         /* lvm logical volume: pv name and lv name*/

mountpoint ::= -
               /* do not mount */
               | swap
               /* swap space */
               | /[^[:space:]]*
               /* fully qualified path */

name ::= [^/[:space:]]+
         /* lvm volume group name */

size ::= [[:digit:]]+%?(-[[:digit:]]+%?)?
         /* size in megabytes or %, possibly given as a range; physical
          * partitions or lvm logical volumes only */
         | -[[:digit:]]+%?
         /* size in megabytes or % given as upper limit; physical partitions 
          * or lvm logical volumes only */
         | preserve[[:digit:]]+
         /* do not modify this partition */
         | [^,[:space:]]+(,[^,[:space:]])*
         /* devices for a raid or lvm pv */
    
mount_options ::= [^[:space:]]+

filesystem ::= -
               | swap
               | [^[:space:]]
               /* mkfs.xxx must exist */

fs_options ::= .*
               /* options appended to mkfs.xxx call */

================================EBNF===========================================

I hope the proposal and the examples are clear enough to allow for a wide
discussion. In case there is anything to be clarified, please feel free to ask!

Regards,
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20060429/05d183c5/attachment.bin 


More information about the linux-fai-devel mailing list