File system creation method and device

By generating configuration files, the virtual machine file system is automatically created, and the problem of virtual machine file system creation in the existing technology is solved. It realizes efficient automated batch creation and resource utilization, and improves the efficiency of virtual machine resource supply on cloud platform.

CN112800014BActive Publication Date: 2024-12-06INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110125589.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2024-12-06
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

In the prior art, virtual machine file system creation relies on manual operations and has low degree of automation, resulting in inefficient supply processes in large-scale virtual machine demand scenarios and low cloud hard disk resource utilization rate.

Method used

By generating configuration files, including file system type, size and mount point information, it automatically creates physical volumes, volume groups and logical volumes, realizes automatic batch creation of virtual machine file systems, and supports file system expansion and optimizes cloud hard disk resource utilization.

Benefits of technology

It realizes the automated batch creation of virtual machine file systems, improves the efficiency of virtual machine resource supply on cloud platform, reduces manual operation requirements, and improves cloud hard disk resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112800014B_ABST
    Figure CN112800014B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for creating a file system, the method comprising: generating a configuration file according to the storage capacity and drive letter mount point of a cloud hard disk, the configuration file comprising a plurality of parameter information for creating a virtual machine file system, wherein the parameter information at least comprises: file system type information, file system size information and new mount drive letter path information; obtaining the device name of the cloud hard disk according to the new mount drive letter path information, and creating a physical volume based on the device name of the cloud hard disk; creating a volume group according to the physical volume; creating a logical volume according to the volume group; creating a virtual machine file system according to the logical volume and file system type information; generating mount point information of the virtual machine file system, the mount point information being used to access the virtual machine file system. The present invention does not require manual operation by staff in the process of creating a virtual machine file system, and can realize automatic batch creation of virtual machine file systems, with a high degree of automation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for creating a file system. Background Art

[0002] With the rapid development of cloud computing technology, a large number of modern enterprise applications are gradually transforming from the traditional physical machine deployment mode to a more lightweight, resource elastic and controllable cloud deployment mode. However, with the rapid growth of cloud applications in recent years, facing massive business demands, how to achieve efficient provisioning of virtual machines is becoming a common challenge for major cloud platforms. Among them, the creation and expansion of virtual file systems based on the logical volume management mechanism (LOGICAL VOLUME MANAGER, referred to as LVM) is a key factor affecting the overall provisioning efficiency of virtual machines.

[0003] In the prior art, the mainstream practice of most cloud platforms for creating virtual file systems is to separate this link from the virtual machine issuance process in the implementation process, first issue the virtual machine and mount the cloud hard disk through the cloud management platform, and then manually log in to the target virtual machine in batches to execute the steps of physical volume (PHYSICAL VOLUME, abbreviated as PV), volume group (VOLUMEGROUP, abbreviated as VG), logical volume (LOGIC VOLUME, abbreviated as LV), create and mount the file system, etc.

[0004] This mainstream approach of the existing technology has significant drawbacks: file system creation relies on manual batch execution by staff. For multiple file system creation scenarios, a single virtual machine needs to repeat the manual file system creation process multiple times. For large-scale virtual machine demand scenarios, the degree of automation in the supply process is not high. Summary of the invention

[0005] The embodiment of the present invention provides a method for creating a file system. The entire process does not require manual operation by a staff member, and can realize automatic batch creation of a virtual machine file system with a high degree of automation. The method includes:

[0006] Generate a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, wherein the configuration file includes a plurality of parameter information for creating a virtual machine file system, wherein the parameter information includes at least: file system type information, file system size information and new mount drive letter path information;

[0007] Acquire the device name of the cloud hard disk according to the newly mounted drive letter path information, and create a physical volume based on the device name of the cloud hard disk;

[0008] Creating a volume group according to the physical volume;

[0009] Creating a logical volume according to the volume group;

[0010] Creating a virtual machine file system according to the logical volume and the file system type information;

