[go: up one dir, main page]

CN114579148A - Installation method and device of operating system - Google Patents

Installation method and device of operating system Download PDF

Info

Publication number
CN114579148A
CN114579148A CN202210199995.3A CN202210199995A CN114579148A CN 114579148 A CN114579148 A CN 114579148A CN 202210199995 A CN202210199995 A CN 202210199995A CN 114579148 A CN114579148 A CN 114579148A
Authority
CN
China
Prior art keywords
partition
image file
hard disk
operating system
partition configuration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210199995.3A
Other languages
Chinese (zh)
Inventor
和志华
李高强
曹先念
葛鹏程
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Kaitian Technology Co Ltd
Original Assignee
Lenovo Kaitian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lenovo Kaitian Technology Co Ltd filed Critical Lenovo Kaitian Technology Co Ltd
Priority to CN202210199995.3A priority Critical patent/CN114579148A/en
Publication of CN114579148A publication Critical patent/CN114579148A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The present disclosure relates to an installation method and device of an operating system, the method is applied to a server, and comprises the following steps: obtaining an image file of an operating system to be installed; performing partition configuration on the hard disk of the server based on the mirror image file to generate a partition configuration file; and installing the mirror image file based on the partition configuration file. According to the method, the hard disk of the server can be subjected to customized automatic partitioning according to actual needs, compared with the hard disk subjected to default partitioning, the size of the partition can be conveniently adjusted according to needs, the situation that the capacity of part of hard disk partitions is insufficient or wasted is avoided, and the performance of the server can be effectively improved; in addition, in the partitioning process, manual partitioning operation is not needed, and the installation efficiency of the operating system can be improved. In addition, the installation method can be suitable for various scenes such as research and development, test, production, field after-sale service and the like, can comprehensively improve the enterprise efficiency, and improves the use experience of customers.

Description

操作系统的安装方法及装置Operating system installation method and device

技术领域technical field

本公开涉及计算机操作系统安装技术领域,具体涉及一种操作系统的安装方法及装置。The present disclosure relates to the technical field of computer operating system installation, and in particular, to a method and device for installing an operating system.

背景技术Background technique

异构平台下系统安装一般通过光驱、制作USB启动盘等方式按照系统默认的分区或者手动指定分区进行安装,安装步骤需要人员交互进行操作。但是,全盘分区安装,分区布局僵化,系统根分区容量无法调整,导致部分磁盘空间存在浪费,而另一部分磁盘空间可能存在容量不足,影响计算机的性能;且手动进行分区操作,费时费力,影响操作系统安装效率。System installation on heterogeneous platforms is generally performed by means of CD-ROM drive, making a USB boot disk, etc., according to the default partition of the system or manually specifying the partition. The installation steps require human interaction. However, the entire disk is installed with partitions, the partition layout is rigid, and the capacity of the system root partition cannot be adjusted, resulting in waste of some disk space, while another part of the disk space may have insufficient capacity, which affects the performance of the computer; and the manual partition operation is time-consuming and laborious, affecting the operation. System installation efficiency.

发明内容SUMMARY OF THE INVENTION

本公开实施例提供了一种操作系统的安装方法及装置,能够对服务器的硬盘进行定制化自动分区,提高服务器的性能;且分区过程中无需人工手动进行分区操作,可以提高操作系统安装效率。The embodiments of the present disclosure provide a method and device for installing an operating system, which can perform customized automatic partitioning of a hard disk of a server to improve the performance of the server; and no manual partitioning operation is required during the partitioning process, which can improve the operating system installation efficiency.

根据本公开的方案之一,提供一种操作系统的安装方法,应用于服务器,所述方法包括:According to one of the solutions of the present disclosure, there is provided a method for installing an operating system, which is applied to a server, and the method includes:

获得待安装的操作系统的镜像文件;Obtain the image file of the operating system to be installed;

基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件;Perform partition configuration on the hard disk of the server based on the image file, and generate a partition configuration file;

基于所述分区配置文件安装所述镜像文件。The image file is installed based on the partition configuration file.

在一些实施例中,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:In some embodiments, performing partition configuration on the hard disk of the server based on the image file, and generating a partition configuration file, including:

基于所述镜像文件和所述硬盘的硬盘属性对所述硬盘进行分区配置,生成分区配置文件。The hard disk is partitioned based on the image file and the hard disk attributes of the hard disk, and a partition configuration file is generated.

在一些实施例中,所述服务器为异构平台,包括多个处理器,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:In some embodiments, the server is a heterogeneous platform, including multiple processors, and performs partition configuration on the hard disk of the server based on the image file, and generates a partition configuration file, including:

基于所述镜像文件和多个所述处理器的架构对所述硬盘进行分区配置,生成分区配置文件。Perform partition configuration on the hard disk based on the image file and the architectures of the plurality of processors, and generate a partition configuration file.

在一些实施例中,所述操作系统至少包括第一操作系统和第二操作系统,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:In some embodiments, the operating system includes at least a first operating system and a second operating system, and performs partition configuration on the hard disk of the server based on the image file, and generates a partition configuration file, including:

基于所述第一操作系统的第一镜像文件对所述硬盘进行分区配置,生成第一分区配置文件;Perform partition configuration on the hard disk based on the first image file of the first operating system to generate a first partition configuration file;

基于所述第二操作系统的第二镜像文件对所述硬盘进行分区配置,生成第二分区配置文件;Perform partition configuration on the hard disk based on the second image file of the second operating system to generate a second partition configuration file;

对所述第一配置文件和所述第二配置文件进行整合,生成第三分区配置文件。The first configuration file and the second configuration file are integrated to generate a third partition configuration file.

在一些实施例中,基于所述分区配置文件安装所述镜像文件,包括:In some embodiments, installing the image file based on the partition configuration file includes:

将所述操作系统的镜像文件制作成U盘启动盘;Making the image file of the operating system into a U disk boot disk;

根据所述分区配置文件,利用所述U盘启动盘安装所述镜像文件。According to the partition configuration file, the image file is installed by using the U disk boot disk.

在一些实施例中,基于所述分区配置文件安装所述镜像文件,包括:In some embodiments, installing the image file based on the partition configuration file includes:

基于所述分区配置文件对所述镜像文件进行重新封装,得到封装后的第三镜像文件;Re-encapsulate the image file based on the partition configuration file to obtain the encapsulated third image file;

将所述第三镜像文件制作成启动盘并安装。The third image file is made into a bootable disk and installed.

在一些实施例中,基于所述分区配置文件安装所述镜像文件,包括:In some embodiments, installing the image file based on the partition configuration file includes:

基于所述分区配置文件对所述镜像文件进行重新封装,得到第四镜像文件;Repackage the image file based on the partition configuration file to obtain a fourth image file;

响应于接收的预启动执行环境PXE启动指令,基于PXE网络启动安装所述第四镜像文件。In response to the received pre-boot execution environment PXE boot instruction, the fourth image file is booted and installed based on the PXE network.

在一些实施例中,在对所述服务器的硬盘进行分区配置之前,所述方法还包括:In some embodiments, before performing partition configuration on the hard disk of the server, the method further includes:

裁剪去掉所述镜像文件中预设的备份分区。Cut out the preset backup partition in the image file.

在一些实施例中,裁剪去掉所述镜像文件中预设的备份分区之后,所述方法还包括:In some embodiments, after trimming and removing the backup partition preset in the image file, the method further includes:

判断所述镜像文件对应的安装程序中是否存在“系统备份还原”启动选项;Determine whether the "system backup and restore" startup option exists in the installation program corresponding to the image file;

若存在,裁剪去掉所述“系统备份还原”启动选项。If it exists, trim and remove the "system backup and restore" startup option.

根据本公开的方案之一,还提供一种操作系统的安装装置,包括:According to one of the solutions of the present disclosure, a device for installing an operating system is also provided, including:

获得模块,配置为获得待安装的操作系统的镜像文件;Obtaining a module, configured to obtain an image file of the operating system to be installed;

分区配置模块,配置为基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件;A partition configuration module, configured to perform partition configuration on the hard disk of the server based on the image file, and generate a partition configuration file;

安装模块,配置为基于所述分区配置文件安装所述镜像文件。An installation module, configured to install the image file based on the partition configuration file.

根据本公开的方案之一,还提供一种服务器,包括存储器和至少一个处理器,存储器用于存储至少一条计算机程序指令,至少一个处理器用于通过加载并执行所述至少一条计算机程序指令以实现上述的操作系统的安装方法。According to one of the solutions of the present disclosure, a server is also provided, including a memory and at least one processor, where the memory is used to store at least one computer program instruction, and the at least one processor is used to load and execute the at least one computer program instruction to achieve The installation method of the above operating system.

