Remote loading system image method
Obtain the startup information and NFS transmission system image through the PXE client and enter the LiveCD system, which solves the problem of the existing technology being unable to load the operating system in the server memory and the lack of customized loading functions, and realizes a remote loading system for diskless startup and customized loading. Mirroring method.
Patent Information
- Application Number
- CN202011003738.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-22
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-09-22
AI Technical Summary
The existing remote loading system image technology cannot load the operating system in the server memory, and lacks the function of customizing the loading of the server system image.
Obtain startup information from DHCP through the PXE client, download the boot file of the TFTP server, transfer the system image through the NFS server, and finally enter the LiveCD system to load the operating system in the memory and initialize the system through configuration files and scripts.
It implements the functions of diskless boot and customized loading of server system images, supports loading the operating system in the memory, and adapts to the operating system differences of different servers.
Smart Images

Figure CN112130917B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of big data, and in particular relates to a method for remotely loading a system image. Background Art
[0002] In the remote loading system image technology, it is mainly implemented through PXE (Preboot eXecution Environment). The Preboot eXecution Environment, also known as the Pre-Execution Environment, provides a mechanism for starting a computer using a network interface. This mechanism allows the computer to start without relying on local data storage devices (such as hard disks) or locally installed operating systems.
[0003] Among them, 1) PXE service can provide remote loading of system images, but can only support local installation of operating system images for remote loading, and lacks the function of loading operating system in memory; 2) Since the operating systems of different servers are different, PXE service lacks the function of custom loading server system images. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] The technical problem to be solved by the present invention is: how to remotely load a specified operating system image method in a server memory.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention provides a method for remotely loading a system image, in which the PXE client of the computer network card obtains startup information from DHCP, then downloads the boot file from the TFTP server for startup, and transmits the system image through the NFS server, and finally enters the LiveCD system.
[0008] Preferably, the method specifically comprises the following steps:
[0009] Step 1: The PXE client sends a DHCP request to apply for an IP address from the DHCP server.
[0010] Step 2: The DHCP server responds to the request of the PXE client, automatically allocates an IP address from the IP address pool to the PXE client, and informs the PXE client of the IP address of the TFTP server and the PXE boot program file;
[0011] Step 3: The PXE client initiates a request to the TFTP server to obtain the boot program file;
[0012] Step 4: The TFTP server responds to the request of the PXE client and transfers the configuration file to the PXE client.
[0013] Step 5: The NFS server transfers the system image to the PXE client according to the path set in the configuration file;
[0014] Step 6: The PXE client starts the LiveCD system through the network.
[0015] Preferably, the startup process of the LiveCD system in step 6 is:
[0016] Step 61, BIOS reads the BootRecord Volume Descriptor in the CD-ROM, locates the address of the boot.cat file, reads the Boot Entry in the boot.cat file, further locates the address of the isolinux.bin file, and then loads the isolinux.bin file into the memory and executes it;
[0017] Step 62, the isolinux.bin file searches for the isolinux.cfg file in the CD, reads the isolinux.cfg file, and obtains the startup configuration. The isolinux.cfg file records which startup interface is used, which has two types: a graphical interface or a character interface. In the graphical interface, the vesamenu.c32 file and the splash.jpg file are further loaded to complete the display of the graphical interface. After the user selects a startup item, the isolinux.bin file searches for the corresponding kernel file according to the configuration in the isolinux.cfg file, loads the kernel file into the memory, passes the corresponding parameters to the kernel, and executes it;
[0018] Step 63: kernel performs kernel initialization, decompresses initrd.lz to / dev / ram, mounts it as rootfs, and executes the init script therein;
[0019] Step 64, the init script parses the kernel parameters passed in by the isolinux.bin file, then loads the core driver and mounts the runtime file system. In the parameter parsing stage, if boot=casper is recognized, the init script executes the / scripts / casper script, and decompresses squashfs and mounts rootfs by calling the mountroot() function therein. Finally, the init script executes the / bin / run-init program, which completes the switching of rootfs and executes the / sbin / init program. The init program further initializes the user environment according to the configuration in / etc / rc.d, including the graphical interface and network.
[0020] Preferably, in step 64, initializing the user environment includes initializing the graphical interface.
[0021] Preferably, in step 64, initializing the user environment includes initializing the network.
[0022] Preferably, before step 1, the method further includes the following steps: deploying a DHCP server.
[0023] Preferably, before step 1, the method further includes the following steps: deploying a TFTP server.
[0024] Preferably, before step 1, the method further includes the following steps: deploying an NFS server.
[0025] Preferably, before step 1, the method further includes the following steps: configuring a liveCD image.
[0026] Preferably, before step 1, the method further includes the following steps: completing directional configuration.
[0027] (III) Beneficial effects
[0028] The remote loading system image method implemented by the present invention completes diskless booting through PXE and supports the function of loading the operating system in the memory. Since different server operating systems are different, the remote loading system image method of the present invention can realize the function of customizing the loading of the server system image of each client. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a flow chart of the method for remotely loading an operating system image of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, content, and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the accompanying drawings and examples.
[0031] The services that the PXE server needs to provide include the following:
[0032] DHCP (Dynamic Host Configuration Protocol) is usually used in large local area network environments. Its main function is to centrally manage and allocate IP addresses, so that hosts in the network environment can dynamically obtain IP addresses, Gateway addresses, DNS server addresses and other information, and can improve the usage rate of addresses. The DHCP service is used to allocate IP addresses during the OS installation process.
[0033] TFTP (Trivial File Transfer Protocol) is a protocol in the TCP / IP protocol family used for simple file transfer between client and server, providing uncomplicated and low-cost file transfer services. TFTP service is used to request the download of system boot files during OS installation.
[0034] NFS (Network File System) is a UNIX presentation layer protocol developed by SUN, which enables users to access files elsewhere on the network just like using their own computers. NFS is used to transfer system images during OS installation.
[0035] like Figure 1 As shown, a remote loading system image method provided by the present invention (which involves the working process of a PXE server and a client) comprises the following steps:
[0036] Step 1: The PXE client sends a DHCP request to apply for an IP address from the DHCP server.
[0037] Step 2: The DHCP server responds to the request of the PXE client, automatically allocates an IP address from the IP address pool to the PXE client, and informs the PXE client of the IP address of the TFTP server and the PXE boot program file;
[0038] Step 3: The PXE client initiates a request to the TFTP server to obtain the boot program file;
[0039] Step 4: The TFTP server responds to the request of the PXE client and transfers the configuration file to the PXE client.
[0040] Step 5: The NFS server transfers the system image to the PXE client according to the path set in the configuration file;
[0041] Step 6: The PXE client starts the LiveCD system through the network.
[0042] To put it simply, the PXE of the computer network card obtains the startup information from DHCP, then downloads the boot file from the TFTP server for startup, and transfers the system image through the NFS server, and finally enters the LiveCD system.
[0043] The LiveCD system startup process in step 6 is as follows:
[0044] Step 61, BIOS reads the BootRecord Volume Descriptor in the CD-ROM, locates the address of the boot.cat file, reads the Boot Entry in the boot.cat file, further locates the address of the isolinux.bin file, and then loads the isolinux.bin file into the memory and executes it;
[0045] Step 62, the isolinux.bin file searches for the isolinux.cfg file in the CD, reads the isolinux.cfg file, and obtains the startup configuration. The isolinux.cfg file records which startup interface is used, which has two types: a graphical interface or a character interface. In the graphical interface, the vesamenu.c32 file and the splash.jpg file are further loaded to complete the display of the graphical interface. After the user selects a startup item, the isolinux.bin file searches for the corresponding kernel file according to the configuration in the isolinux.cfg file (pxelinux.cfg if started through PXE), loads it into the memory, passes the corresponding parameters to the kernel, and executes it;
[0046] Step 63: kernel performs kernel initialization, decompresses initrd.lz to / dev / ram, mounts it as rootfs, and executes the / init script therein;
[0047] Step 64, the init script parses the kernel parameters passed in by the isolinux.bin file, then loads the core driver and mounts the runtime file system. In the parameter parsing stage, if boot=casper is recognized, the init script executes the / scripts / casper script, mainly calling the mountroot() function therein to decompress squashfs and mount rootfs. Finally, the init script executes the / bin / run-init program, which completes the switching of rootfs and executes the / sbin / init program. The init program further initializes the user environment according to the configuration in / etc / rc.d, including the graphical interface, network, etc.
[0048] At this point, the LiveCD system startup is complete.
[0049] In the above process, you must first do the following preparations (the steps of this preparation are examples of deploying PXE in Ubuntu. The instructions used in other operating systems (such as CentOS, etc.) may be different, including installation instructions, installation package names, etc., but the overall idea is roughly the same, and administrator privileges are assumed by default):
[0050] Step 1: Deploy the DHCP server
[0051] 1. Install DHCP server software;
[0052] 2. Edit the dhcpd.conf configuration file;
[0053] Enter the DHCP configuration file, open it with vim, nano (or any text editor) and make the following changes (IP address is modified according to the actual situation, the test IP is: 192.168.3.11);
[0054] Start the DHCP service and allow the service to start automatically at boot;
[0055] Step 2: Deploy TFTP server
[0056] 1. Install TFTP server software;
[0057] 2. Edit the tftp configuration file; change the yes of disable to no;
[0058] 3. Start the TFTP service and allow the service to start automatically at boot.
[0059] Step 3: Deploy NFS server
[0060] 1. Install NFS server software;
[0061] 2. Create an NFS server path. The example path is / nfs.
[0062] 3. Edit the configuration file and add the NFS server path created in the previous step to the file;
[0063] 4. Start the NFS service and allow the service to start automatically at boot.
[0064] Step 4: Configure the liveCD image
[0065] 1. Copy the boot file and configuration file to the tftpboot directory (the location varies depending on the system)
[0066] Including: pxelinux.0, ldlinux.c32, libcom32.c32, libmenu.c32, libutil.c32, vesamenu.c32;
[0067] In the example, the path of pxelinux.0 is / usr / lib / PXELINUX, and the paths of other configuration files are / usr / lib / syslinux.
[0068] 2. Copy the kernel file to the tftpboot directory;
[0069] Kernel files are usually in the system image. Different system images may have different file names. The image used in the example is Ubuntu 19.04, the kernel name is vmlinuz, and the initial image is initrd.
[0070] 3. Create the pxelinux.cfg directory;
[0071] 4. Copy the isolinux.cfg file in the system image directory to the pxelinux.cfg directory and rename it to default (default is the default name. If you need to configure it in a targeted way, you can change the file name to the hexadecimal IP address of the client, such as 192.168.3.13=C0A8030D);
[0072] 5. Modify the default configuration file.
[0073] Step 5: Complete the directional configuration
[0074] The first to fourth steps have achieved diskless booting through PXE. This step will enable the specified client to boot the specified system image.
[0075] 1. Modify the DHCP configuration file;
[0076] Assign a fixed IP address to a specified client by MAC address:
[0077] 2. Modify the configuration file in pxelinux.cfg.
[0078] Put the pxe configuration file of the specified system image into the pxelinux.cfg folder and rename it to the hexadecimal name of the specified client IP address. For example, if the client IP address has been set to 192.168.3.13 in the previous step, you need to change the configuration file name to C0A8030D (192=C0, 168=A8, 3=03, 13=0D).
[0079] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for remotely loading a system image, characterized in that: In this method, the PXE client of the computer network card obtains the startup information from DHCP, then downloads the boot file from the TFTP server to start, and transmits the system image through the NFS server, and finally enters the LiveCD system; The method specifically comprises the following steps: Step 1: The PXE client sends a DHCP request to apply for an IP address from the DHCP server. Step 2: The DHCP server responds to the request of the PXE client, automatically allocates an IP address from the IP address pool to the PXE client, and informs the PXE client of the IP address of the TFTP server and the PXE boot program file; Step 3: The PXE client initiates a request to the TFTP server to obtain the boot program file; Step 4: The TFTP server responds to the request of the PXE client and transfers the configuration file to the PXE client. Step 5: The NFS server transfers the system image to the PXE client according to the path set in the configuration file; Step 6. The PXE client starts the LiveCD system through the network; The LiveCD system startup process in step 6 is as follows: Step 61, BIOS reads the BootRecordVolume Descriptor in the CD-ROM, locates the address of the boot.cat file, reads the Boot Entry in the boot.cat file, further locates the address of the isolinux.bin file, and then loads the isolinux.bin file into the memory and executes it; Step 62, the isolinux.bin file searches for the isolinux.cfg file in the CD, reads the isolinux.cfg file, and obtains the startup configuration. The isolinux.cfg file records which startup interface is used, which has two types: a graphical interface or a character interface. In the graphical interface, the vesamenu.c32 file and the splash.jpg file are further loaded to complete the display of the graphical interface. After the user selects a startup item, the isolinux.bin file searches for the corresponding kernel file according to the configuration in the isolinux.cfg file, loads the kernel file into the memory, passes the corresponding parameters to the kernel, and executes it; Step 63: kernel performs kernel initialization, decompresses initrd.lz to / dev / ram, mounts it as rootfs, and executes the init script therein; Step 64, the init script parses the kernel parameters passed in by the isolinux.bin file, then loads the core driver and mounts the runtime file system. In the parameter parsing stage, if boot=casper is recognized, the init script executes the / scripts / casper script, and decompresses squashfs and mounts rootfs by calling the mountroot() function therein. Finally, the init script executes the / bin / run-init program, which completes the switching of rootfs and executes the / sbin / init program. The init program further initializes the user environment according to the configuration in / etc / rc.d, including the graphical interface and network.
2. The method according to claim 1, characterized in that In step 64, when the user environment is initialized, the graphical interface is initialized.
3. The method according to claim 2, characterized in that In step 64, when the user environment is initialized, the network is initialized.
4. The method according to claim 1, characterized in that Before step 1, the following steps are also included: deploying a DHCP server.
5. The method according to claim 1, characterized in that Before step 1, the following steps are also included: deploying a TFTP server.
6. The method according to claim 1, characterized in that Before step 1, the following steps are also included: deploying an NFS server.
7. The method according to claim 1, characterized in that Before step 1, the following steps are also included: Configure the liveCD image.
8. The method according to claim 1, characterized in that Before step 1, the following steps are also included: completing the directional configuration.