[0011] Generate mount point information of the virtual machine file system, where the mount point information is used to access the virtual machine file system.

[0012] The embodiment of the present invention further provides a file system creation device, which can realize automatic batch creation of virtual machine file systems without manual operation by staff during the whole process, and has a high degree of automation. The device includes:

[0013] A configuration file generation module, used to generate a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, wherein the configuration file includes a plurality of parameter information for creating a virtual machine file system, wherein the parameter information includes at least: file system type information, file system size information and new mount drive letter path information;

[0014] A physical volume creation module, used to obtain the device name of the cloud hard disk according to the newly mounted drive letter path information, and create a physical volume based on the device name of the cloud hard disk;

[0015] A volume group creation module, used for creating a volume group according to the physical volume;

[0016] A logical volume creation module, used for creating a logical volume according to the volume group;

[0017] A virtual machine file system creation module, used to create a virtual machine file system according to the logical volume and the file system type information;

[0018] The mount point information generating module is used to generate the mount point information of the virtual machine file system, and the mount point information is used to access the virtual machine file system.

[0019] An embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the computer program.

[0020] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.

[0021] In the embodiment of the present invention, a configuration file is generated according to the storage capacity and drive letter mount point of the cloud hard disk, and the device name of the cloud hard disk is obtained according to the new mount drive letter path information, a physical volume is created based on the device name of the cloud hard disk, and then a volume group is created according to the physical volume, a logical volume is created according to the volume group, a virtual machine file system is created according to the logical volume and the file system type information, and the mount point information of the virtual machine file system is generated, so that the creation of the virtual machine file system can be completed. The entire process does not require manual operation by the staff, and the automatic batch creation of the virtual machine file system can be realized, and the degree of automation is high. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0023] Figure 1 A flowchart of a method for creating a file system in an embodiment of the present invention;

[0024] Figure 2 A schematic diagram of the structure of a file system creation device according to an embodiment of the present invention;

[0025] Figure 3 A specific example diagram of a method for creating a file system in an embodiment of the present invention;

[0026] Figure 4 A specific example diagram of file system expansion in an embodiment of the present invention;

[0027] Figure 5 It is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0029] Figure 1 A flowchart of a method for creating a file system provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:

[0030] Step 101: Generate a configuration file based on the storage capacity and drive mount point of the cloud hard disk, wherein the configuration file includes multiple parameter information for creating a virtual machine file system, wherein the parameter information includes at least: file system type information, file system size information and new mount drive path information.

[0031] In an embodiment, the parameter information also includes: file system mount point name information, file system owner information, file system group information and file system permission information.

[0032] The configuration file can be a script file, and the parameter information is the input parameter of the script file.

[0033] Step 102: Obtain the device name of the cloud hard disk according to the newly mounted drive letter path information, and create a physical volume based on the device name of the cloud hard disk.

[0034] In a specific implementation, the device name of the cloud hard disk is obtained according to the newly mounted drive letter path information, and a physical volume is created based on the device name of the cloud hard disk in combination with a logical volume management mechanism (LOGICAL VOLUME MANAGER, LVM) command.

[0035] Step 103: Create a volume group according to the physical volume.

[0036] In an embodiment, the volume group is created based on LVM commands.

[0037] Step 104: Create a logical volume according to the volume group.

[0038] Step 105: Create a virtual machine file system according to the logical volume and the file system type information.

[0039] Step 106: Generate mount point information of the virtual machine file system, where the mount point information is used to access the virtual machine file system.

[0040] As can be seen from the above, the file system creation method provided in the embodiment of the present invention generates a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, obtains the device name of the cloud hard disk according to the new mount drive letter path information, creates a physical volume based on the device name of the cloud hard disk, creates a volume group according to the physical volume, creates a logical volume according to the volume group, creates a virtual machine file system according to the logical volume and the file system type information, and generates the mount point information of the virtual machine file system, so as to complete the creation of the virtual machine file system. The entire process does not require manual operation by the staff, and can realize automatic batch creation of virtual machine file systems with a high degree of automation.