根据本公开的方案之一,还提供一种计算机存储介质,所述计算机存储介质上存储有计算机程序指令;所述计算机程序指令被处理器执行时实现上述的操作系统的安装方法。According to one of the solutions of the present disclosure, a computer storage medium is also provided, where computer program instructions are stored thereon; when the computer program instructions are executed by a processor, the above-mentioned operating system installation method is implemented.

本公开的各种实施例提供的操作系统的安装方法、装置服务器及计算机存储介质,在获得待安装的操作系统的镜像文件后,根据该镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,进而根据该分区配置文件安装操作系统的镜像文件,可以根据实际需要对服务器的硬盘进行定制化自动分区,相较于将硬盘进行默认分区,便于根据需要调整分区大小,避免部分硬盘分区存在容量不足或浪费,可以有效提高服务器的性能;另外,分区过程中无需人工手动进行分区操作,可以提高操作系统安装效率。此外,本公开实施例提供的操作系统的安装方法可以适用于研发、测试、生产、现场售后服务等多种场景,能够全面提升企业效率,提高客户使用体验。In the operating system installation method, the device server, and the computer storage medium provided by various embodiments of the present disclosure, after obtaining the image file of the operating system to be installed, partition configuration is performed on the hard disk of the server according to the image file, and partitions are generated. Configuration file, and then install the image file of the operating system according to the partition configuration file, you can customize and automatically partition the hard disk of the server according to actual needs. There is insufficient or wasteful capacity, which can effectively improve the performance of the server; in addition, manual partitioning operations are not required during the partitioning process, which can improve the efficiency of operating system installation. In addition, the operating system installation method provided by the embodiment of the present disclosure can be applied to various scenarios such as research and development, testing, production, and on-site after-sales service, which can comprehensively improve enterprise efficiency and improve customer experience.

附图说明Description of drawings

图1示出本公开实施例的操作系统的安装方法的一流程图;FIG. 1 shows a flowchart of a method for installing an operating system according to an embodiment of the present disclosure;

图2示出本公开实施例的操作系统的安装方法的另一流程图;FIG. 2 shows another flowchart of an operating system installation method according to an embodiment of the present disclosure;

图3示出本公开实施例的操作系统的安装方法的又一流程图;FIG. 3 shows another flowchart of an operating system installation method according to an embodiment of the present disclosure;

图4示出本公开实施例的操作系统的安装方法的又一流程图;FIG. 4 shows another flowchart of an operating system installation method according to an embodiment of the present disclosure;

图5示出本公开实施例的操作系统的安装方法的又一流程图;FIG. 5 shows yet another flowchart of an operating system installation method according to an embodiment of the present disclosure;

图6示出本公开实施例的操作系统的安装装置的结构示意图。FIG. 6 shows a schematic structural diagram of an installation device for an operating system according to an embodiment of the present disclosure.

具体实施方式Detailed ways

此处参考附图描述本公开的各种方案以及特征。Various aspects and features of the present disclosure are described herein with reference to the accompanying drawings.

应理解的是,可以对此处申请的实施例做出各种修改。因此,上述说明书不应该视为限制,而仅是作为实施例的范例。本领域的技术人员将想到在本公开的范围和精神内的其他修改。It should be understood that various modifications may be made to the embodiments claimed herein. Therefore, the above description should not be regarded as limiting, but merely as exemplifications of embodiments. Those skilled in the art will envision other modifications within the scope and spirit of this disclosure.

包含在说明书中并构成说明书的一部分的附图示出了本公开的实施例,并且与上面给出的对本公开的大致描述以及下面给出的对实施例的详细描述一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the present disclosure and, together with the general description of the disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the disclosure. principle.

通过下面参照附图对给定为非限制性实例的实施例的优选形式的描述,本公开的这些和其它特性将会变得显而易见。These and other features of the present disclosure will become apparent from the following description of preferred forms of embodiment, given as non-limiting examples, with reference to the accompanying drawings.

还应当理解,尽管已经参照一些具体实例对本公开进行了描述,但本领域技术人员能够确定地实现本公开的很多其它等效形式。It should also be understood that although the present disclosure has been described with reference to some specific examples, those skilled in the art will be able to recognize many other equivalents of the present disclosure.

当结合附图时,鉴于以下详细说明,本公开的上述和其他方面、特征和优势将变得更为显而易见。The above and other aspects, features and advantages of the present disclosure will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.

此后参照附图描述本公开的具体实施例;然而,应当理解,所申请的实施例仅仅是本公开的实例,其可采用多种方式实施。熟知和/或重复的功能和结构并未详细描述以避免不必要或多余的细节使得本公开模糊不清。因此,本文所申请的具体的结构性和功能性细节并非意在限定,而是仅仅作为权利要求的基础和代表性基础用于教导本领域技术人员以实质上任意合适的详细结构多样地使用本公开。Specific embodiments of the present disclosure are hereinafter described with reference to the accompanying drawings; however, it is to be understood that the claimed embodiments are merely examples of the present disclosure, which may be embodied in various ways. Well-known and/or repeated functions and constructions have not been described in detail to avoid obscuring the present disclosure with unnecessary or redundant detail. Therefore, specific structural and functional details claimed herein are not intended to be limiting, but merely serve as a basis for the claims and a representative basis for teaching one skilled in the art to variously employ the present invention in substantially any suitable detailed structure. public.

图1示出了本公开实施例的操作系统的安装方法的流程图。如图1所示,本公开实施例提供了一种操作系统的安装方法,应用于服务器,所述方法包括:FIG. 1 shows a flowchart of a method for installing an operating system according to an embodiment of the present disclosure. As shown in FIG. 1 , an embodiment of the present disclosure provides a method for installing an operating system, which is applied to a server, and the method includes:

S101:获得待安装的操作系统的镜像文件。S101: Obtain an image file of an operating system to be installed.

待安装的操作系统可以为Windows操作系统、Linux操作系统等,也可以为Android操作系统(基于Linux的自由及开放源代码的操作系统,主要用于移动终端)、iOS操作系统等。服务器可以为台式机(pc机)、笔记本、PDA、手机等终端的服务器,也可以为工控机等大型计算机的服务器。The operating system to be installed may be a Windows operating system, a Linux operating system, etc., or an Android operating system (a Linux-based free and open source operating system, mainly used for mobile terminals), an iOS operating system, and the like. The server may be a server of a terminal such as a desktop computer (PC), a notebook, a PDA, and a mobile phone, or a server of a large computer such as an industrial computer.

操作系统的镜像文件可以预先获得并刻录在光盘或存储在U盘等存储设备中,当存储设备连接至服务器时,服务器便可获得镜像文件。例如,服务器可以从网络下载获得Win10系统的镜像文件并将其放在启动U盘的相应文件夹里,以便安装。服务器也可以从网络直接下载获得镜像文件。镜像文件可以为ISO镜像文件或GHO镜像文件。The image file of the operating system can be obtained in advance and recorded on a CD-ROM or stored in a storage device such as a USB flash drive. When the storage device is connected to the server, the server can obtain the image file. For example, the server can download and obtain the image file of the Win10 system from the network and put it in the corresponding folder of the boot U disk for installation. The server can also directly download the image file from the network. The image file can be an ISO image file or a GHO image file.

S102:基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件。S102: Perform partition configuration on the hard disk of the server based on the image file to generate a partition configuration file.

服务器在获取待安装的操作系统的镜像文件后可以根据镜像文件对服务器的硬盘进行自动化分区配置,生成对应的分区配置文件,进而根据该分区配置文件对硬盘进行自动分区,实现硬盘分区的自动化定制。After the server obtains the image file of the operating system to be installed, it can perform automatic partition configuration on the hard disk of the server according to the image file, generate a corresponding partition configuration file, and then automatically partition the hard disk according to the partition configuration file to realize automatic customization of hard disk partitions .

其中,分区配置文件为用于对硬盘进行分区的相关配置信息,包括分区个数和各分区的分区参数等。各分区的分区参数可以包括分区类型、分区名称、分区大小、分区顺序、卷标等。The partition configuration file is related configuration information for partitioning the hard disk, including the number of partitions and the partition parameters of each partition. The partition parameters of each partition may include a partition type, a partition name, a partition size, a partition order, a volume label, and the like.

