In the use of PXE combined with the kickstart file can be implemented network fully automatic installation of Linux system, according to kickstart syntax required in the Ks.cfg file to specify the location of the operating system installation (designated hard disk) such as HDA, SDA or the UUID of the hard disk and other unique identification, Partition information and the location where the MBR is established.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7C/DF/wKiom1bZu9_whoNOAAAp7Xjxnfc005.png "title=" Qq20160305004531.png "alt=" Wkiom1bzu9_whonoaaap7xjxnfc005.png "/>
If the hard drive command is specified incorrectly or does not match the actual hard drive command, Cannot find the corresponding device and so Anaconda will directly ks.cfg the file error and cause the installation to fail, if you do not specify the hard disk information in the Ks.cfg file, then when the partition step, Anaconda will stop to let the manual operation so that the task continues, the bulk host installation system will seriously reduce the deployment efficiency.
Under normal circumstances, CentOS, RHEL, SUSE, Ubuntu and other Linux systems according to Sas/sata interface HDD default to/DEV/SDA,/dev/sdb,/dev/sdc ...., but there are special cases, For example, the HP Server board installed P410 array card configuration raid after the Centos/rhel platform by default under the name/dev/cciss/c0d0,/DEV/CCISS/C0, the different virtualization platform of the virtual disk on the Linux platform default command may not be the same, The Xen virtualization disk defaults to the/dev/xvda,/dev/xvde command, and the KVM virtualization disk defaults to/dev/vda,/dev/vdb to commands, and so on.
If the motherboard is directly connected to the Sas/sata hard drive or the local hard drive managed by the RAID controller through the PXE installation system, the system and MBR will be installed on the local hard disk, if the motherboard through the fiber HBA card mapped SAN storage, through the Linux kernel priority scan to, is ordered to/dev/ SDA, it is possible to install the operating system to a local hard disk by default, and the MBR is installed to the SAN storage, causing the system to not start properly after installation is complete.
So can anaconda automatically identify the name of the disk based on disk size or type, and determine where we want to install the system?
This is a problem that can be solved in the kickstart syntax, which is part of the pre-preinstallation environment and can be done before performing the installation. In the load kernel use the script to determine what we need to install the hard disk name, and then assign to the kickstart file call.
Here we use a size of 32GB disk to install the operating system and MBR, from the/proc/partitions file content to determine the first block size of 32gb*1024*1024=3355442kb disk.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7C/DE/wKioL1bZwwaA9iVUAAAVO_VJjng095.png "title=" Qq20160305011436.png "alt=" Wkiol1bzwwaa9ivuaaavo_vjjng095.png "/>
Pre-Install Script section (Note that%pre ends with%end to end the identity):
disk=$ (while read Line;do awk ' begin{} {if ($ = = "33554432" && "$ = =" 0 ") Print $4} end{} ';d one </proc/partit Ions
Cat >/tmp/part-include << EOF
# Disk Partitioning Information
Part/--asprimary--fstype= "Ext4"--ondisk= $disk--size=24576
Part swap--fstype= "swap"--ondisk= $disk--size=8191
Eof
Writes the identified disk name to the temporary file/tmp/part-include according to kickstart syntax, and then modifies the portion of the partition parameter in the Kickstart file to invoke the contents of the/tmp/part-include file
%include/tmp/part-include
Complete sections such as:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7E/1C/wKiom1b3gezSk2idAACHTj3GzXw145.png "title=" Qq20160327144642.png "alt=" Wkiom1b3gezsk2idaachtj3gzxw145.png "/>
In this way, no matter how the disk is named, the installation system can be flexibly installed based on the capacity to determine the location.
This article from "Server System Communication" blog, declined reprint!
Troubleshoot Kickstart auto-Identify hard disk problems when PXE installs Linux systems