[0041] In an embodiment of the present invention, in order to realize the creation of a single-disk multi-virtual machine file system, after generating a configuration file according to the storage capacity of the cloud hard disk and the drive letter mount point, the method further includes:

[0042] Determine whether the parameter information in the configuration file is in the form of a list;

[0043] If so, the list length of each parameter information in the configuration file is checked, and when the check result is normal, the compatibility of the file system type information with the virtual machine image operating system is checked.

[0044] In specific implementation, all parameter information in the configuration file supports the creation of a single-disk multi-virtual machine file system in the form of a list. When creating a multi-virtual machine file system, the lists of each parameter information can be separated by spaces.

[0045] When the result of judging whether the parameter information in the configuration file is in the form of a list is "yes", the list length of each parameter information in the configuration file is checked, that is, whether the list length of each parameter information is consistent. If the check result is abnormal, the creation of the virtual machine file system is terminated. If the check result is normal, the compatibility of the file system type information with the virtual machine image operating system is checked (since the file system type information may have multiple forms, such as ext2, ext3, ext4, etc., it is necessary to judge whether the input parameter type is compatible with the virtual machine image operating system). If the compatibility of the file system type information with the virtual machine image operating system meets the preset compatibility rules, the subsequent virtual machine file system creation work is continued, otherwise, the exception is captured and the virtual machine file system creation process is terminated.

[0046] When the result of determining whether the parameter information in the configuration file is in the form of a list is "no", an exception message is thrown and the virtual machine file system creation process is terminated.

[0047] Furthermore, in order to ensure the smooth creation of the virtual machine file system, after verifying the compatibility of the file system type information with the virtual machine image operating system, the method further includes:

[0048] Check whether the file system mount point name information is the same as the mount point name already created in the virtual machine image root directory.

[0049] In specific implementation, it is determined whether the file system mount point name information is repeated with the mount point name already created in the root directory of the virtual machine image. If repeated, the virtual machine file system creation process is terminated; if not repeated, the subsequent virtual machine file system creation process is continued.

[0050] Furthermore, after verifying the compatibility of the file system type information with the virtual machine image operating system, the method further includes:

[0051] Determine whether the index of the parameter information list in the configuration file is zero;

[0052] If so, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk;

[0053] Otherwise, a logical volume is created based on the volume group.

[0054] When creating a single-disk multi-virtual machine file system, if the index of the parameter information list in the configuration file is zero, that is, the first virtual machine file system is created, the device name of the cloud hard disk is obtained according to the newly mounted drive letter path information, and a physical volume is created based on the device name of the cloud hard disk.

[0055] If the index of the parameter information list in the configuration file is not zero, for example, when it is one, two, or three, then the logical volume can be directly created according to the volume group.

[0056] In the embodiment of the present invention, in order to ensure the smooth creation of a single-disk multi-virtual machine file system, the parameter information also includes: file system mount point name information;

[0057] Creating a logical volume according to the volume group includes:

[0058] Corresponding logical volumes are created respectively according to the different volume groups, the file system mount point name information and the file system size information in the list.

[0059] In specific implementation, for example, the first logical volume can be created according to the first volume group, the first file system mount point name information and the first file system size information in the list; the second logical volume can be created according to the second volume group, the second file system mount point name information and the second file system size information, and so on; the third logical volume can be created according to the third volume group, the third file system mount point name information and the third file system size information, and so on. How the logical volumes are created specifically is determined by the volume group, the file system mount point name information and the file system size information.

[0060] In the embodiment of the present invention, in order to facilitate the user to operate the virtual machine file system, the parameter information also includes: file system owner information, file system group information, and file system permission information;

[0061] After generating the mount point information of the virtual machine file system, the method further includes:

[0062] Configuring a user for the generated virtual machine file system according to the file system owner information;

[0063] According to the file system group information, the generated virtual machine file system is configured with a user group;

[0064] The generated virtual machine file system is configured with operation permissions according to the file system permission information.

