HardDisksManagement: Difference between revisions

From T2B Wiki
Jump to navigation Jump to search
Line 31: Line 31:
/system/filesystems
/system/filesystems
</pre>
</pre>
Note: the content of the site specific template site/filesystems/layout is in fact coming from filesystem/config that can be found in Quattor Github in template-library-standard.


= Specifying the disk that will used to boot the machine =
= Specifying the disk that will used to boot the machine =

Revision as of 18:26, 19 October 2015

How to define the disk layout of a machine

The template to edit is config/filesystems. As this template is site specific, it is defined through the global variable FILESYSTEM_CONFIG_SITE, and it will be included in the machine-type base template with a code like this :

include { return(FILESYSTEM_CONFIG_SITE) };

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 filesystem layout is thus depending on the machine name.

And the very end of config/filesystems, you should find :

include 'site/filesystems/layout';

The template site/filesystems/layout 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

Note: the content of the site specific template site/filesystems/layout is in fact coming from filesystem/config that can be found in Quattor Github in template-library-standard.

Specifying the disk that will used to boot the machine

The path is :

/hardware/harddisks/<harddisk_name>/boot

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 :

...
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'.