AII version 2 and complex block device schemas

From PDP/Grid Wiki
Jump to navigationJump to search

Version 2 of the Automated Installation Infrastructure (AII) component of Quattor, enables to configure and install hosts with complex block device schemas. Complex block device schemas may consist of combinations of for example multiple disks, (software) RAID devices and Logical Volumes. This section describes a concrete example of such a setup.


Desired Setup

The concrete example we consider is a generic server with 2 identical 500 GB SCSI disks. These disks will be operated in a software RAID-1 setup, where every partition will be mirrored on the both disks.

The server will have file systems /boot, /, /tmp, a swap partition, and a logical volume group that will contain space for future file systems.

This setup is organized as follows. On every disk, there will be 4 partitions: sda1-sda4 and sdb1-sdb4. The partitions are combined in software RAID1 devices md0-md3. The /boot, / and swap file systems are placed directly on the RAID1 devices md0-md2. Device md3 will host a logical volume group called 'dom0', in which a logical volume /tmp will be created.

sda1+sdb1   md0         /boot           256 MB
sda2+sdb2   md1         /               8 GB
sda3+sdb3   md2         swap            4 GB
sda4+sdb4   md3         LVG dom0        rest
            dom0        /tmp            4 GB

Pan Example

The setup described above can be configured in Pan in two steps. One step describes the block devices (disk partitions, RAID1, LVM), the other step specifies how the file systems relate to the block devices.

The following Pan code configures the desired block device setup:

include quattor/blockdevices;
variable DEV_MD ?= "md";
variable DEV_D1 ?= "sda";
variable DEV_D2 ?= "sdb";
"/system/blockdevices" = nlist (
   "physical_devs", nlist (
       DEV_D1, nlist ("label", "msdos"),
       DEV_D2, nlist ("label", "msdos"),
   ),
   "partitions", nlist (
       DEV_D1+"1", nlist (
           "holding_dev", DEV_D1,
           "size", 256,
       ),
       DEV_D1+"2", nlist (
           "holding_dev", DEV_D1,
           "size", 8192,
       ),
       DEV_D1+"3", nlist (
           "holding_dev", DEV_D1,
           "size", 4096,
       ),
       DEV_D1+"4", nlist (
           "holding_dev", DEV_D1,
       ),
       DEV_D2+"1", nlist (
           "holding_dev", DEV_D2,
           "size", 256,
       ),
       DEV_D2+"2", nlist (
           "holding_dev", DEV_D2,
           "size", 8192,
       ),
       DEV_D2+"3", nlist (
           "holding_dev", DEV_D2,
           "size", 4096,
       ),
       DEV_D2+"4", nlist (
           "holding_dev", DEV_D2,
       ),
   ),
   "md", nlist(
       DEV_MD+"0", nlist(
           "device_list", list("partitions/"+DEV_D1+"1", "partitions/"+DEV_D2+"1"),
           "raid_level", "RAID1",
       ),
       DEV_MD+"1", nlist(
           "device_list", list("partitions/"+DEV_D1+"2", "partitions/"+DEV_D2+"2"),
           "raid_level", "RAID1",
       ),
       DEV_MD+"2", nlist(
           "device_list", list("partitions/"+DEV_D1+"3", "partitions/"+DEV_D2+"3"),
           "raid_level", "RAID1",
       ),
       DEV_MD+"3", nlist(
           "device_list", list("partitions/"+DEV_D1+"4", "partitions/"+DEV_D2+"4"),
           "raid_level", "RAID1",
       ),
   ),
   "volume_groups", nlist(
       "dom0", nlist(
           "device_list", list("md/"+DEV_MD+"3"),
       ),
   ),
   "logical_volumes", nlist(
       "tmp", nlist(
           "size", 4096,
           "volume_group", "dom0"
       ),
   ),
);


The Pan code to relate the file systems to the block devices is as follows:

include quattor/filesystems;
"/system/filesystems" = list (
   nlist (
       "block_device", "md/" + DEV_MD + "0",
       "mount", true,
       "mountpoint", "/boot",
       "preserve", false,
       "format", true,
       "mountopts", "auto",
       "type", "ext2",
   ),
   nlist (
       "mount", true,
       "mountpoint", "/",
       "preserve", false,
       "format", true,
       "mountopts", "auto",
       "block_device", "md/" + DEV_MD + "1",
       "type", "ext3",
   ),
   nlist (
       "mount", true,
       "mountpoint", "swap",
       "preserve", false,
       "format", true,
       "mountopts", "auto",
       "block_device", "md/" + DEV_MD + "2",
       "type", "swap",
   ),
   nlist (
       "block_device", "logical_volumes/tmp",
       "mount", true,
       "mountpoint", "/tmp",
       "preserve", false,
       "format", true,
       "mountopts", "auto",
       "type", "ext3",
   ),
);

Remarks

It is possible to re-install the server, while preserving some file systems that were created in the logical volume group. This requires that the partition tables are preserved. In Pan:

variable AII_OSINSTALL_OPTION_CLEARMBR = false;
variable AII_OSINSTALL_OPTION_CLEARPART = list();

The logical volume group and its contents will not be touched, apart from the /tmp file system because it is marked to be reformatted ("format"=true) and not preserverd ("preserve"=false).

File system that were created as logical volumes and which should be preserved, may be added to the Pan setup before re-installing. For example, to preserve a file system /testdata in a logical volume test, add the following to the block device setup (under logical_volumes):

       "test", nlist(
           "size", 10240,
           "volume_group", "dom0"
       ),

and add the following to the file system description:

   nlist (
       "block_device", "logical_volumes/test",
       "mount", true,
       "mountpoint", "/testdata",
       "preserve", true,
       "format", false,
       "mountopts", "auto",
       "type", "ext3",
   ),