[0065] Since the allocated cloud storage resources are not fully utilized after the virtual machine file system is created in the prior art, resulting in a waste of cloud hard disk resources, in this regard, after the virtual machine file system is created according to the logical volume and the file system type information, the method further includes:

[0066] Receive expansion parameter information, the expansion parameter information including: file system mount point name information, file system expansion size information and new mount drive path information;

[0067] The virtual machine file system is expanded according to the expansion parameter information.

[0068] In an embodiment, expanding the capacity of the virtual machine file system according to the expansion parameter information includes:

[0069] Determine whether the new mounted drive path information is empty;

[0070] If it is empty, determine whether the logical volume in the file system mount point name information meets the preset expansion rules, and expand the virtual machine file system if the preset expansion rules are met;

[0071] Otherwise, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk;

[0072] The volume group of the virtual machine file system is expanded according to the created physical volume.

[0073] In specific implementation, it is determined whether the new mounted drive path information is empty;

[0074] If it is empty, it is a diskless expansion. Determine whether the logical volume in the file system mount point name information meets the preset expansion rules (that is, determine whether the available space of the volume group is greater than or equal to the file system expansion size). If it does, expand the virtual machine file system. If not, terminate the process and capture the exception log.

[0075] If the newly mounted drive letter path information is not empty, it is a disk expansion. The device name of the cloud hard disk is obtained according to the newly mounted drive letter path information, and a physical volume is created based on the device name of the cloud hard disk; the volume group of the virtual machine file system is expanded according to the created physical volume.

[0076] The present invention is described below by a specific embodiment:

[0077] like Figure 3 As shown in the figure, when creating a virtual machine file system:

[0078] Generate a script based on the storage capacity and drive mount point of the cloud hard disk. The script input parameters (which can be specified as default values) include the file system mount point name FS_NAME, file system size FS_SIZE, file system owner FS_USER, file system group FS_GROUP, file system permissions FS_LIMITS, file system type FS_TYPE (ext3 by default), and new mount drive path VOL_SDX (automatically backfilled based on the fdisk-l command);

[0079] Determine whether the script input parameter is in the form of a list, and initialize the List index to 0;

[0080] If the script input parameter is in the form of List, the length of each script input parameter List is checked for legality. If it is illegal, an exception message is thrown and the creation process is terminated. The List index traverses each group of script input parameters, and then checks the compatibility of the file system type information with the virtual machine image operating system;

[0081] If the script input parameter is not in the form of List, directly verify the compatibility of the file system type information and the virtual machine image operating system;

[0082] Determine whether the List index is 0. If so, obtain the cloud hard disk device name (such as dev, vdb, etc.) based on the newly mounted drive letter path VOL_SDX, and perform physical volume initialization operations based on the pvcreate command;

[0083] Perform volume group creation operation and divide the newly added physical volume into a volume group VG_New based on the vgcreate command;

[0084] Create a logical volume. Based on the newly added volume group VG_New and the preset file system mount point name FS_NAME and file system size FS_SIZE, use the lvcreate command to divide single or multiple logical volumes lv1 and lv2.

[0085] Based on the divided logical volumes lv1, lv2, and the file system type FS_TYPE parameter, use the mkfs command to adaptively create virtual machine file systems with the same number of newly added logical volumes;

[0086] Combined with the file system mount point name FS_NAME, create a mount point folder and mount the new file system based on the mount command;

[0087] Based on FS_USER, FS_GROUP, and FS_LIMITS, the newly added file system users, user groups, and file system permissions are divided;

[0088] Determine whether the List traversal is complete. If the traversal is complete, the virtual machine file system creation is complete. Otherwise, the index is incremented and each group of scripts is traversed to enter parameters.

[0089] like Figure 4 As shown in the figure, after the virtual machine file system is created, when expanding the capacity:

[0090] Generate a script based on the storage capacity and drive mount point of the cloud hard disk. The script input parameters (which can be specified as default values) include the file system mount point name FS_NAME, the file system expansion size FS_SIZE, and the new mount drive path VOL_SDX (automatically backfilled based on the fdisk-l command);

[0091] Determine whether the drive path VOL_SDX parameter is empty. If it is empty, it is a diskless expansion. Perform lvs query to determine whether the remaining storage space Available_Storage of the logical volume to which FS_NAME belongs meets the expansion requirements (that is, Available_Storage≤FS_SIZE). If not, terminate the process and capture abnormal logs. If the VOL_SDX parameter is not empty, it is a disk expansion. Get the cloud hard disk device name (such as dev, vdb, etc.) based on the mounted drive path VOL_SDX, perform physical volume initialization based on the pvcreate command, and assign the newly added physical volume to the volume group to which the target file system belongs based on the vgextend command.

[0092] The logical volume to which the target file system belongs is expanded based on the lvextend command, and the target file system is initialized after expansion based on the resize2fs command to make the expansion action effective.

[0093] From the above, it can be seen that the present invention connects the manual LVM instructions for creating and expanding the virtual machine file system in series into the orchestration script, uniformly configures the relevant parameters involved as script input parameters, performs logical judgment and exception capture on the compatibility issues between the operating system OS and the file system and the legitimacy of the parameters that may be involved, realizes the automation and lightweight of the virtual machine file system creation process, supports batch input, allows the creation of multiple file systems on a single cloud disk, and can effectively improve the overall supply efficiency of virtual machine resources on the cloud management platform.

[0094] In addition, the present invention optimizes the logic of the file system expansion script to support two scenarios: disk expansion and diskless expansion. In the diskless expansion scenario, the existing physical volumes and volume group spaces are scanned in advance. When the remaining storage resources meet the expansion requirements, the logical volumes to which the divided target file system belongs are automatically expanded incrementally, thereby completing the file system expansion action, which can effectively solve the problem of low utilization of cloud disk storage resources allocated to the virtual machine.

[0095] Based on the same inventive concept, an embodiment of the present invention also provides a file system creation device, as described in the following embodiments. Since the principle of solving the problem by the file system creation device is similar to that of the file system creation method, the implementation of the file system creation device can refer to the implementation of the file system creation method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0096] Figure 2 A schematic diagram of the structure of a file system creation device provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the device comprises:

[0097] The configuration file generation module 201 is used to generate a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, wherein the configuration file contains multiple parameter information for creating a virtual machine file system, wherein the parameter information at least includes: file system type information, file system size information and new mount drive letter path information.

[0098] The physical volume creation module 202 is used to obtain the device name of the cloud hard disk according to the new mounted drive letter path information, and create a physical volume based on the device name of the cloud hard disk.

[0099] The volume group creation module 203 is used to create a volume group according to the physical volume.

[0100] The logical volume creation module 204 is used to create a logical volume according to the volume group.

[0101] The virtual machine file system creation module 205 is used to create a virtual machine file system according to the logical volume and the file system type information.

[0102] The mount point information generating module 206 is used to generate the mount point information of the virtual machine file system, and the mount point information is used to access the virtual machine file system.

[0103] In an embodiment of the present invention, the device further includes:

[0104] A first judging module, used to judge whether the parameter information in the configuration file is in the form of a list;

[0105] If so, the list length of each parameter information in the configuration file is checked, and when the check result is normal, the compatibility of the file system type information with the virtual machine image operating system is checked.

[0106] In an embodiment of the present invention, the device further includes:

[0107] A second judgment module is used to judge whether the index of the parameter information list in the configuration file is zero;

[0108] If so, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk;

[0109] Otherwise, a logical volume is created based on the volume group.

[0110] In an embodiment of the present invention, the parameter information further includes: file system mount point name information;

[0111] The logical volume creation module 204 is further used to:

[0112] Corresponding logical volumes are created respectively according to the different volume groups, the file system mount point name information and the file system size information in the list.

[0113] In an embodiment of the present invention, the device further includes:

[0114] The verification module is used to verify whether the file system mount point name information is repeated with the mount point name created in the virtual machine image root directory.

[0115] In an embodiment of the present invention, the parameter information further includes: file system owner information, file system group information, and file system permission information;

[0116] The device also includes:

[0117] A user configuration module, used for configuring the user for the generated virtual machine file system according to the file system owner information;

[0118] A user group configuration module, used for configuring a user group for the generated virtual machine file system according to the file system group information;

[0119] The operation permission configuration module is used to configure the operation permission for the generated virtual machine file system according to the file system permission information.

[0120] In an embodiment of the present invention, the device further includes:

[0121] The expansion parameter information receiving module is used to receive the expansion parameter information, wherein the expansion parameter information includes: file system mount point name information, file system expansion size information and new mount drive path information;

[0122] The capacity expansion module is used to expand the virtual machine file system according to the capacity expansion parameter information.

[0123] In an embodiment of the present invention, the expansion module is further used to:

[0124] Determine whether the new mounted drive path information is empty;

[0125] If it is empty, determine whether the logical volume in the file system mount point name information meets the preset expansion rules, and expand the virtual machine file system if the preset expansion rules are met;

[0126] Otherwise, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk;

[0127] The volume group of the virtual machine file system is expanded according to the created physical volume.

[0128] In order to achieve the above object, according to another aspect of the present application, a computer device is also provided. Figure 5 As shown, the computer device includes a memory, a processor, a communication interface and a communication bus. A computer program that can be executed on the processor is stored in the memory. When the processor executes the computer program, the steps in the above-mentioned embodiment method are implemented.

[0129] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0130] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and units, such as the corresponding program units in the above method embodiments of the present invention. The processor executes various functional applications of the processor and works data processing by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiments.

[0131] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0132] The one or more units are stored in the memory, and when executed by the processor, the method in the above embodiment is performed.

[0133] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.

[0134] To summarize, the present invention generates a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, obtains the device name of the cloud hard disk according to the new mount drive letter path information, creates a physical volume based on the device name of the cloud hard disk, creates a volume group according to the physical volume, creates a logical volume according to the volume group, creates a virtual machine file system according to the logical volume and the file system type information, and generates the mount point information of the virtual machine file system, so as to complete the creation of the virtual machine file system. The whole process does not require manual operation by the staff, and can realize the automatic batch creation of virtual machine file systems with a high degree of automation.

[0135] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0136] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0137] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0139] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for creating a file system, It is characterized in that include: Generate a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, wherein the configuration file includes a plurality of parameter information for creating a virtual machine file system, wherein the parameter information includes at least: file system type information, file system size information and new mount drive letter path information; Obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk; Creating a volume group according to the physical volume; Creating a logical volume according to the volume group; Creating a virtual machine file system according to the logical volume and the file system type information; Generate mount point information of the virtual machine file system, where the mount point information is used to access the virtual machine file system; After generating the configuration file according to the storage capacity of the cloud hard disk and the drive letter mount point, the method further includes: Determine whether the parameter information in the configuration file is in the form of a list; if so, verify the list length of each parameter information in the configuration file, and if the verification result is normal, verify the compatibility of the file system type information with the virtual machine image operating system.

2. The method according to claim 1, It is characterized in that After verifying the compatibility of the file system type information with the virtual machine image operating system, the method further includes: Determine whether the index of the parameter information list in the configuration file is zero; If so, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk; Otherwise, a logical volume is created based on the volume group.

3. The method according to claim 2, It is characterized in that The parameter information also includes: file system mount point name information; Creating a logical volume according to the volume group includes: Corresponding logical volumes are created respectively according to the different volume groups, the file system mount point name information and the file system size information in the list.

4. The method according to claim 3, It is characterized in that After verifying the compatibility of the file system type information with the virtual machine image operating system, the method further includes: Check whether the file system mount point name information is the same as the mount point name already created in the virtual machine image root directory.