分区类型根据不同的划分标准确定,例如,分区类型可以根据硬盘文件系统格式分为FAT32、NTFS和exFAT,分区类型可以根据是否为物理内存,分为主分区和逻辑分区;分区类型也可以根据待存储的文件类型或用途分为系统分区(根分区)、启动分区、备份分区等。其中,系统分区主要指的是用于启动操作系统的分区,通常该分区的根目录下,包含操作系统的启动文件(如boot.ini、ntldr等)。The partition type is determined according to different division standards. For example, the partition type can be divided into FAT32, NTFS, and exFAT according to the hard disk file system format. The partition type can be divided into primary partition and logical partition according to whether it is physical memory; The types or uses of stored files are divided into system partitions (root partitions), boot partitions, backup partitions, and so on. The system partition mainly refers to a partition used to start the operating system. Usually, the root directory of the partition contains the startup files of the operating system (such as boot.ini, ntldr, etc.).

服务器可以根据生成的分区配置文件对新安装在服务器的硬盘进行分区;也可以在服务器原有的硬盘分区基础上,根据镜像文件对硬盘的分区进行重新分区,例如,可以增加或减少硬盘分区、调整各硬盘分区的分区大小等。The server can partition the hard disk newly installed on the server according to the generated partition configuration file; it can also re-partition the hard disk partition according to the image file based on the original hard disk partition of the server. For example, you can increase or decrease the hard disk partition, Adjust the partition size of each hard disk partition, etc.

本实施例中,可以根据镜像文件的文件类型对硬盘进行分区。例如,对于Windows操作系统可以将服务器的硬盘分为C、D、E、F等盘,C盘主要用于存放系统文件。对于Linux系统,可以将其划分为根分区(root分区)、交换分区(swap分区)以及其他分区等。In this embodiment, the hard disk may be partitioned according to the file type of the image file. For example, for the Windows operating system, the hard disk of the server can be divided into C, D, E, F and other disks, and the C disk is mainly used for storing system files. For a Linux system, it can be divided into root partition (root partition), swap partition (swap partition), and other partitions.

在另一些实施中,还可以根据镜像文件的文件大小等对硬盘进行分区,例如,当镜像文件的文件大小较大时,可以将Linux系统根分区的分区大小设置的较大,以为系统文件提供足够的存储空间;而当镜像文件的文件大小较小时,可以将Linux系统根分区的分区大小设置的较小,以避免硬盘空间的浪费。In other implementations, the hard disk can also be partitioned according to the file size of the image file. For example, when the file size of the image file is large, the partition size of the root partition of the Linux system can be set larger to provide system files with a larger size. Sufficient storage space; and when the file size of the image file is small, the partition size of the root partition of the Linux system can be set to a smaller size to avoid waste of hard disk space.

可选地,在确定划分的硬盘分区的分区大小后,可以根据该分区大小确定硬盘分区的其他分区参数,例如,由于FAT32的硬盘格式不能支持4GB以上的文件,在确定划分的硬盘分区的分区大小远小于4GB(例如1GB)时,可以将该硬盘分区的硬盘文件系统格式确定为FAT32,FAT32兼容性较好,便于快速读写工作;而将其他硬盘分区的硬盘文件系统格式确定为NTFS,支持4GB以上的文件,且存储和读写方便快捷;为保证硬盘分区可以支持4GB以上的文件,也可以将硬盘分区的硬盘文件系统格式确定为exFAT,以实现较佳的跨平台能力,例如,exFAT可同时适用于WIN和MAC。Optionally, after determining the partition size of the divided hard disk partition, other partition parameters of the hard disk partition can be determined according to the partition size. When the size is much smaller than 4GB (for example, 1GB), the hard disk file system format of the hard disk partition can be determined as FAT32. FAT32 has better compatibility and is convenient for fast reading and writing; while the hard disk file system format of other hard disk partitions can be determined as NTFS, It supports files of more than 4GB, and the storage and reading and writing are convenient and fast; in order to ensure that the hard disk partition can support files of more than 4GB, the hard disk file system format of the hard disk partition can also be determined as exFAT to achieve better cross-platform capability, for example, exFAT is available for both WIN and MAC.

在一具体实施例中,以Linux系统为例对硬盘的自动分区进行具体说明。Linux系统的硬盘分区中,根分区和交换分区是安装Linux系统的基本分区,其他分区均为可选分区。根分区是操作系统的内核及在引导过程中使用的文件所在的分区。交换分区用于在系统的物理内存不够用的时候,将硬盘内存中的一部分空间释放出来,以供当前运行的程序使用。当系统内存紧张时,操作系统根据一定的算法规则,将一部分最近没使用的内存页面保存到交换分区,从而为需要内存的程序留出足够的内存空间;在交换分区中的内存页面被访问时,系统会将其重新载入到物理内存中去运行。In a specific embodiment, the automatic partitioning of the hard disk is described in detail by taking the Linux system as an example. Among the hard disk partitions of the Linux system, the root partition and the swap partition are the basic partitions for installing the Linux system, and other partitions are optional partitions. The root partition is the partition where the operating system's kernel and files used during the boot process reside. The swap partition is used to release part of the space in the hard disk memory when the system's physical memory is insufficient for use by currently running programs. When the system memory is tight, the operating system saves some recently unused memory pages to the swap partition according to certain algorithm rules, thereby leaving enough memory space for programs that need memory; when the memory pages in the swap partition are accessed , the system will reload it into physical memory to run.

Linux系统分区时,除了将硬盘分区划分为根分区和交换分区外,还可以将其划分为启动分区(boot分区)、usr分区、home分区、var/log分区、tmp分区等可选分区。上述可选分区可以根据用户需要进行确定,启动分区包含了操作系统的内核和在启动操作系统过程中所要用到的文件,由于目前大多数的pc计算机要受到BIOS的限制,因此,为保证操作系统的顺利启动安装,可以单独设置boot分区,同时,也能够保证主要的根分区出现问题时,操作系统仍能顺利启动。usr分区用于存放应用软件,为保证各应用软件的顺利安装和运行,应尽可能为usr分区分配较多的空间。home分区是用户的home目录所在地,其大小取决于用户的多少,如果是多用户共同使用同一台服务器(例如远程交互),根用户(软件供应商等)可以利用home分区对普通用户使用计算机与服务器进行交互进行较好的控制,例如对用户实行硬盘限量使用,限制普通用户访问某些文件等。var/log分区是系统日志记录分区,如果设置了这一单独的分区,这样即使系统的日志文件出现了问题,也不会影响到操作系统的根分区。tmp分区用于存放临时文件,该分区对于多用户系统或网络服务器来说是必要的,这样即使程序运行时生成大量的临时文件,或者用户对系统进行了错误操作,由于文件系统执行错误操作的这一部分仍然还承受着读写操作,所以它通常会比其他部分更快地发生问题,如此,及时查找出问题,可以保证文件系统的其他部分仍然是安全的。When partitioning the Linux system, in addition to dividing the hard disk partition into the root partition and the swap partition, it can also be divided into optional partitions such as the boot partition (boot partition), usr partition, home partition, var/log partition, and tmp partition. The above optional partition can be determined according to user needs. The boot partition contains the kernel of the operating system and the files used in the process of starting the operating system. Since most PCs are limited by the BIOS at present, in order to ensure the operation The boot partition can be set up separately for the smooth startup and installation of the system, and at the same time, it can also ensure that the operating system can still be started smoothly when the main root partition has a problem. The usr partition is used to store application software. To ensure the smooth installation and operation of each application software, as much space as possible should be allocated to the usr partition. The home partition is the location of the user's home directory, and its size depends on the number of users. If multiple users share the same server (for example, remote interaction), the root user (software vendor, etc.) can use the home partition to use the computer and The server interacts with each other for better control, such as limiting the use of hard disks to users and restricting ordinary users to access certain files. The var/log partition is the system log recording partition. If this separate partition is set, even if there is a problem with the system log file, it will not affect the root partition of the operating system. The tmp partition is used to store temporary files. This partition is necessary for multi-user systems or network servers, so that even if a large number of temporary files are generated when the program is running, or the user performs wrong operations on the system, the file system performs wrong operations. This part is still subjected to read and write operations, so it usually has problems faster than other parts, so that if the problem is found in time, the other parts of the file system can still be guaranteed to be safe.

本实施例中,在确定镜像文件的类型的基础上,划分出根分区和交换分区后,可以根据用户需求和服务器的性能需求对硬盘分区进行自动化定制,例如是否需要设置上述的tmp分区、对根分区的分区大小进行调整等求。In this embodiment, on the basis of determining the type of the image file, after the root partition and the swap partition are divided, the hard disk partition can be automatically customized according to user requirements and performance requirements of the server, such as whether to set the above-mentioned tmp partition, The partition size of the root partition is adjusted and so on.

