HardDisksManagement: Difference between revisions

From T2B Wiki
Jump to navigation Jump to search
 
Line 29: Line 29:
/hardware/harddisks/<harddisk_name>/boot
/hardware/harddisks/<harddisk_name>/boot
</pre>
</pre>
It is a boolean that is used to define the value of DISK_BOOT_DEV. Have a look at the code of the template site/filesystems/layout :
This boolean can be set in the hardware template. It is used to define the value of DISK_BOOT_DEV. Have a look at the code of the template site/filesystems/layout :
<pre>
<pre>
...
...

Latest revision as of 20:55, 20 October 2015

How to define the disk layout of a machine

The template to edit is site/config. The variable to edit is FILESYSTEM_LAYOUT_CONFIG_SITE. Here is an example :

variable FILESYSTEM_LAYOUT_CONFIG_SITE = {
	if (match(FULL_HOSTNAME,'^fs.wn.iihe.ac.be')) {
		return('site/filesystems/newfs');
	} else if (match(FULL_HOSTNAME,'^node')) {
		return('site/filesystems/classic_wn');
	} else if (match(FULL_HOSTNAME,'^m[0-9]+')) {
		return('site/filesystems/classic_wn');
	} else if (match(FULL_HOSTNAME,'test.iihe.ac.be')) {
		return('site/filesystems/classic_single_root');
	}  else {
		return('site/filesystems/classic_server');
	};
};

The choice of the filesystem layout is thus depending on the machine name.

The template filesystem/config (in standard library) does the real work : it chews up the global variables to generate the contents of the Quattor tree under the following branches :

/system/blockdevices
/system/filesystems

Specifying the disk that will used to boot the machine

The path is :

/hardware/harddisks/<harddisk_name>/boot

This boolean can be set in the hardware template. It is used to define the value of DISK_BOOT_DEV. Have a look at the code of the template site/filesystems/layout :

...
variable DISK_BOOT_DEV ?= boot_disk();
variable DISK_BOOT_DEV ?= {
  if (exists('/hardware/harddisks/sda')) {
    return('sda');
...

This fragment of PAN code shows that even if the boot disk is not defined explicitly, an educated guess is made by choosing the first disk. Defining DISK_BOOT_DEV is important because it might be used in some filesystem layouts to define the name of the root partition. An example illustrating this can be found in site/filesystems/classic_single_root :

variable DISK_BOOT_PARTS = list('root');
variable DISK_VOLUME_PARAMS = {
      t = dict();
      t['root'] = dict('size', -1,
                       'mountpoint', '/',
                       'type', 'partition',
                       'device', DISK_BOOT_DEV+to_string(index('root',DISK_BOOT_PARTS)+1));
      t;
};

In this example, if DISK_BOOT_DEV is 'sda', then the name of the device of the root partition will be 'sda1'.