5. The method according to claim 1, It is characterized in that The parameter information also includes: file system owner information, file system group information, and file system permission information; After generating the mount point information of the virtual machine file system, the method further includes: Configuring a user for the generated virtual machine file system according to the file system owner information; According to the file system group information, the generated virtual machine file system is configured with a user group; The generated virtual machine file system is configured with operation permissions according to the file system permission information.

6. The method according to claim 1, It is characterized in that After creating a virtual machine file system according to the logical volume and the file system type information, the method further includes: Receive expansion parameter information, the expansion parameter information including: file system mount point name information, file system expansion size information and new mount drive path information; The virtual machine file system is expanded according to the expansion parameter information.

7. The method according to claim 6, It is characterized in that Expanding the virtual machine file system according to the expansion parameter information includes: Determine whether the new mounted drive path information is empty; If it is empty, determine whether the logical volume in the file system mount point name information meets the preset expansion rules, and expand the virtual machine file system if the preset expansion rules are met; Otherwise, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk; The volume group of the virtual machine file system is expanded according to the created physical volume.

8. A file system creation device, It is characterized in that include: A configuration file generation module, used to generate a configuration file according to the storage capacity and drive letter mount point of the cloud hard disk, wherein the configuration file includes a plurality of parameter information for creating a virtual machine file system, wherein the parameter information includes at least: file system type information, file system size information and new mount drive letter path information; A physical volume creation module, used to obtain the device name of the cloud hard disk according to the newly mounted drive letter path information, and create a physical volume based on the device name of the cloud hard disk; A volume group creation module, used for creating a volume group according to the physical volume; A logical volume creation module, used for creating a logical volume according to the volume group; A virtual machine file system creation module, used to create a virtual machine file system according to the logical volume and the file system type information; A mount point information generating module, used to generate mount point information of the virtual machine file system, wherein the mount point information is used to access the virtual machine file system; The device also includes: The first judgment module is used to judge whether the parameter information in the configuration file is in the form of a list; if so, the list length of each parameter information in the configuration file is verified, and when the verification result is normal, the compatibility of the file system type information with the virtual machine image operating system is verified.

9. The device as claimed in claim 8, It is characterized in that The device also includes: A second judgment module is used to judge whether the index of the parameter information list in the configuration file is zero; If so, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk; Otherwise, a logical volume is created based on the volume group.

10. The device according to claim 9, It is characterized in that The parameter information also includes: file system mount point name information; The logical volume creation module is further used to: Corresponding logical volumes are created respectively according to the different volume groups, the file system mount point name information and the file system size information in the list.

11. The device according to claim 10, It is characterized in that The device also includes: The verification module is used to verify whether the file system mount point name information is repeated with the mount point name created in the virtual machine image root directory.

12. The device according to claim 8, It is characterized in that The parameter information also includes: file system owner information, file system group information, and file system permission information; The device also includes: A user configuration module, used for configuring the user for the generated virtual machine file system according to the file system owner information; A user group configuration module, used for configuring a user group for the generated virtual machine file system according to the file system group information; The operation permission configuration module is used to configure the operation permission for the generated virtual machine file system according to the file system permission information.

13. The device according to claim 8, It is characterized in that The device also includes: The expansion parameter information receiving module is used to receive the expansion parameter information, wherein the expansion parameter information includes: file system mount point name information, file system expansion size information and new mount drive path information; The capacity expansion module is used to expand the virtual machine file system according to the capacity expansion parameter information.

14. The device according to claim 13, It is characterized in that The expansion module is further used for: Determine whether the new mounted drive path information is empty; If it is empty, determine whether the logical volume in the file system mount point name information meets the preset expansion rules, and expand the virtual machine file system if the preset expansion rules are met; Otherwise, obtaining the device name of the cloud hard disk according to the newly mounted drive letter path information, and creating a physical volume based on the device name of the cloud hard disk; The volume group of the virtual machine file system is expanded according to the created physical volume.

15. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

16. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.