在一些实施例中,步骤S102中,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:In some embodiments, in step S102, partition configuration is performed on the hard disk of the server based on the image file, and a partition configuration file is generated, including:

基于所述镜像文件和所述硬盘的硬盘属性对所述硬盘进行分区配置,生成分区配置文件。The hard disk is partitioned based on the image file and the hard disk attributes of the hard disk, and a partition configuration file is generated.

其中,硬盘属性包括硬盘容量、硬盘的使用状态(是否为新硬盘)等属性。The hard disk attribute includes attributes such as the hard disk capacity and the use status of the hard disk (whether it is a new hard disk).

仍以Linux系统为例进行说明,如果硬盘空间足够大,可以划分更多的空间给根分区,如此,便可以将常用的目录(如下载的软件包)新建到桌面,而不影响进入Linux系统的速度。因此,本实施例中,在分区时可以根据硬盘容量配置各分区的分区大小,进一步实现硬盘分区的自动化定制。Taking the Linux system as an example, if the hard disk space is large enough, more space can be divided into the root partition, so that the commonly used directories (such as downloaded software packages) can be newly created on the desktop without affecting the entry into the Linux system. speed. Therefore, in this embodiment, the partition size of each partition can be configured according to the capacity of the hard disk when partitioning, so as to further realize the automatic customization of the hard disk partition.

在一些实施例中,根据硬盘是否为新硬盘对硬盘进行分区配置包括:当硬盘为新安装的硬盘时,对整个硬盘进行分区;而当硬盘为已存在分区的硬盘时,无需对全部已划分的硬盘分区进行调整,可以保留部分硬盘分区,仅对需要调整的硬盘分区进行调整,如此,可以提高硬盘分区效率。In some embodiments, the configuration of partitioning the hard disk according to whether the hard disk is a new hard disk includes: when the hard disk is a newly installed hard disk, partitioning the entire hard disk; and when the hard disk is a hard disk with existing partitions, it is not necessary to partition all the partitioned hard disks. To adjust the partition of the hard disk, you can keep some partitions of the hard disk, and only adjust the partition of the hard disk that needs to be adjusted. In this way, the partition efficiency of the hard disk can be improved.

S103:基于所述分区配置文件安装所述镜像文件。S103: Install the image file based on the partition configuration file.

步骤S103具体包括如下步骤:Step S103 specifically includes the following steps:

S1031:基于所述分区配置文件生成安装程序;S1031: Generate an installation program based on the partition configuration file;

S1032:通过所述安装程序引导所述镜像文件安装至预设的硬盘分区。S1032: Guide the installation of the image file to a preset hard disk partition through the installation program.

在根据镜像文件对服务器的硬盘进行定制化自动分区后,可以对分区配置文件和镜像文件进行分析、处理,根据分区配置文件和镜像文件生成安装程序,利用该安装程序对镜像文件进行安装,从而完成操作系统的安装。该安装程序为根据分区配置文件生成的定制化的操作系统的启动程序,用于引导操作系统的启动安装。After the hard disk of the server is customized and automatically partitioned according to the image file, the partition configuration file and the image file can be analyzed and processed, the installation program can be generated according to the partition configuration file and the image file, and the image file can be installed by using the installation program. Complete the installation of the operating system. The installation program is a customized operating system startup program generated according to the partition configuration file, and is used to guide the startup installation of the operating system.

在生成安装程序时,可以根据步骤S102中划分的硬盘分区,确定镜像文件的安装位置,例如,在镜像文件为Linux系统镜像文件、并划分出根分区时,可以确定镜像文件镜像的安装位置即为该根分区。当然,镜像文件的安装位置也可以为其他硬盘分区,例如,可以在生成的安装程序中添加安装位置选择页面,以便于用户选择对应的安装位置。When generating the installation program, the installation location of the image file can be determined according to the hard disk partition divided in step S102. For example, when the image file is a Linux system image file and the root partition is divided, the installation location of the image file image can be determined, namely for the root partition. Of course, the installation location of the image file may also be other hard disk partitions. For example, an installation location selection page may be added to the generated installation program to facilitate the user to select the corresponding installation location.

具体实施中,可以通过编写full_disk_policy.json脚本,生成分区配置文件,并将该脚本注入操作系统原有的安装程序中,实现硬盘的自动分区配置和操作系统的安装。即生成的安装程序可以在操作系统原有的安装程序的基础上生成,仅需要通过更改安装配置参数即可。生成的安装程序也可以为新的包含安装配置参数的安装程序,该新的安装程序中包含上述的full_disk_policy.json脚本。In specific implementation, the full_disk_policy.json script can be written to generate a partition configuration file, and the script can be injected into the original installation program of the operating system to realize automatic partition configuration of the hard disk and installation of the operating system. That is, the generated installation program can be generated on the basis of the original installation program of the operating system, and only needs to change the installation configuration parameters. The generated installer can also be a new installer that includes installation configuration parameters, and the new installer includes the full_disk_policy.json script described above.

在一些实施例中,对于根分区的分区大小,可以通过编写oem_settings.json文件,并将其封装到安装程序中的启动设置配置中,从而可以在硬盘分区后,对根分区的分区大小进行调整,合理分配根分区的分区大小。In some embodiments, for the partition size of the root partition, the oem_settings.json file can be written and packaged into the startup settings configuration in the installer, so that the partition size of the root partition can be determined after the hard disk is partitioned. Make adjustments to reasonably allocate the partition size of the root partition.

由于根分区为硬盘的关键分区,上述实施例中主要考虑根分区的分区大小的调整。具体实施中,可以编写不同的settings.json文件,对不同硬盘分区的分区大小进行调整。Since the root partition is a key partition of the hard disk, adjustment of the partition size of the root partition is mainly considered in the above embodiments. In specific implementation, different settings.json files can be written to adjust the partition size of different hard disk partitions.

本公开实施例提供的操作系统的安装方法,在获得待安装的操作系统的镜像文件后,根据该镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,进而根据该分区配置文件安装操作系统的镜像文件,可以根据实际需要对服务器的硬盘进行定制化自动分区,相较于将硬盘进行默认分区,例如确定分区数量后平均分配各分区的分区大小,便于根据需要调整分区大小,避免部分硬盘分区存在容量不足或浪费,可以有效提高服务器的性能;另外,分区过程中无需人工手动进行分区操作(仅需在分区前输入相关分区需求),可以提高操作系统安装效率。此外,本公开实施例提供的操作系统的安装方法可以适用于研发、测试、生产、现场售后服务等多种场景,能够全面提升企业效率,提高客户使用体验。In the operating system installation method provided by the embodiments of the present disclosure, after obtaining the image file of the operating system to be installed, partition configuration is performed on the hard disk of the server according to the image file, a partition configuration file is generated, and then the installation is performed according to the partition configuration file. The image file of the operating system can be customized and automatically partitioned on the hard disk of the server according to actual needs. Compared with the default partition of the hard disk, for example, after determining the number of partitions, the partition size of each partition is evenly distributed, which is convenient to adjust the partition size as needed, avoiding Some hard disk partitions have insufficient or wasteful capacity, which can effectively improve the performance of the server; in addition, manual partitioning operations are not required during the partitioning process (you only need to enter the relevant partition requirements before partitioning), which can improve the efficiency of operating system installation. In addition, the operating system installation method provided by the embodiment of the present disclosure can be applied to various scenarios such as research and development, testing, production, and on-site after-sales service, which can comprehensively improve enterprise efficiency and improve customer experience.

在一些实施例中,所述服务器为异构平台,包括多个处理器,步骤S102中,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:In some embodiments, the server is a heterogeneous platform and includes multiple processors. In step S102, partition configuration is performed on the hard disk of the server based on the image file, and a partition configuration file is generated, including:

基于所述镜像文件和多个所述处理器的架构对所述硬盘进行分区配置,生成分区配置文件。Perform partition configuration on the hard disk based on the image file and the architectures of the plurality of processors, and generate a partition configuration file.

异构平台可以为多CPU的异构平台,CPU可以包括ARM、X86和MIPS中的至少一种;异构平台也可以为CPU、FPGA和GPU中至少两种处理器组合构成的异构平台,例如由FPGA+CPU+GPU等不同处理器构成的异构平台。The heterogeneous platform can be a heterogeneous platform with multiple CPUs, and the CPU can include at least one of ARM, X86, and MIPS; the heterogeneous platform can also be a heterogeneous platform composed of a combination of at least two processors in the CPU, FPGA, and GPU. For example, a heterogeneous platform composed of different processors such as FPGA+CPU+GPU.

