This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#Mini-design for determining proper install disk
##Background
For RedHat/Ubuntu/Sles/PowerKVM, the method to choose installation disk are different, but with similar logic. It is inconvenient for maintenance.
The current logic also contain a potential issue that it may choose different installation disk when reinstalling which will cause multiple OS be installed on the sever.
In the purpose of making maintenance easier and resolving the potential issue, a new single getinstdisk script is needed for all of those 4 OS.
##The current method
###For RedHat and Sles
- check /dev/vd*
check disk driver with “edd_id”, if the driver of the disk named as “int13_dev80”, the disk will be treat as install_disk and end checking.
If No install_disk get, go to step 2.
- check /dev/sd*
For each disk
-
check disk driver with “edd_id”, if the driver of the disk named as “int13_dev80”, the disk will be treat as install_disk and end checking.
-
if checking disk driver with “edd_id” failed, use “udevadm” to check the device driver, and then classify the drivers into 3 types and record the disk.
type1: "ata_piix4","PMC MaxRAID”,”ahci”,"megaraid_sas".
type2: “mptsas”,”mpt2sas”,"mpt3sas".
type3: others.
If No install_disk get, go to step 3.
-
If the first disk with driver type1 exist, it will be treat as install_disk.
Else, if the first disk with driver type2 exists, it will be treat as install_disk.
Else, if the first disk with driver type3 exists, it will be treat as install_disk.
-
If the install_disk still can not be found, the install_disk will be “/dev/sda”
The problems are:
-
There is no edd_id command in RH7.x and Sles 12.x
-
The disk name /dev/sd* may change, the current logic may return another hard disk when reinstalling.
###For PowerKVM
- check disks in /proc/partitions
Use “udevadm info” to check disk attributes, get DEVTYPE and ID_WWN attributes. For the disks with DEVTYPE equal “disk”, the disk with biggest ID_WWN will be choose as the install_disk.
If No install_disk found, go to step 2.
- check /dev/sd*
For each disk
use “udevadm info —attribute-walk” to check the disk drivers. The same logic as section 2 of step2 in Redhat and Sles prescript.
-
The same with step3 in Redhat and Sles prescript.
-
The same with step4 in Redhat and Sles prescript.
The problems are:
-
If there is OS installed before, it may choose another disk to install OS which may cause multiple OS installed on the server.
-
More steps are same with the script for Redhat and Sles.
###For Ubuntu
- check partitions that list by “list-devices partition”
For each partition, try to mount it and then check whether there is kernel file in the partition.
For the first partition have kernel file, choose its hard disk as the install_disk.
If No install_disk found, go to step 2.
- check disks list by list-devices disk
For each disk, use udevadm info —attribute-walk to check the disk drivers. The same logic as section 2 of step2 in Redhat and Sles prescript.
For disks with driver type 1("ata_piix4","PMC MaxRAID”,”ahci”,"megaraid_sas") and type2 ("mptsas”,”mpt2sas”,"mpt3sas"), collect their DEVPATH attribute with command udevadm info. At last, get the first disk (sort by number with DEVPATH) as the install_disk.
- If still No install_disk get, choose /dev/sda
The problems are:
- The mount command will fail if no filesystem type specified for xfs(used by RH), which mean the step1 doesn’t work if there is RH/Sles have been installed before.
- Sort disk with DEVPATH will fail if the disk is put to another slot.
##The final solution
Based on the analysis above and the fact that each physical disk must have an unique WWN or PATH(for more info about WWN, pls reference https://en.wikipedia.org/wiki/World_Wide_Name), the new solution are like this:
- Check all partitions list in /proc/partitions(All information of /proc/partitions will show in log)
For each partition("Check the partition ***." will show in log)
1.1. Get its disk(move the num in the partition name out) and check whether the disk file(/tmp/xcat.getinstalldisk/$disk)exists. If exists, it means the disk must had OS installed, go to next partition("The disk *** had OS installed, check next partition." will show in log).
1.2. If the disk file (/tmp/xcat.getinstalldisk/$disk) of the partition does’t exist:
1.2.1. Use *udevadm info --query=property —name=/dev/<The partition name> | grep -i ID_FS_TYPE* to check its filesystem type and then mount it to check whether there is kernel file in this partition.
1.2.2. If the partition have kernel file, write the disk file(/tmp/xcat.getinstalldisk/$disk). Add disk name into disk_array("The partition *** has kernel file." will show in log).
If there is disk_array, set disks as disk_array("The disks which have kernel: ***" will show in log). Else, get disks list in /proc/partitions.
- Check disks get last step
For each disk
2.1. Use udevadm info $disk| grep -i ID_WWN to check whether it have WWN. Use udevadm info $disk | grep -i DEVPATH to check whether it have PATH. Use udevadm info --attribute-walk --name /dev/$disk |grep DRIVERS|grep -v '""'|grep -v '"sd"' to get the disk driver.("The disk *** information: disk_wwn=*** disk_path=*** disk_driver=***" will show in log)
2.2. If has WWN information, the variable prefix as "wwn", has_wwn as 1, and disk_data as WWN information, go to 2.4. If not, check variable has_wwn. If it is 1, check next disk("The disk *** has no wwn info. There is other disk has wwn info, so don't record this disk.").
2.3. If has_wwn is 0, check whether it have PATH information. If has, set the variable prefix as "path", has_path as 1, and disk_data as PATH information, go to 2.4. If not, check variable has_path. If it is 1, check next disk("The disk *** has no wwn or path info. There is other disk has path info, so don't record this disk."). If it is 0, set prefix as "other" and disk_data as empty.
2.4. Classify disks based on disk driver into 3 types:
**type1: "ata_piix*", "PMC MaxRAID”, ”ahci”, "megaraid_sas"** For the disk whose driver belong to type1, the disk name and disk_data will be write into /tmp/xcat.getinstalldisk/prefix_class1.("Add disk: *** (disk_name) *** (disk_data) into *** (prefix) firstchoicedisks" will show in log)
**type2: “mptsas”, ”mpt2sas”, "mpt3sas"** For the disk whose driver belong to type2, the disk name and disk_data will be write into /tmp/xcat.getinstalldisk/prefix_class2.("Add disk: *** (disk_name) *** (disk_data) into *** (prefix) secondchoicedisks" will show in log)
**type3: others** For the disk whose driver belong to type3, the disk name and disk_data will be write into /tmp/xcat.getinstalldisk/prefix_class3.("Add disk: *** (disk_name) *** (disk_data) into *** (prefix) thirdchoicedisks" will show in log)
After disks checking, check the files wrote in the step above.
If file /tmp/xcat.getinstalldisk/prefix_class1 exists, sort it and choose the disk with smallest disk_data as the install_disk.
Else, if file /tmp/xcat.getinstalldisk/prefix_class2 exists, sort it and choose the disk with smallest disk_data as the install_disk.
Else, if file /tmp/xcat.getinstalldisk/prefix_class3 exists, sort it and choose the disk with smallest disk_data as the install_disk.
("The install_disk is *** by sorting *** and DRIVER." will show in log.)
-
If still no install_disk found, choose “/dev/sda” ("The default install_disk is ***." will show in log)
-
Write install_disk into /tmp/install_disk in order to be used for the following scripts.
News
- Apr 22, 2016: xCAT 2.11.1 released.
- Mar 11, 2016: xCAT 2.9.3 (AIX only) released.
- Dec 11, 2015: xCAT 2.11 released.
- Nov 11, 2015: xCAT 2.9.2 (AIX only) released.
- Jul 30, 2015: xCAT 2.10 released.
- Jul 30, 2015: xCAT migrates from sourceforge to github
- Jun 26, 2015: xCAT 2.7.9 released.
- Mar 20, 2015: xCAT 2.9.1 released.
- Dec 12, 2014: xCAT 2.9 released.
- Sep 5, 2014: xCAT 2.8.5 released.
- May 23, 2014: xCAT 2.8.4 released.
- Jan 24, 2014: xCAT 2.7.8 released.
- Nov 15, 2013: xCAT 2.8.3 released.
- Jun 26, 2013: xCAT 2.8.2 released.
- May 17, 2013: xCAT 2.7.7 released.
- May 10, 2013: xCAT 2.8.1 released.
- Feb 28, 2013: xCAT 2.8 released.
- Nov 30, 2012: xCAT 2.7.6 released.
- Oct 29, 2012: xCAT 2.7.5 released.
- Aug 27, 2012: xCAT 2.7.4 released.
- Jun 22, 2012: xCAT 2.7.3 released.
- May 25, 2012: xCAT 2.7.2 released.
- Apr 20, 2012: xCAT 2.7.1 released.
- Mar 19, 2012: xCAT 2.7 released.
- Mar 15, 2012: xCAT 2.6.11 released.
- Jan 23, 2012: xCAT 2.6.10 released.
- Nov 15, 2011: xCAT 2.6.9 released.
- Sep 30, 2011: xCAT 2.6.8 released.
- Aug 26, 2011: xCAT 2.6.6 released.
- May 20, 2011: xCAT 2.6 released.
- Feb 14, 2011: Watson plays on Jeopardy and is managed by xCAT!
- xCAT Release Notes Summary
- xCAT OS And Hw Support Matrix
- xCAT Test Environment Summary
History
- Oct 22, 2010: xCAT 2.5 released.
- Apr 30, 2010: xCAT 2.4 is released.
- Oct 31, 2009: xCAT 2.3 released.
xCAT's 10 year anniversary! - Apr 16, 2009: xCAT 2.2 released.
- Oct 31, 2008: xCAT 2.1 released.
- Sep 12, 2008: Support for xCAT 2
can now be purchased! - June 9, 2008: xCAT breaths life into
(at the time) the fastest
supercomputer on the planet - May 30, 2008: xCAT 2.0 for Linux
officially released! - Oct 31, 2007: IBM open sources
xCAT 2.0 to allow collaboration
among all of the xCAT users. - Oct 31, 1999: xCAT 1.0 is born!
xCAT started out as a project in
IBM developed by Egan Ford. It
was quickly adopted by customers
and IBM manufacturing sites to
rapidly deploy clusters.