Disclosure of Invention
To solve at least one of the above technical problems, the present invention proposes a diskless boot operating system method, a server, and a computer readable storage medium.
To achieve the above object, a first aspect of the present invention provides a method for starting an operating system without disk, including:
receiving an operating system starting instruction;
According to the operating system starting instruction, entering a PXE diskless starting mode;
receiving a boot mode selection instruction in the PXE diskless starting mode;
determining a guide mode type according to the guide mode selection instruction;
Loading a kernel corresponding to the guide mode type into a memory according to the guide mode type and through a guide file;
And entering an operating system and starting the operating system.
In this scheme, according to the boot mode type and through a boot file, loading a kernel corresponding to the boot mode type into a memory, further includes:
loading vmlinux to the memory through the boot file of the PXE;
after the vmlinux runs, the initrd. Img or initramfs switch root directory is loaded.
In this solution, the boot mode includes a BIOS mode and a UEFI mode.
Further, the kernel includes two versions, and the two versions are respectively in one-to-one correspondence with the BIOS mode and the UEFI mode.
In this solution, the method for starting the operating system without a disk further includes:
Receiving and storing a newly added kernel version in a lib catalog in an original system;
Receiving an added module file for the newly added kernel version;
And receiving the written drive installation script according to the added module file.
In this scheme, after receiving the drive installation script of writing, still include:
And adding the drive name of the new hardware device in the dirverlist. Con configuration file, or placing the ko file of the drive in a corresponding directory and adding the ko file into the dirverlist. Con configuration file to realize loading of the drive.
The second aspect of the present invention also proposes a server comprising: the memory comprises a method program for starting the operating system without disk, and the method program for starting the operating system without disk realizes the following steps when being executed by the processor:
receiving an operating system starting instruction;
According to the operating system starting instruction, entering a PXE diskless starting mode;
receiving a boot mode selection instruction in the PXE diskless starting mode;
determining a guide mode type according to the guide mode selection instruction;
Loading a kernel corresponding to the guide mode type into a memory according to the guide mode type and through a guide file;
And entering an operating system and starting the operating system.
In this scheme, according to the boot mode type and through a boot file, loading a kernel corresponding to the boot mode type into a memory, further includes:
loading vmlinux to the memory through the boot file of the PXE;
after the vmlinux runs, the initrd. Img or initramfs switch root directory is loaded.
In this solution, when the method program of the diskless start operating system is executed by the processor, the following steps are further implemented:
Receiving and storing a newly added kernel version in a lib catalog in an original system;
Receiving an added module file for the newly added kernel version;
And receiving the written drive installation script according to the added module file.
The third aspect of the present invention also proposes a computer readable storage medium, in which a method program for starting an operating system without a disk is included, which method program, when executed by a processor, implements the method steps of starting an operating system without a disk as described above.
The method and the device receive the starting instruction of the operating system; according to the operating system starting instruction, entering a PXE diskless starting mode; receiving a boot mode selection instruction in the PXE diskless starting mode; determining a guide mode type according to the guide mode selection instruction; loading a kernel corresponding to the guide mode type into a memory according to the guide mode type and through a guide file; and entering an operating system and starting the operating system. According to the invention, two different kernels are combined in one diskless system, and the two different kernel versions share one set of configuration file, so that the server can automatically enter BOOTos no matter which mode of PXE is started, and the corresponding configuration can be performed without entering the server. Meanwhile, the method and the system can provide convenience for initializing all servers, effectively improve deployment efficiency and save time cost.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will be more clearly understood, a more particular description of the application will be rendered by reference to the appended drawings and appended detailed description. It should be noted that, without conflict, the embodiments of the present application and features in the embodiments may be combined with each other.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways than those described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
FIG. 1 is a flow chart of a method for starting an operating system without disk according to the present invention.
As shown in fig. 1, a first aspect of the present invention proposes a method for starting an operating system without a disk, including:
s102, receiving an operating system starting instruction;
s104, entering a PXE diskless starting mode according to the operating system starting instruction;
s106, receiving a guide mode selection instruction in the PXE diskless starting mode;
s108, determining a guide mode type according to the guide mode selection instruction;
s110, loading a kernel corresponding to the guide mode type into a memory according to the guide mode type and through a guide file;
s112, entering an operating system and starting the operating system.
It should be noted that, when the client at the workstation end is started in the PXE diskless start mode, a self test is performed before the control right is obtained by the network card PXE bootrom program, and then a boot request FIND frame is sent in a broadcast form, which includes the network card number of the client. If the server receives the request field frame, a BOOTP (boot protocol) or DHCP (Dynamic Host Configuration Protocol ) is called to assign the machine name, IP address, and image file at the time of startup, etc. of the workstation side.
After the workstation is allocated to the IP address, after receiving the complete startup file, the workstation starts to execute the startup program in the file by using the TFTP (TRIVIAL FILE TRANSFER Protocol) provided by the server, and turns the execution point to the entry of the startup block to guide the operating system, thereby completing the remote startup.
According to an embodiment of the invention, the boot mode includes a BIOS mode and a UEFI mode.
It should be noted that BIOS (Basic Input Output System) is a set of programs solidified on a ROM chip on the motherboard in the computer, which stores the most important programs of basic input and output, self-checking program after starting up and system self-starting program, and can read and write specific information set by the system from CMOS. Its main function is to provide the lowest, most direct hardware setup and control for the computer. Specifically, the BIOS firstly initializes the CPU, then jumps to the BIOS starting position to carry out POST self-test, if the process has serious errors, the computer can be reminded by different alarm sounds, then loads various hardware in a read interrupt mode, and enters the starting process of the operating system after the hardware initialization is completed.
UEFI (Unified Extensible FIRMWARE INTERFACE) is a standard that describes type interfaces in detail. The interface is used for the operating system to automatically load from a pre-boot operating environment onto an operating system. Specifically, the UEFI runs the pre-loading environment to directly initialize the CPU and the memory, if the CPU and the memory have problems, the CPU and the memory are directly blacked out, then the PXE is started, various hardware is searched in an enumeration mode, the driver is loaded, and the starting process of the operating system is entered after the hardware initialization is completed.
According to the embodiment of the invention, the kernel comprises two versions, and the two versions are respectively in one-to-one correspondence with the BIOS mode and the UEFI mode.
It should be noted that the two versions are 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64, respectively, where versions 2.6.32-573.el6.x86_64 correspond to the BIOS mode and versions 3.10.0-862.el7.x86_64 correspond to the UEFI mode.
It should be noted that conventional diskless systems do not have to bring together two kernel versions redhat 7.5.5 and cents 6.7. And each mode (BIOS mode or UEFI mode) only has one kernel version corresponding, the purpose of configuring two kernel versions in a diskless system cannot be achieved, and each kernel version corresponds to a different mode (BIOS mode or UEFI mode) respectively. However, the diskless system of the present invention combines the conventional BIOS mode and the UEFI mode, and the kernel versions with different modes share a set of configuration files, so that no matter which mode of PXE is selected by the server, the PXE can automatically enter the diskless Bootos, no need to enter the server to perform corresponding configuration, and the configuration is simplified. It will be appreciated that so-called diskless systems operate with vmlinux and initrd. Img in memory, and do not require hard disk storage. It is understood that the server is a server to which an operating system is to be installed.
FIG. 2 is a flow chart of a method for booting an operating system in a diskless boot operating system of the present invention.
As shown in fig. 2, according to the boot mode type and through a boot file, loading a kernel corresponding to the boot mode type into a memory, and further includes:
s202, loading vmlinux to a memory through a guide file of PXE;
s204, after vmlinux runs, the initrd. Img or initramfs is loaded to switch the root directory.
It should be noted that, the boot file includes a BOOTX64.EFI file and a gpxelinux.0 file, and the BOOTX64.EFI file corresponds to a UEFI mode, and the gpxelinux.0 file corresponds to a BIOS mode.
Note that vmlinux is a bootable, compressed kernel, initramfs corresponds to UEFI mode, and initrd.
According to the embodiment of the invention, on the premise of a normal diskless system, the method for realizing the multi-core diskless system comprises the following steps:
Receiving and storing a newly added kernel version in a lib catalog in an original system;
Receiving an added module file for the newly added kernel version;
And receiving the written drive installation script according to the added module file.
Furthermore, on the premise of a normal diskless system (namely, the kernel version is 2.6.32-573.el6.x86_64), a file of the kernel version is newly added in the lib directory (namely, the kernel version is 3.10.0-862.el7.x86_64), then corresponding module files are added, and then some automatic driver installation scripts are written, so that the starting and the use of the newly added kernel version can be realized.
According to an embodiment of the present invention, after receiving the written driver installation script, further comprising:
And adding the drive name of the new hardware device in the dirverlist. Con configuration file, or placing the ko file of the drive in a corresponding directory and adding the ko file into the dirverlist. Con configuration file to realize loading of the drive.
It should be noted that, in the UEFI mode, the loading of the driver is implemented through a dirverlist. Con configuration file, if the server has a new hardware device, only the driver name of the hardware device needs to be added in the configuration file of the server; if the driver of the hardware device is not installed, the driver can be automatically loaded only by putting the ko file of the driver into a corresponding directory and adding the ko file into the dirverlist. It can be understood that the normal device can remove unnecessary drive loading, so as to improve the starting speed of the diskless system and shorten the starting time of the diskless system. It can be understood that the server is a server to which the operating system is to be installed, and all servers need to perform some initialization operations before installation through Bootos, and the initialization is mainly to enter Bootos for collecting relevant data.
In order to better explain the technical scheme of the invention, two versions of kernels 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64 are placed under the same catalog, and the specific placement modes are as follows:
[root@CNSZ049051 modules]#ll
total 12
drwxr-xr-x 7 root root 4096 Sep 20 15:54 2.6.32-573.el6.x86_64
drwxr-xr-x 7 root root 4096 Nov 13 09:47 3.10.0-862.el7.x86_64
-rw-r--r--1 root root 637 Sep 20 15:56 driver.sh
[root@CNSZ049051 modules]#。
FIG. 3 is a flow chart of a method for entering an operating system based on a PXE mode of the present invention.
As shown in fig. 3, the client is turned on and a system start-up is performed; the corresponding PXE start mode (legalcy mode or UEFI mode) is then selected according to user requirements or system defaults. When the LEGACY mode is selected, then gpxelinux.0 is pointed to; then, loading vmlinux and initrd. Img to the memory through the default. Cfg file, and automatically entering a corresponding kernel (the kernel version is 2.6.32-573.el6.x86_64); then, the diskless Bootos is re-entered. When the UEFI mode is selected, then the boot BOOTX64.EFI file is pointed to; then, loading vmlinux, initramfs to the memory through grub.cfg files, and automatically entering the corresponding kernel (the kernel version is 3.10.0-862.el7.x86_64); then, the diskless Bootos is re-entered.
It should be noted that the diskless Bootos is an operating system including two kernels (kernel versions 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64, respectively) together.
It should be noted that, the PXE automatically enters the corresponding kernel versions (2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64) according to the loading of vmlinux, so as to achieve the purpose required by the user.
In order to further explain the technical scheme of the invention, the following specifically describes the flow of the server installation system to be installed:
Firstly, setting a starting item of a system server to be installed, which has a PEX function, as network starting;
secondly, entering a network to start after the system server to be installed is started, wherein the system server to be installed has no IP address and needs to send a broadcast message, and the DHCP server responds to the request of the system server to be installed and distributes corresponding IP address, mask and other information to the system server to be installed;
thirdly, after the system server to be installed obtains an IP address, communicating with a TFTP server, downloading a pxerinux.0 and default file, starting a system kernel according to vmlinuz and initrd. Img appointed by default, and downloading an appointed ks. Cfg file;
Finally, the RPM package is downloaded onto a file sharing server (http/ftp/nfs) according to the ks.cfg file, and the system is started to be installed.
It should be noted that, before installing the system, the environment required by PXE should be deployed: the PXE server needs to have a DHCP server, a TFTP server, and a file server, where the file server may be a file server such as ftp, http, nfs.
FIG. 4 illustrates a block diagram of a server of a diskless boot operating system of the present invention.
As shown in fig. 4, the second aspect of the present invention further proposes a server 4 for a diskless boot operating system, the server 4 comprising: a memory 41 and a processor 42, wherein the memory 41 includes a method program for starting an operating system without disk, and the method program for starting the operating system without disk realizes the following steps when executed by the processor 42:
receiving an operating system starting instruction;
According to the operating system starting instruction, entering a PXE diskless starting mode;
receiving a boot mode selection instruction in the PXE diskless starting mode;
determining a guide mode type according to the guide mode selection instruction;
Loading a kernel corresponding to the guide mode type into a memory according to the guide mode type and through a guide file;
And entering an operating system and starting the operating system.
Preferably, the server may further comprise a display, which may be referred to as a display screen or a display unit. In some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch, or the like. The display is used for displaying information processed in the server and displaying a visual work interface.
Preferably, the Processor may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processing (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It should be noted that, when the client at the workstation end is started in the PXE diskless start mode, a self test is performed before the control right is obtained by the network card PXE bootrom program, and then a boot request FIND frame is sent in a broadcast form, which includes the network card number of the client. If the server receives the request field frame, a BOOTP (boot protocol) or DHCP (Dynamic Host Configuration Protocol ) is called to assign the machine name, IP address, and image file at the time of startup, etc. of the workstation side.
After the workstation is allocated to the IP address, after receiving the complete startup file, the workstation starts to execute the startup program in the file by using the TFTP (TRIVIAL FILE TRANSFER Protocol) provided by the server, and turns the execution point to the entry of the startup block to guide the operating system, thereby completing the remote startup.
According to an embodiment of the invention, the boot mode includes a BIOS mode and a UEFI mode.
It should be noted that BIOS (Basic Input Output System) is a set of programs solidified on a ROM chip on the motherboard in the computer, which stores the most important programs of basic input and output, self-checking program after starting up and system self-starting program, and can read and write specific information set by the system from CMOS. Its main function is to provide the lowest, most direct hardware setup and control for the computer. Specifically, the BIOS firstly initializes the CPU, then jumps to the BIOS starting position to carry out POST self-test, if the process has serious errors, the computer can be reminded by different alarm sounds, then loads various hardware in a read interrupt mode, and enters the starting process of the operating system after the hardware initialization is completed.
UEFI (Unified Extensible FIRMWARE INTERFACE) is a standard that describes type interfaces in detail. The interface is used for the operating system to automatically load from a pre-boot operating environment onto an operating system. Specifically, the UEFI runs the pre-loading environment to directly initialize the CPU and the memory, if the CPU and the memory have problems, the CPU and the memory are directly blacked out, then the PXE is started, various hardware is searched in an enumeration mode, the driver is loaded, and the starting process of the operating system is entered after the hardware initialization is completed.
According to the embodiment of the invention, the kernel comprises two versions, and the two versions are respectively in one-to-one correspondence with the BIOS mode and the UEFI mode.
It should be noted that the two versions are 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64, respectively, where versions 2.6.32-573.el6.x86_64 correspond to the BIOS mode and versions 3.10.0-862.el7.x86_64 correspond to the UEFI mode.
It should be noted that conventional diskless systems do not have to bring together two kernel versions redhat 7.5.5 and cents 6.7. And each mode (BIOS mode or UEFI mode) only has one kernel version corresponding, the purpose of configuring two kernel versions in a diskless system cannot be achieved, and each kernel version corresponds to a different mode (BIOS mode or UEFI mode) respectively. However, the diskless system of the present invention combines the conventional BIOS mode and the UEFI mode, and the kernel versions with different modes share a set of configuration files, so that no matter which mode of PXE is selected by the server, the PXE can automatically enter the diskless Bootos, no need to enter the server to perform corresponding configuration, and the configuration is simplified. It will be appreciated that so-called diskless systems operate with vmlinux and initrd. Img in memory, and do not require hard disk storage. It is understood that the server is a server to which an operating system is to be installed.
Further, loading the kernel corresponding to the boot mode type into the memory according to the boot mode type and through the boot file, and further comprising:
loading vmlinux to the memory through the boot file of the PXE;
after the vmlinux runs, the initrd. Img or initramfs switch root directory is loaded.
It should be noted that, the boot file includes a BOOTX64.EFI file and a gpxelinux.0 file, and the BOOTX64.EFI file corresponds to a UEFI mode, and the gpxelinux.0 file corresponds to a BIOS mode.
Note that vmlinux is a bootable, compressed kernel, initramfs corresponds to UEFI mode, and initrd.
According to an embodiment of the present invention, the method program for starting up an operating system without disk further comprises the following steps when executed by the processor:
Receiving and storing a newly added kernel version in a lib catalog in an original system;
Receiving an added module file for the newly added kernel version;
And receiving the written drive installation script according to the added module file.
Furthermore, on the premise of a normal diskless system (namely, the kernel version is 2.6.32-573.el6.x86_64), a file of the kernel version is newly added in the lib directory (namely, the kernel version is 3.10.0-862.el7.x86_64), then corresponding module files are added, and then some automatic driver installation scripts are written, so that the starting and the use of the newly added kernel version can be realized.
According to an embodiment of the present invention, after receiving the written driver installation script, further comprising:
And adding the drive name of the new hardware device in the dirverlist. Con configuration file, or placing the ko file of the drive in a corresponding directory and adding the ko file into the dirverlist. Con configuration file to realize loading of the drive.
It should be noted that, in the UEFI mode, the loading of the driver is implemented through a dirverlist. Con configuration file, if the server has a new hardware device, only the driver name of the hardware device needs to be added in the configuration file of the server; if the driver of the hardware device is not installed, the driver can be automatically loaded only by putting the ko file of the driver into a corresponding directory and adding the ko file into the dirverlist. It can be understood that the normal device can remove unnecessary drive loading, so as to improve the starting speed of the diskless system and shorten the starting time of the diskless system. It can be understood that the server is a server to which the operating system is to be installed, and all servers need to perform some initialization operations before installation through Bootos, and the initialization is mainly to enter Bootos for collecting relevant data.
In order to better explain the technical scheme of the invention, two versions of kernels 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64 are placed under the same catalog, and the specific placement modes are as follows:
[root@CNSZ049051 modules]#ll
total 12
drwxr-xr-x 7 root root 4096 Sep 20 15:54 2.6.32-573.el6.x86_64
drwxr-xr-x 7 root root 4096 Nov 13 09:47 3.10.0-862.el7.x86_64
-rw-r--r--1 root root 637 Sep 20 15:56 driver.sh
[root@CNSZ049051 modules]#。
According to an embodiment of the invention, the steps for entering an operating system based on a PXE mode are as follows:
Opening a client and starting a system; the corresponding PXE start mode (legalcy mode or UEFI mode) is then selected according to user requirements or system defaults. When the LEGACY mode is selected, then gpxelinux.0 is pointed to; then, loading vmlinux and initrd. Img to the memory through the default. Cfg file, and automatically entering a corresponding kernel (the kernel version is 2.6.32-573.el6.x86_64); then, the diskless Bootos is re-entered. When the UEFI mode is selected, then the boot BOOTX64.EFI file is pointed to; then, loading vmlinux, initramfs to the memory through grub.cfg files, and automatically entering the corresponding kernel (the kernel version is 3.10.0-862.el7.x86_64); then, the diskless Bootos is re-entered.
It should be noted that the diskless Bootos is an operating system including two kernels (kernel versions 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64, respectively) together.
It should be noted that, the PXE automatically enters the corresponding kernel versions (2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64) according to the loading of vmlinux, so as to achieve the purpose required by the user.
In order to further explain the technical scheme of the invention, the following specifically describes the flow of the server installation system to be installed:
Firstly, setting a starting item of a system server to be installed, which has a PEX function, as network starting;
secondly, entering a network to start after the system server to be installed is started, wherein the system server to be installed has no IP address and needs to send a broadcast message, and the DHCP server responds to the request of the system server to be installed and distributes corresponding IP address, mask and other information to the system server to be installed;
thirdly, after the system server to be installed obtains an IP address, communicating with a TFTP server, downloading a pxerinux.0 and default file, starting a system kernel according to vmlinuz and initrd. Img appointed by default, and downloading an appointed ks. Cfg file;
Finally, the RPM package is downloaded onto a file sharing server (http/ftp/nfs) according to the ks.cfg file, and the system is started to be installed.
It should be noted that, before installing the system, the environment required by PXE should be deployed: the PXE server needs to have a DHCP server, a TFTP server, and a file server, where the file server may be a file server such as ftp, http, nfs.
The third aspect of the present invention also proposes a computer readable storage medium, in which a method program for starting an operating system without a disk is included, which method program, when executed by a processor, implements the method steps of starting an operating system without a disk as described above.
The method and the device receive the starting instruction of the operating system; according to the operating system starting instruction, entering a PXE diskless starting mode; receiving a boot mode selection instruction in the PXE diskless starting mode; determining a guide mode type according to the guide mode selection instruction; loading a kernel corresponding to the guide mode type into a memory according to the guide mode type and through a guide file; and entering an operating system and starting the operating system. According to the invention, two different kernels are combined in one diskless system, and the two different kernel versions share one set of configuration file, so that the server can automatically enter BOOTos no matter which mode of PXE is started, and the corresponding configuration can be performed without entering the server. Meanwhile, the method and the system can provide convenience for initializing all servers, effectively improve deployment efficiency and save time cost.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units; can be located in one place or distributed to a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present invention may be integrated in one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or optical disk, or the like, which can store program codes.
Or the above-described integrated units of the invention may be stored in a computer-readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solutions of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.