不同的处理器具有不同的架构,例如ARM架构与X86架构相比,ARM功耗低、移动市场占比高,X86性能高、服务器市场占比高。Different processors have different architectures. For example, compared with the X86 architecture, the ARM architecture has low power consumption and a high mobile market share, while X86 has high performance and a high server market share.

本实施例的操作系统的镜像文件可以同时运行在不同的CPU架构(例如上述的ARM和X86)的环境中。在进行分区配置时可以在不同的CPU架构环境下分别对镜像文件进行编译,进而生成不同CPU架构下的分区配置文件,然后对不同CPU架构下的各分区配置文件进行整合,得到最终的分区配置文件,进而实现操作系统在异构平台下的自动分区和安装,提高操作系统安装的普适性。The image file of the operating system in this embodiment can simultaneously run in environments of different CPU architectures (for example, the above-mentioned ARM and X86). When performing partition configuration, the image files can be compiled under different CPU architecture environments, and then the partition configuration files under different CPU architectures can be generated, and then the partition configuration files under different CPU architectures can be integrated to obtain the final partition configuration. file, and then realize the automatic partitioning and installation of the operating system under the heterogeneous platform, and improve the universality of the operating system installation.

需要说明的是,本实施例中,在基于所述镜像文件和多个所述处理器的架构对所述硬盘进行分区配置时,可以同时考虑硬盘属性,以实现硬盘的合理分区。It should be noted that, in this embodiment, when the hard disk is partitioned and configured based on the image file and the architecture of the plurality of processors, the hard disk attributes may be considered at the same time, so as to realize a reasonable partition of the hard disk.

在一些实施例中,如图2所示,所述操作系统至少包括第一操作系统和第二操作系统,所述方法还包括:In some embodiments, as shown in FIG. 2 , the operating system includes at least a first operating system and a second operating system, and the method further includes:

S201:基于所述第一操作系统的第一镜像文件对所述硬盘进行分区配置,生成第一分区配置文件;S201: Perform partition configuration on the hard disk based on a first image file of the first operating system to generate a first partition configuration file;

S202:基于所述第二操作系统的第二镜像文件对所述硬盘进行分区配置,生成第二分区配置文件;S202: Perform partition configuration on the hard disk based on the second image file of the second operating system to generate a second partition configuration file;

S203:对所述第一配置文件和所述第二配置文件进行整合,生成第三分区配置文件。S203: Integrate the first configuration file and the second configuration file to generate a third partition configuration file.

其中,第一操作系统和第二操作系统不同,例如,第一操作系统可以为Linux系统,第二操作系统可以为Windows系统,即服务器可以获得不同的操作系统,然后,分别基于对应的镜像文件生成对应的分区配置文件,之后对生成的不同的分区配置文件进行整合,生成第三分区配置文件,可以将不同操作系统下的多种硬盘分区格式进行自由组合,即整合后的第三分区配置文件可以满足不同操作系统的分区格式要求,保证后续不同操作系统的顺利安装。The first operating system and the second operating system are different, for example, the first operating system may be a Linux system, and the second operating system may be a Windows system, that is, the server can obtain different operating systems, and then, based on the corresponding image files, Generate the corresponding partition configuration file, and then integrate the generated different partition configuration files to generate the third partition configuration file, which can freely combine various hard disk partition formats under different operating systems, that is, the integrated third partition configuration The files can meet the partition format requirements of different operating systems to ensure the smooth installation of different operating systems in the future.

进一步地,所述方法还包括:Further, the method also includes:

S204:基于所述第三分区配置文件安装所述第一镜像文件和所述第二镜像文件。S204: Install the first image file and the second image file based on the third partition configuration file.

第一操作系统和第二操作系统均需要安装时,两个操作系统的安装顺序可以根据默认的安装顺序依次安装,也可以根据实际需要确定,本公开不具体限定。When both the first operating system and the second operating system need to be installed, the installation order of the two operating systems may be installed sequentially according to the default installation order, or may be determined according to actual needs, which is not specifically limited in the present disclosure.

安装程序,例如GRUB(GRand Unified Bootloader)启动程序,可以选择操作系统分区上的不同内核,并向这些内核传递启动参数,从而实现操作系统的启动安装。GRUB是一个来自GNU项目的多操作系统启动程序,可以对操作系统的安装进行引导。An installation program, such as a GRUB (GRand Unified Bootloader) startup program, can select different kernels on the operating system partition, and pass startup parameters to these kernels, thereby realizing the startup installation of the operating system. GRUB is a multi-operating system startup program from the GNU project that bootstraps the installation of an operating system.

另一些实施例中,需要对不同的操作系统进行安装时,可以在获取第一操作系统的第一镜像文件和第二操作系统的第二镜像文件后,基于第一镜像文件、第二镜像文件、硬盘属性以及处理器的架构等直接生成第三分区配置文件,即仅需生成最终的分区配置文件。In other embodiments, when different operating systems need to be installed, after obtaining the first image file of the first operating system and the second image file of the second operating system, based on the first image file and the second image file , properties of the hard disk, and the architecture of the processor, etc., directly generate the third partition configuration file, that is, only the final partition configuration file needs to be generated.

需要说明的是,操作系统除上述第一操作系统和第二操作系统外,还可以为其他操作系统。硬盘可以为单硬盘也可以为多硬盘。特别地,当硬盘为多硬盘、且操作系统为不同的操作系统时,可以将不同的操作系统安装在不同硬盘的根分区,以便于后续不同应用软件在不同操作系统中的顺利运行。It should be noted that, in addition to the above-mentioned first operating system and second operating system, the operating system may also be other operating systems. The hard disk can be a single hard disk or multiple hard disks. In particular, when the hard disk is multiple hard disks and the operating systems are different operating systems, different operating systems can be installed on the root partitions of different hard disks to facilitate subsequent smooth running of different application software in different operating systems.

在一些实施例中,如图3所示,步骤S103中,基于所述分区配置文件安装所述镜像文件,包括:In some embodiments, as shown in FIG. 3 , in step S103, installing the image file based on the partition configuration file includes:

S301:将所述操作系统的镜像文件制作成U盘启动盘;S301: Make the image file of the operating system into a U disk boot disk;

S302:根据所述分区配置文件,利用所述U盘启动盘安装所述镜像文件。S302: According to the partition configuration file, use the U disk boot disk to install the image file.

即本实施例可以将原生的镜像文件(例如ISO文件)制作成U盘启动盘,服务器根据镜像文件、硬盘属性和/或处理器的架构对硬盘部署定制化自动配置,生成分区配置文件后,可以利用U盘启动盘里的DiskGenius分区工具对硬盘进行自动化分区,进而安装操作系统。That is, in this embodiment, a native image file (for example, an ISO file) can be made into a U-disk boot disk, and the server deploys a customized and automatic configuration for the hard disk according to the image file, the hard disk attribute and/or the architecture of the processor, and after generating the partition configuration file, You can use the DiskGenius partition tool in the U disk boot disk to automatically partition the hard disk, and then install the operating system.

在另一些实施例中,如图4所示,步骤S103中,基于所述分区配置文件安装所述镜像文件,包括:In other embodiments, as shown in FIG. 4 , in step S103, installing the image file based on the partition configuration file includes:

S401:基于所述分区配置文件对所述镜像文件进行重新封装,得到封装后的第三镜像文件;S401: Re-encapsulate the image file based on the partition configuration file to obtain a third encapsulated image file;

S402:将所述第三镜像文件制作成启动盘并安装。S402: Make the third image file into a bootable disk and install it.

本实施例中,服务器根据镜像文件、硬盘属性和/或处理器的架构对硬盘部署定制化自动配置,生成分区配置文件后,可以将上述分区配置文件与镜像文件重新封装在一起,得到分区后的第三镜像文件,然后将该第三镜像文件制作成启动盘(例如刻录成光盘)并安装,从而实现操作系统的安装。In this embodiment, the server deploys a customized automatic configuration for the hard disk according to the image file, hard disk attributes and/or the architecture of the processor, and after generating the partition configuration file, the partition configuration file and the image file can be repackaged together to obtain the partition. Then, the third image file is made into a bootable disk (for example, burned into a CD) and installed, so as to realize the installation of the operating system.

在又一些实施例中,如图5所示,步骤S103中,基于所述分区配置文件安装所述镜像文件,包括:In still other embodiments, as shown in FIG. 5 , in step S103, installing the image file based on the partition configuration file includes:

S501:基于所述分区配置文件对所述镜像文件进行重新封装,得到第四镜像文件;S501: Repackage the image file based on the partition configuration file to obtain a fourth image file;

