Disclosure of Invention
In order to solve at least technical problems, the invention provides diskless boot operating system methods, servers and computer readable storage media.
In order to achieve the above object, the aspect of the present invention provides a method for starting an operating system without a disk, including:
receiving an operating system starting instruction;
entering a PXE diskless starting mode according to the operating system starting instruction;
receiving a boot mode selection instruction in the PXE diskless start mode;
determining a guidance mode type according to the guidance mode selection instruction;
loading a kernel corresponding to the boot mode type to a memory through a boot file according to the boot mode type;
and entering an operating system and starting the operating system.
In this scheme, loading, according to the boot mode type and through a boot file, a kernel corresponding to the boot mode type to a memory further includes:
loading vmlinux to a memory through a boot file of PXE;
and after the vmlinux runs, loading initrd. img or initramfs to switch the root directory.
In this scheme, the boot mode includes a BIOS mode and a UEFI mode.
Further , the kernel includes two versions, and the two versions correspond to the BIOS mode and the UEFI mode , respectively.
In this scheme, the method for starting an operating system without a disk further includes:
receiving and storing a newly added kernel version in a lib directory in an original system;
receiving an added module file for the newly added kernel version;
and receiving a written driver installation script according to the added module file.
In this scheme, after receiving the written driver installation script, the method further includes:
and adding a drive name of a new hardware device in a dirverlist.con configuration file, or putting a driven ko file into a corresponding directory and adding the driven ko file into the dirverlist.con configuration file to realize the loading of the drive.
The second aspect of the present invention further provides kinds of servers, where the servers include a memory and a processor, the memory includes kinds of method programs for booting an operating system without a disk, and when executed by the processor, the method programs for booting the operating system without a disk implement the following steps:
receiving an operating system starting instruction;
entering a PXE diskless starting mode according to the operating system starting instruction;
receiving a boot mode selection instruction in the PXE diskless start mode;
determining a guidance mode type according to the guidance mode selection instruction;
loading a kernel corresponding to the boot mode type to a memory through a boot file according to the boot mode type;
and entering an operating system and starting the operating system.
In this scheme, loading, according to the boot mode type and through a boot file, a kernel corresponding to the boot mode type to a memory further includes:
loading vmlinux to a memory through a boot file of PXE;
and after the vmlinux runs, loading initrd. img or initramfs to switch the root directory.
In this embodiment, when executed by the processor, the method for starting the operating system without the disk further includes:
receiving and storing a newly added kernel version in a lib directory in an original system;
receiving an added module file for the newly added kernel version;
and receiving a written driver installation script according to the added module file.
The third aspect of the present invention further proposes computer-readable storage media, where the computer-readable storage media includes methods of the diskless boot os, and when the methods of the diskless boot os are executed by a processor, the methods of the methods of the diskless boot os are implemented.
The method comprises the steps of receiving an operating system starting instruction, entering a PXE diskless starting mode according to the operating system starting instruction, receiving a boot mode selection instruction in the PXE diskless starting mode, determining a boot mode type according to the boot mode selection instruction, loading a kernel corresponding to the boot mode type to a memory according to the boot mode type and a boot file, entering the operating system and starting the operating system, combining two different kernels into diskless systems, enabling two different kernel versions to share a set configuration file, and enabling to enable the server to automatically enter BOOTos from the PXE starting of any mode and enable the server not to enter the server for corresponding configuration.
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 to make the aforementioned objects, features and advantages of the present invention more clearly understandable, the present invention is described in detail in below with reference to the accompanying drawings and detailed description.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
FIG. 1 is a flow chart of a method for starting an operating system without a disk according to of the present invention.
As shown in fig. 1, the aspect of the present invention provides a method for kinds of diskless boot operating systems, including:
s102, receiving an operating system starting instruction;
s104, entering a PXE diskless start mode according to the operating system start instruction;
s106, receiving a boot mode selection instruction in the PXE diskless start mode;
s108, determining the type of the guide mode according to the guide mode selection instruction;
s110, loading a kernel corresponding to the boot mode type to a memory through a boot file according to the boot mode type;
and S112, entering an operating system and starting the operating system.
It should be noted that, when entering the PXE diskless boot mode, after the client on the workstation side is booted, a self-test is performed before obtaining control right through the network card PXE bootrom program, and then boot request FIND frames are sent in the form of broadcasts, which contain the network card number of the client.
After the workstation allocates an IP address, a TFTP (Trivial File transfer protocol) provided by the server is used to receive the complete startup File, then the startup program in the File is executed, the execution point is turned to the entry of the startup block, the operating system is guided, and the remote startup is completed.
According to an embodiment of the invention, the boot modes include a BIOS mode and a UEFI mode.
It is noted that BIOS (basic Input Output system) is sets of programs that are fixed on ROM chips on a main board in a computer, and it stores the most important basic Input and Output programs of the computer, a POST-power-on self-test program and a system self-start program, and it can read and write specific information of system settings from CMOS.
UEFI (unified Extensible Firmware interface) is a standard of detailed description type interfaces, the interfaces are used for automatically loading an operating system from a pre-started operating environment to operating systems, concretely, the UEFI running pre-loading environment directly initializes a CPU and a memory, if the CPU and the memory have problems, the CPU and the memory directly blank a screen, then a PXE is started, various hardware is searched in an enumeration mode and a drive is loaded, and the starting process of the operating system is started after the hardware is initialized.
According to an embodiment of the invention, the kernel includes two versions, and the two versions correspond to the BIOS mode and the UEFI mode , respectively.
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 the versions 2.6.32-573.el6.x86_64 correspond to the BIOS mode and the versions 3.10.0-862.el7.x86_64 correspond to the UEFI mode.
It should be noted that, the conventional diskless system does not achieve the purpose of configuring two kernel versions redhat7.5 and centros 6.7 at , and each mode (BIOS mode or UEFI mode) has only kernel versions corresponding to each other, which fails to achieve the purpose of configuring two kernel versions in diskless systems, and each kernel version corresponds to a different mode (BIOS mode or UEFI mode), however, the diskless system of the present invention combines the conventional BIOS mode and UEFI mode into , and the kernel versions with two different modes share configuration files, so , the e boot of whatever px mode the server selects can automatically enter diskless boots, without entering the server to perform corresponding configuration, and simplifying configuration.
FIG. 2 is a flow chart illustrating a method for booting an operating system in a diskless boot operating system of the present invention.
As shown in fig. 2, loading the kernel corresponding to the boot mode type into the memory through the boot file according to the boot mode type further includes:
s202, loading vmlinux to a memory through a boot file of the PXE;
s204, after the vmlinux runs, loading initrd. img or initramfs switching 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.
It should be noted 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 directory in an original system;
receiving an added module file for the newly added kernel version;
and receiving a written driver installation script according to the added module file.
And , adding kernel version files (namely, the kernel version is 3.10.0-862.el7.x86_64) in the lib directory under the premise of a normal diskless system (namely, the kernel version is 2.6.32-573.el6.x86_64), then adding corresponding module files, and writing drive automatic installation scripts, so that the starting and the use of the added kernel version can be realized.
According to the embodiment of the present invention, after receiving the written driver installation script, the method further includes:
and adding a drive name of a new hardware device in a dirverlist.con configuration file, or putting a driven ko file into a corresponding directory and adding the driven ko file into the dirverlist.con configuration file to realize the loading of the drive.
It should be noted that, in the UEFI mode, the loading of the driver is implemented by dirverlist.con configuration files, if the server has new hardware devices, only the driver name of the hardware device needs to be added to the configuration files of the server, if the driver of the hardware device is not installed, only the ko file of the driver needs to be put into the corresponding directory and added to the dirverlist.con configuration files, and the driver can be automatically loaded.
To better illustrate the technical solution of the present invention, the cores of the 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64 versions are placed under the same directories in the following specific placement manner:
[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 illustrating a method for entering an operating system based on PXE mode in accordance with the present invention at .
As shown in fig. 3, the client is turned on and the system starts up; then, a corresponding PXE start mode (LEGACY mode or UEFI mode) is selected according to user requirements or system defaults. When LEGACY mode is selected, then gpxelinux.0 is pointed to; then, loading vmlinux and initrd.img into a memory through a default.cfg file, and automatically entering a corresponding kernel (the kernel version is 2.6.32-573.el6.x86_ 64); and then enters diskless Bootos. When the UEFI mode is selected, pointing to a boot BOOTX64.EFI file; then, loading vmlinux and initramfs into a memory through a grub.cfg file, and automatically entering a corresponding kernel (the kernel version is 3.10.0-862.el7.x86_ 64); and then enters diskless Bootos.
It should be noted that the diskless bootes is os including two cores (the core versions are 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64, respectively) starting at .
It should be noted that the PXE automatically enters the corresponding kernel version (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 that the user needs to achieve.
To further illustrate the technical solution of the present invention, the following describes the flow of installing the system by the server to be installed specifically:
firstly, setting a startup starting item of a system server to be installed with a PEX function as network startup;
secondly, the system server to be installed enters a network for starting after starting up, the system server to be installed does not have an IP address at the moment, broadcast messages need to be sent, and the DHCP server responds to the request of the system server to be installed and distributes information such as the corresponding IP address, mask code and the like to the system server to be installed;
thirdly, after the system server to be installed obtains the IP address, the system server communicates with the TFTP server, the pxelinux.0 and the default file are downloaded, the system kernel is started according to vmlinux and initrd.img specified by the default, and the specified ks.cfg file is downloaded;
finally, the RPM pack is downloaded on a file sharing server (http/ftp/nfs) according to the ks.cfg file, and the system is installed.
It should be noted that, before installing the system, an environment required by the PXE is to be deployed, where the PXE server side needs DHCP servers, TFTP servers, and file servers, where the file servers may be ftp, http, nfs, and other file servers.
FIG. 4 is a server block diagram illustrating diskless boot operating systems of the present invention.
As shown in fig. 4, the second aspect of the present invention further provides an server 4 for booting an operating system without a disk, where the server 4 includes a memory 41 and a processor 42, the memory 41 includes method programs for booting the operating system without a disk, and the method programs for booting the operating system without a disk when executed by the processor 42 implement the following steps:
receiving an operating system starting instruction;
entering a PXE diskless starting mode according to the operating system starting instruction;
receiving a boot mode selection instruction in the PXE diskless start mode;
determining a guidance mode type according to the guidance mode selection instruction;
loading a kernel corresponding to the boot mode type to a memory through a boot file according to the boot mode type;
and entering an operating system and starting the operating system.
the display can be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch screen, etc. 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 (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Array (FPGA) or other Programmable logic device, discrete or transistor logic, discrete hardware components, etc.
It should be noted that, when entering the PXE diskless boot mode, after the client on the workstation side is booted, a self-test is performed before obtaining control right through the network card PXE bootrom program, and then boot request FIND frames are sent in the form of broadcasts, which contain the network card number of the client.
After the workstation allocates an IP address, a TFTP (Trivial File transfer protocol) provided by the server is used to receive the complete startup File, then the startup program in the File is executed, the execution point is turned to the entry of the startup block, the operating system is guided, and the remote startup is completed.
According to an embodiment of the invention, the boot modes include a BIOS mode and a UEFI mode.
It is noted that BIOS (basic Input Output system) is sets of programs that are fixed on ROM chips on a main board in a computer, and it stores the most important basic Input and Output programs of the computer, a POST-power-on self-test program and a system self-start program, and it can read and write specific information of system settings from CMOS.
UEFI (unified Extensible Firmware interface) is a standard of detailed description type interfaces, the interfaces are used for automatically loading an operating system from a pre-started operating environment to operating systems, concretely, the UEFI running pre-loading environment directly initializes a CPU and a memory, if the CPU and the memory have problems, the CPU and the memory directly blank a screen, then a PXE is started, various hardware is searched in an enumeration mode and a drive is loaded, and the starting process of the operating system is started after the hardware is initialized.
According to an embodiment of the invention, the kernel includes two versions, and the two versions correspond to the BIOS mode and the UEFI mode , respectively.
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 the versions 2.6.32-573.el6.x86_64 correspond to the BIOS mode and the versions 3.10.0-862.el7.x86_64 correspond to the UEFI mode.
It should be noted that, the conventional diskless system does not achieve the purpose of configuring two kernel versions redhat7.5 and centros 6.7 at , and each mode (BIOS mode or UEFI mode) has only kernel versions corresponding to each other, which fails to achieve the purpose of configuring two kernel versions in diskless systems, and each kernel version corresponds to a different mode (BIOS mode or UEFI mode), however, the diskless system of the present invention combines the conventional BIOS mode and UEFI mode into , and the kernel versions with two different modes share configuration files, so , the e boot of whatever px mode the server selects can automatically enter diskless boots, without entering the server to perform corresponding configuration, and simplifying configuration.
Further , loading, according to the boot mode type and through a boot file, a kernel corresponding to the boot mode type to a memory, further includes:
loading vmlinux to a memory through a boot file of PXE;
and after the vmlinux runs, loading initrd. img or initramfs 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.
It should be noted that vmlinux is a bootable, compressed kernel, initramfs corresponds to UEFI mode, and initrd.
According to an embodiment of the present invention, when executed by the processor, the method program for booting an operating system without a disk further implements the following steps:
receiving and storing a newly added kernel version in a lib directory in an original system;
receiving an added module file for the newly added kernel version;
and receiving a written driver installation script according to the added module file.
And , adding kernel version files (namely, the kernel version is 3.10.0-862.el7.x86_64) in the lib directory under the premise of a normal diskless system (namely, the kernel version is 2.6.32-573.el6.x86_64), then adding corresponding module files, and writing drive automatic installation scripts, so that the starting and the use of the added kernel version can be realized.
According to the embodiment of the present invention, after receiving the written driver installation script, the method further includes:
and adding a drive name of a new hardware device in a dirverlist.con configuration file, or putting a driven ko file into a corresponding directory and adding the driven ko file into the dirverlist.con configuration file to realize the loading of the drive.
It should be noted that, in the UEFI mode, the loading of the driver is implemented by dirverlist.con configuration files, if the server has new hardware devices, only the driver name of the hardware device needs to be added to the configuration files of the server, if the driver of the hardware device is not installed, only the ko file of the driver needs to be put into the corresponding directory and added to the dirverlist.con configuration files, and the driver can be automatically loaded.
To better illustrate the technical solution of the present invention, the cores of the 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64 versions are placed under the same directories in the following specific placement manner:
[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 the embodiment of the invention, the steps of entering the operating system based on the PXE mode are as follows:
opening a client and starting a system; then, a corresponding PXE start mode (LEGACY mode or UEFI mode) is selected according to user requirements or system defaults. When LEGACY mode is selected, then gpxelinux.0 is pointed to; then, loading vmlinux and initrd.img into a memory through a default.cfg file, and automatically entering a corresponding kernel (the kernel version is 2.6.32-573.el6.x86_ 64); and then enters diskless Bootos. When the UEFI mode is selected, pointing to a boot BOOTX64.EFI file; then, loading vmlinux and initramfs into a memory through a grub.cfg file, and automatically entering a corresponding kernel (the kernel version is 3.10.0-862.el7.x86_ 64); and then enters diskless Bootos.
It should be noted that the diskless bootes is os including two cores (the core versions are 2.6.32-573.el6.x86_64 and 3.10.0-862.el7.x86_64, respectively) starting at .
It should be noted that the PXE automatically enters the corresponding kernel version (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 that the user needs to achieve.
To further illustrate the technical solution of the present invention, the following describes the flow of installing the system by the server to be installed specifically:
firstly, setting a startup starting item of a system server to be installed with a PEX function as network startup;
secondly, the system server to be installed enters a network for starting after starting up, the system server to be installed does not have an IP address at the moment, broadcast messages need to be sent, and the DHCP server responds to the request of the system server to be installed and distributes information such as the corresponding IP address, mask code and the like to the system server to be installed;
thirdly, after the system server to be installed obtains the IP address, the system server communicates with the TFTP server, the pxelinux.0 and the default file are downloaded, the system kernel is started according to vmlinux and initrd.img specified by the default, and the specified ks.cfg file is downloaded;
finally, the RPM pack is downloaded on a file sharing server (http/ftp/nfs) according to the ks.cfg file, and the system is installed.
It should be noted that, before installing the system, an environment required by the PXE is to be deployed, where the PXE server side needs DHCP servers, TFTP servers, and file servers, where the file servers may be ftp, http, nfs, and other file servers.
The third aspect of the present invention further proposes computer-readable storage media, where the computer-readable storage media includes methods of the diskless boot os, and when the methods of the diskless boot os are executed by a processor, the methods of the methods of the diskless boot os are implemented.
The method comprises the steps of receiving an operating system starting instruction, entering a PXE diskless starting mode according to the operating system starting instruction, receiving a boot mode selection instruction in the PXE diskless starting mode, determining a boot mode type according to the boot mode selection instruction, loading a kernel corresponding to the boot mode type to a memory according to the boot mode type and a boot file, entering the operating system and starting the operating system, combining two different kernels into diskless systems, enabling two different kernel versions to share a set configuration file, and enabling to enable the server to automatically enter BOOTos from the PXE starting of any mode and enable the server not to enter the server for corresponding configuration.
The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units into only logical functional divisions, and other divisions may be possible in actual practice, e.g., multiple units or components may be combined, or may be integrated into another systems, or features may be omitted or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in places, may be distributed on a plurality of network units, and may select some or all of the units according to actual needs to achieve the purpose of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into processing units, or each unit may be used as units individually, or two or more units may be integrated into units, and the integrated units may be implemented in the form of hardware, or in the form of hardware and software functional units.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Based on the understanding, the technical solution of the embodiments of the present invention or the portions contributing to the prior art may be embodied in the form of a software product stored in storage media, which includes several instructions for making computer devices (which may be personal computers, servers, or network devices) execute all or part of the methods described in the embodiments of the present invention.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.