S502:响应于接收的预启动执行环境PXE启动指令,基于PXE网络启动安装所述第四镜像文件。S502: In response to the received pre-boot execution environment PXE boot instruction, boot and install the fourth image file based on the PXE network.

本实施例中,服务器根据镜像文件、硬盘属性和/或处理器的架构对硬盘部署定制化自动配置,生成分区配置文件后,将上述分区配置文件与镜像文件重新封装在一起,得到分区后的第四镜像文件,服务器根据接收的远程预启动执行环境PXE启动指令,进行PXE网络启动,通过PXE网络环境将定制化分区后的操作系统加载至服务器的内存中,启动所述操作系统,进而实现操作系统的安装。In this embodiment, the server deploys a customized automatic configuration for the hard disk according to the image file, hard disk properties and/or the architecture of the processor, and after generating the partition configuration file, repackages the partition configuration file and the image file together to obtain the partitioned configuration file. The fourth image file, the server performs PXE network startup according to the received remote pre-boot execution environment PXE startup instruction, loads the customized partitioned operating system into the memory of the server through the PXE network environment, starts the operating system, and then realizes Installation of the operating system.

由上可知,本实施例生成的操作系统的自动安装程序可以普适支持多种安装介质(U盘启动盘、光盘、网络介质等)中使用,提高操作系统安装的方便性。As can be seen from the above, the automatic installation program of the operating system generated in this embodiment can universally support the use of various installation media (U disk boot disk, optical disk, network medium, etc.), thereby improving the convenience of operating system installation.

在一些实施例中,在对所述服务器的硬盘进行分区配置之前,所述方法还包括:In some embodiments, before performing partition configuration on the hard disk of the server, the method further includes:

S601:裁剪去掉所述镜像文件中预设的备份分区。S601: Cut and remove a preset backup partition in the image file.

操作系统自带的系统还原功能需要操作系统可以正常启动才能工作,当用户有更优备份方案时,无法裁剪操作系统自带的backup备份分区,影响备份分区的配置。The system restore function that comes with the operating system can work only when the operating system can be started normally. When the user has a better backup solution, the backup partition that comes with the operating system cannot be trimmed, which affects the configuration of the backup partition.

本实施例中,可以通过设置安装程序的安装配置参数来裁剪去掉所述镜像文件中预设的备份分区,以便在用户有更优备份方案时,根据该备份方案对硬盘进行分区,配置新的备份分区。In this embodiment, the preset backup partition in the image file can be trimmed and removed by setting the installation configuration parameters of the installation program, so that when the user has a better backup solution, the hard disk can be partitioned according to the backup solution, and a new backup partition can be configured. Backup partition.

具体地,可以通过设置修改/etc/default/grub文件,设置grub参数来裁剪操作系统自带的backup备份分区。具体实施中,可以根据用户需求确定是否需要裁剪去掉操作系统自带的backup备份分区。Specifically, you can modify the /etc/default/grub file and set grub parameters to trim the backup partition that comes with the operating system. In specific implementation, it may be determined according to user requirements whether it is necessary to cut out the backup backup partition provided by the operating system.

进一步地,裁剪去掉所述镜像文件中预设的备份分区之后,所述方法还包括:Further, after trimming and removing the preset backup partition in the image file, the method further includes:

S701:判断所述镜像文件对应的安装程序中是否存在“系统备份还原”启动选项;S701: Determine whether the "system backup and restore" startup option exists in the installation program corresponding to the image file;

S702:若存在,裁剪去掉所述“系统备份还原”启动选项。S702: If it exists, trim and remove the "system backup and restore" startup option.

其中,所述镜像文件对应的安装程序为前次安装时基于分区配置文件生成的定制化自动分区的安装程序。当操作系统设置备份分区后,操作系统(或镜像文件)对应的安装程序(例如grub)的启动选择页面中通常直接添加有“系统备份还原”启动选项,当grub重新安装操作系统时该选项会再次出现,可能会对新的备份分区的配置造成影响。Wherein, the installation program corresponding to the image file is the customized automatic partition installation program generated based on the partition configuration file during the previous installation. After the operating system sets up the backup partition, the "system backup and restore" boot option is usually added directly to the boot selection page of the installer (such as grub) corresponding to the operating system (or image file). When grub reinstalls the operating system, this option will be added. If it occurs again, it may affect the configuration of the new backup partition.

本实施例中,通过判断基于所述分区配置文件生成的安装程序中是否存在“系统备份还原”启动选项,并在存在时将其裁剪去掉,可以在裁剪去掉所述镜像文件中预设的备份分区后,同步将“系统备份还原”启动选项裁剪去掉,保证用户有更优备份方案时基于该备份方案配置新的备份分区,避免原有“系统备份还原”启动选项对硬盘的自动分区造成影响。In this embodiment, by judging whether there is a "system backup restore" startup option in the installer generated based on the partition configuration file, and trimming it out if it exists, the preset backup in the image file can be trimmed and removed. After partitioning, the "system backup and restore" startup option will be trimmed and removed simultaneously to ensure that the user has a better backup plan to configure a new backup partition based on the backup plan, to avoid the original "system backup and restore" startup option affecting the automatic partition of the hard disk. .

可以理解的是,由于上述定制化自动分区的安装程序可以在操作系统原有的安装程序的基础上生成,例如,对系统原有的grub进行配置生成新的grub。因此,步骤S701和步骤S702,可以通过添加grub宏选项GRUB_DISABLE_RECOVERY=y,对操作系统的grub脚本/etc/grub.d/15_linux_bar进行优化,对GRUB_DISABLE_RECOVERY参数进行检查判断,检查grub的系统启动菜单中是否存在“系统备份还原”启动选项,若存在(GRUB_DISABLE_RECOVERY=y),裁剪去掉所述“系统备份还原”启动选项,以便用户可以基于新配置的备份分区实现系统备份还原功能;若不存在(GRUB_DISABLE_RECOVERY=n),则无需裁剪。It can be understood that, since the above-mentioned customized automatic partition installation program can be generated on the basis of the original installation program of the operating system, for example, the original grub of the system is configured to generate a new grub. Therefore, in steps S701 and S702, the grub script /etc/grub.d/15_linux_bar of the operating system can be optimized by adding the grub macro option GRUB_DISABLE_RECOVERY=y, and the GRUB_DISABLE_RECOVERY parameter can be checked and judged to check whether the grub system boot menu is in the system boot menu. There is a "system backup and restore" startup option, if it exists (GRUB_DISABLE_RECOVERY=y), cut and remove the "system backup and restore" startup option, so that the user can realize the system backup and restore function based on the newly configured backup partition; if it does not exist (GRUB_DISABLE_RECOVERY= n), no cropping is required.

特别地,在检测到安装程序中存在“系统备份还原”启动选项时,也可以根据用户需要保留该“系统备份还原”启动选项,并封装到基于新配置的备份分区生成的新的自动分区的安装程序中,以便于操作系统安装出现问题时系统的备份还原;或者,在配置好新的备份分区后,在新的自动分区的安装程序中重新配置“系统备份还原”启动选项。In particular, when it is detected that the "system backup and restore" startup option exists in the installer, the "system backup and restore" startup option can also be retained according to the user's needs, and packaged into the new automatic partition generated based on the newly configured backup partition. In the installation program, it is convenient to backup and restore the system when there is a problem with the installation of the operating system; or, after configuring the new backup partition, reconfigure the “system backup and restore” startup option in the installation program of the new automatic partition.

本实施例中,通过步骤S701和S702,可以根据用户的实际需要,选择是否保留“系统备份还原”启动选项,提高操作系统安装的可靠性。In this embodiment, through steps S701 and S702, it is possible to select whether to keep the "system backup and restore" startup option according to the actual needs of the user, so as to improve the reliability of the installation of the operating system.

图6示出了本公开实施例的操作系统的安装装置的结构示意图。如图6所示,本公开实施例还提供了一种操作系统的安装装置,包括:FIG. 6 shows a schematic structural diagram of an installation device for an operating system according to an embodiment of the present disclosure. As shown in FIG. 6 , an embodiment of the present disclosure further provides an installation device for an operating system, including:

获得模块10,配置为获得待安装的操作系统的镜像文件;Obtaining module 10, configured to obtain the image file of the operating system to be installed;

分区配置模块20,配置为基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件;The partition configuration module 20 is configured to perform partition configuration on the hard disk of the server based on the image file, and generate a partition configuration file;

安装模块30,配置为基于所述分区配置文件安装所述镜像文件。The installation module 30 is configured to install the image file based on the partition configuration file.

在一些实施例中,分区配置模块20进一步配置为:基于所述镜像文件和所述硬盘的硬盘属性对所述硬盘进行分区配置,生成分区配置文件。In some embodiments, the partition configuration module 20 is further configured to: perform partition configuration on the hard disk based on the image file and hard disk attributes of the hard disk, and generate a partition configuration file.

在一些实施例中,所述服务器为异构平台,包括多个处理器,分区配置模块20进一步配置为:In some embodiments, the server is a heterogeneous platform including multiple processors, and the partition configuration module 20 is further configured to:

基于所述镜像文件和多个所述处理器的架构对所述硬盘进行分区配置,生成分区配置文件。Perform partition configuration on the hard disk based on the image file and the architectures of the plurality of processors, and generate a partition configuration file.

在一些实施例中,所述操作系统至少包括第一操作系统和第二操作系统,分区配置模块20进一步配置为:In some embodiments, the operating system includes at least a first operating system and a second operating system, and the partition configuration module 20 is further configured to:

基于所述第一操作系统的第一镜像文件对所述硬盘进行分区配置,生成第一分区配置文件;Perform partition configuration on the hard disk based on the first image file of the first operating system to generate a first partition configuration file;

基于所述第二操作系统的第二镜像文件对所述硬盘进行分区配置,生成第二分区配置文件;Perform partition configuration on the hard disk based on the second image file of the second operating system to generate a second partition configuration file;

对所述第一配置文件和所述第二配置文件进行整合,生成第三分区配置文件。The first configuration file and the second configuration file are integrated to generate a third partition configuration file.

在一些实施例中,安装模块30进一步配置为:In some embodiments, the installation module 30 is further configured to:

将所述操作系统的镜像文件制作成U盘启动盘;Making the image file of the operating system into a U disk boot disk;

根据所述分区配置文件,利用所述U盘启动盘安装所述镜像文件。According to the partition configuration file, the image file is installed by using the U disk boot disk.

在一些实施例中,安装模块30进一步配置为:In some embodiments, the installation module 30 is further configured to:

基于所述分区配置文件对所述镜像文件进行重新封装,得到封装后的第三镜像文件;Re-encapsulate the image file based on the partition configuration file to obtain the encapsulated third image file;

将所述第三镜像文件制作成启动盘并安装。The third image file is made into a bootable disk and installed.

在一些实施例中,安装模块30进一步配置为:In some embodiments, the installation module 30 is further configured to:

基于所述分区配置文件对所述镜像文件进行重新封装,得到第四镜像文件;Repackage the image file based on the partition configuration file to obtain a fourth image file;

响应于接收的预启动执行环境PXE启动指令,基于PXE网络启动安装所述第四镜像文件。In response to the received pre-boot execution environment PXE boot instruction, the fourth image file is booted and installed based on the PXE network.

在一些实施例中,操作系统的安装装置还包括第一裁剪模块,配置为:In some embodiments, the installation device for the operating system further includes a first trimming module configured to:

在对所述服务器的硬盘进行分区配置之前,裁剪去掉所述镜像文件中预设的备份分区。Before performing partition configuration on the hard disk of the server, trim and remove the preset backup partition in the image file.

在一些实施例中,操作系统的安装装置还包括:In some embodiments, the device for installing the operating system further includes:

判断模块,配置为在裁剪去掉所述镜像文件中预设的备份分区之后,判断所述镜像文件对应的安装程序中是否存在“系统备份还原”启动选项;The judgment module is configured to judge whether there is a "system backup and restore" startup option in the installation program corresponding to the image file after cutting and removing the preset backup partition in the image file;

第二裁剪模块,配置为在安装程序中存在“系统备份还原”启动选项时,裁剪去掉所述“系统备份还原”启动选项。The second trimming module is configured to trim and remove the "system backup and restore" startup option when the "system backup and restore" startup option exists in the installation program.

本公开实施例提供的操作系统的安装装置与上述实施例中的操作系统的安装方法相对应,基于上述的操作系统的安装方法,本领域的技术人员能够了解本公开实施例中操作系统的安装装置具体实施方式以及其各种变化形式,操作系统的安装方法实施例中的任何可选项也适用于操作系统的安装装置,在此不再赘述。The apparatus for installing an operating system provided by the embodiment of the present disclosure corresponds to the method for installing an operating system in the above-mentioned embodiment. Based on the above-mentioned method for installing an operating system, those skilled in the art can understand the installation of an operating system in the embodiment of the present disclosure. The specific implementation manner of the device and its various variations, any optional options in the embodiments of the operating system installation method are also applicable to the operating system installation device, and are not repeated here.

本公开实施例还提供了一种服务器,包括存储器和至少一个处理器,存储器用于存储至少一条计算机程序指令,至少一个处理器用于通过加载并执行所述至少一条计算机程序指令以实现如上实施例所述的操作系统的安装方法。An embodiment of the present disclosure further provides a server, including a memory and at least one processor, where the memory is used for storing at least one computer program instruction, and the at least one processor is used for implementing the above embodiment by loading and executing the at least one computer program instruction The installation method of the operating system.

其中,存储器可用于存储软件程序以及模块,如本公开实施例中的操作系统的安装方法对应的程序指令/模块。至少一个处理器可以为上述的多GPU的架构,或CPU、FPGA、和GPU中至少两种组合的架构。处理器通过运行存储在存储器内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的操作系统的安装方法。The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the operating system installation method in the embodiment of the present disclosure. At least one processor may be the above-mentioned multi-GPU architecture, or an architecture combining at least two of CPU, FPGA, and GPU. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, the above-mentioned installation method of the operating system is implemented.

本公开实施例还提供一种计算机存储介质,所述计算机存储介质上存储有计算机程序指令;所述计算机程序指令被处理器执行时实现如上实施例所述的操作系统的安装方法。Embodiments of the present disclosure further provide a computer storage medium, where computer program instructions are stored thereon; when the computer program instructions are executed by a processor, the method for installing an operating system described in the above embodiments is implemented.

需要说明的是,本公开实施例实现上述方法实施例的全部或部分步骤可以通过计算机可执行指令(程序)相关的硬件来完成,上述的计算机可执行指令可以存储于计算机可读取存储介质中,该计算机可执行指令在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:只读存储器(Read Only Memory,ROM)、随机存取存储器(random accessmemory,RAM)、移动存储设备、磁碟或者光盘等各种可以存储计算机可执行指令的介质。特别地,本实施例中,计算机存储介质可以为上述待分区或分区后的硬盘。It should be noted that, all or part of the steps of implementing the above method embodiments in the embodiments of the present disclosure may be completed by hardware related to computer-executable instructions (programs), and the above-mentioned computer-executable instructions may be stored in a computer-readable storage medium , when the computer-executable instruction is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: read-only memory (Read Only Memory, ROM), random access memory (random access memory, RAM), removable storage Various media that can store computer-executable instructions, such as devices, disks, or optical disks. In particular, in this embodiment, the computer storage medium may be the above-mentioned hard disk to be partitioned or partitioned.

以上实施例仅为本公开的示例性实施例,不用于限制本公开,本公开的保护范围由权利要求书限定。本领域技术人员可以在本公开的实质和保护范围内,对本公开做出各种修改或等同替换,这种修改或等同替换也应视为落在本公开的保护范围内。The above embodiments are only exemplary embodiments of the present disclosure, and are not intended to limit the present disclosure, and the protection scope of the present disclosure is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements to the present disclosure within the spirit and protection scope of the present disclosure, and such modifications or equivalent replacements should also be regarded as falling within the protection scope of the present disclosure.

Claims (10)

1.一种操作系统的安装方法,应用于服务器,所述方法包括:1. A method for installing an operating system, applied to a server, the method comprising: 获得待安装的操作系统的镜像文件;Obtain the image file of the operating system to be installed; 基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件;Perform partition configuration on the hard disk of the server based on the image file, and generate a partition configuration file; 基于所述分区配置文件安装所述镜像文件。The image file is installed based on the partition configuration file. 2.根据权利要求1所述的方法,其中,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:2. The method according to claim 1, wherein performing partition configuration on the hard disk of the server based on the image file, and generating a partition configuration file, comprising: 基于所述镜像文件和所述硬盘的硬盘属性对所述硬盘进行分区配置,生成分区配置文件。The hard disk is partitioned based on the image file and the hard disk attributes of the hard disk, and a partition configuration file is generated. 3.根据权利要求1所述的方法,其中,所述服务器为异构平台,包括多个处理器,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:3. The method according to claim 1, wherein the server is a heterogeneous platform, comprising a plurality of processors, performing partition configuration on the hard disk of the server based on the image file, and generating a partition configuration file, comprising: 基于所述镜像文件和多个所述处理器的架构对所述硬盘进行分区配置,生成分区配置文件。Perform partition configuration on the hard disk based on the image file and the architectures of the plurality of processors, and generate a partition configuration file. 4.根据权利要求1所述的方法,其中,所述操作系统至少包括第一操作系统和第二操作系统,基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件,包括:4. The method according to claim 1, wherein the operating system includes at least a first operating system and a second operating system, and a partition configuration is performed on the hard disk of the server based on the image file, and a partition configuration file is generated, comprising: : 基于所述第一操作系统的第一镜像文件对所述硬盘进行分区配置,生成第一分区配置文件;Perform partition configuration on the hard disk based on the first image file of the first operating system to generate a first partition configuration file; 基于所述第二操作系统的第二镜像文件对所述硬盘进行分区配置,生成第二分区配置文件;Perform partition configuration on the hard disk based on the second image file of the second operating system to generate a second partition configuration file; 对所述第一配置文件和所述第二配置文件进行整合,生成第三分区配置文件。The first configuration file and the second configuration file are integrated to generate a third partition configuration file. 5.根据权利要求1所述的方法,其中,基于所述分区配置文件安装所述镜像文件,包括:5. The method of claim 1, wherein installing the image file based on the partition configuration file comprises: 将所述操作系统的镜像文件制作成U盘启动盘;Making the image file of the operating system into a U disk boot disk; 根据所述分区配置文件,利用所述U盘启动盘安装所述镜像文件。According to the partition configuration file, the image file is installed by using the U disk boot disk. 6.根据权利要求1所述的方法,其中,基于所述分区配置文件安装所述镜像文件,包括:6. The method of claim 1, wherein installing the image file based on the partition configuration file comprises: 基于所述分区配置文件对所述镜像文件进行重新封装,得到封装后的第三镜像文件;Re-encapsulate the image file based on the partition configuration file to obtain the encapsulated third image file; 将所述第三镜像文件制作成启动盘并安装。The third image file is made into a bootable disk and installed. 7.根据权利要求1所述的方法,其中,基于所述分区配置文件安装所述镜像文件,包括:7. The method of claim 1, wherein installing the image file based on the partition configuration file comprises: 基于所述分区配置文件对所述镜像文件进行重新封装,得到第四镜像文件;Repackage the image file based on the partition configuration file to obtain a fourth image file; 响应于接收的预启动执行环境PXE启动指令,基于PXE网络启动安装所述第四镜像文件。In response to the received pre-boot execution environment PXE boot instruction, the fourth image file is booted and installed based on the PXE network. 8.根据权利要求1所述的方法,其中,在对所述服务器的硬盘进行分区配置之前,所述方法还包括:8. The method according to claim 1, wherein before performing partition configuration on the hard disk of the server, the method further comprises: 裁剪去掉所述镜像文件中预设的备份分区。Cut out the preset backup partition in the image file. 9.根据权利要求8所述的方法,其中,裁剪去掉所述镜像文件中预设的备份分区之后,所述方法还包括:9. The method according to claim 8, wherein after cutting out the preset backup partition in the image file, the method further comprises: 判断所述镜像文件对应的安装程序中是否存在“系统备份还原”启动选项;Determine whether the "system backup and restore" startup option exists in the installation program corresponding to the image file; 若存在,裁剪去掉所述“系统备份还原”启动选项。If it exists, trim and remove the "system backup and restore" startup option. 10.一种操作系统的安装装置,包括:10. An installation device for an operating system, comprising: 获得模块,配置为获得待安装的操作系统的镜像文件;Obtaining a module, configured to obtain an image file of the operating system to be installed; 分区配置模块,配置为基于所述镜像文件对所述服务器的硬盘进行分区配置,生成分区配置文件;A partition configuration module, configured to perform partition configuration on the hard disk of the server based on the image file, and generate a partition configuration file; 安装模块,配置为基于所述分区配置文件安装所述镜像文件。An installation module, configured to install the image file based on the partition configuration file.
CN202210199995.3A 2022-03-02 2022-03-02 Installation method and device of operating system Pending CN114579148A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210199995.3A CN114579148A (en) 2022-03-02 2022-03-02 Installation method and device of operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210199995.3A CN114579148A (en) 2022-03-02 2022-03-02 Installation method and device of operating system

Publications (1)

Publication Number Publication Date
CN114579148A true CN114579148A (en) 2022-06-03

Family

ID=81777110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210199995.3A Pending CN114579148A (en) 2022-03-02 2022-03-02 Installation method and device of operating system

Country Status (1)

Country Link
CN (1) CN114579148A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116301940A (en) * 2023-03-10 2023-06-23 天翼云科技有限公司 System installation method supporting flexible partition layout
CN116841575A (en) * 2023-09-01 2023-10-03 荣耀终端有限公司 Methods and related devices for generating image files
CN117289956A (en) * 2023-10-12 2023-12-26 北京首都在线科技股份有限公司 Mirror image manufacturing method, apparatus, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902554A (en) * 2012-09-04 2013-01-30 中标软件有限公司 LINUX operation system mounting method of Loongson platform
WO2018054351A1 (en) * 2016-09-23 2018-03-29 紫光华山信息技术有限公司 Installation of operating system
CN108647034A (en) * 2018-04-09 2018-10-12 南京百敖软件有限公司 A kind of method that list mobile hard disk installs multiple operating systems
CN112558993A (en) * 2020-12-22 2021-03-26 江苏国科微电子有限公司 Operating system installation method, device, equipment and medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902554A (en) * 2012-09-04 2013-01-30 中标软件有限公司 LINUX operation system mounting method of Loongson platform
WO2018054351A1 (en) * 2016-09-23 2018-03-29 紫光华山信息技术有限公司 Installation of operating system
CN108647034A (en) * 2018-04-09 2018-10-12 南京百敖软件有限公司 A kind of method that list mobile hard disk installs multiple operating systems
CN112558993A (en) * 2020-12-22 2021-03-26 江苏国科微电子有限公司 Operating system installation method, device, equipment and medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116301940A (en) * 2023-03-10 2023-06-23 天翼云科技有限公司 System installation method supporting flexible partition layout
CN116301940B (en) * 2023-03-10 2025-09-30 天翼云科技有限公司 A system installation method supporting flexible partition layout
CN116841575A (en) * 2023-09-01 2023-10-03 荣耀终端有限公司 Methods and related devices for generating image files
CN116841575B (en) * 2023-09-01 2023-11-24 荣耀终端有限公司 Method and related device for generating image file
CN117289956A (en) * 2023-10-12 2023-12-26 北京首都在线科技股份有限公司 Mirror image manufacturing method, apparatus, electronic device and storage medium
CN117289956B (en) * 2023-10-12 2024-06-11 北京首都在线科技股份有限公司 Mirror image manufacturing method, apparatus, electronic device and storage medium

Similar Documents

Publication Publication Date Title
EP3518099B1 (en) Installation of operating system
CN114579148A (en) Installation method and device of operating system
US7689802B2 (en) Controlling memory access in a multi-booting system
US8112392B1 (en) Methods and systems for creating snapshots of virtualized applications
US6993649B2 (en) Method of altering a computer operating system to boot and run from protected media
US7694123B2 (en) Storing files for operating system restoration
US9804855B1 (en) Modification of temporary file system for booting on target hardware
US8176482B1 (en) Methods and systems for inserting software applications into images
CN102402446A (en) Application software installation method and application software installation device
CN104750492B (en) The start-up control method and device of mobile device based on embedded OS
CN102955706B (en) A kind of installation method of dual operating systems and guiding loading method
CN101957769A (en) MID (Mobile Internet Device) multiple operating system parallelizing method
CN115390996B (en) Virtual machine migration method and device, computing equipment and storage medium
US11307907B2 (en) Information handling system and method to automatically synchronize operating system and boot firmware languages
CN116483468B (en) Operating system installation method and device, computer equipment and storage medium
CN111694585A (en) Method, system, terminal and storage medium for replacing system partition file
CN104866324A (en) Method for constructing portable operating system and portable memorizer
US9672047B1 (en) Systems and methods for accessing a bootable partition on a serial peripheral interface device
CN116009899B (en) Mirror image making method and device of operating system, electronic equipment and storage medium
US20100005286A1 (en) Method for booting computer system
CN114756290B (en) Operating system installation method, device and readable storage medium
US7849300B2 (en) Method for changing booting sources of a computer system and a related backup/restore method thereof
US9158550B2 (en) Caching based operating system installation
TWI754221B (en) Disabling software persistence
US20250245015A1 (en) Processor Environment Architecture Agnostic Unified BIOS Memory Mapping Operation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination