A file management system and method for containers in cloud computing

By introducing a four-layer file system structure in cloud computing, performing block processing on image layer files, and recording the corresponding relationships in the metadata layer, the problem of low file system performance in containerization technology is solved, and file modification efficiency and resource utilization are improved.

CN120316088BActive Publication Date: 2025-10-17ZHENGZHOU FEILONG COMPUTER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510399976.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-10-17
Estimated Expiration
2045-04-01

AI Technical Summary

Technical Problem

In cloud computing, the file system performance of containerized technology is limited by the granularity of the union file system, resulting in low efficiency when modifying files, especially when modifying large files and a large number of small files, which leads to serious waste of resources.

Method used

The file system adopts a four-layer structure, including an image layer, a container layer, a metadata layer, and a unified view layer. By dividing the image layer files into blocks and recording the correspondence between files and data blocks in the metadata layer, the file blocks are copied to the container layer for modification only when needed, avoiding the need for full copying.

Benefits of technology

It improves file access speed and system efficiency, and reduces resource waste, especially when modifying large files and a large number of small files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120316088B_ABST
    Figure CN120316088B_ABST
Patent Text Reader

Abstract

The application provides a file management system method of a container in cloud computing, comprising the following steps: after receiving a container image creation instruction, performing block division on each file of an image layer, establishing a corresponding table of files and data blocks, and generating a container image containing the corresponding table; after receiving a container running instruction, creating a container by using the container image, and generating an initial joint file system of the container; the initial joint file system is sequentially from bottom to top as follows: the image layer, the container layer, the metadata layer, and the unified view layer; wherein, the metadata layer of the initial joint file system is generated according to the corresponding table; during the running of the container, after receiving a file operation instruction, judging a file operation type, and performing operation on data blocks of the image layer and / or the container layer according to the file operation type and the metadata layer. The application effectively improves the overall efficiency of the file system of the container.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing, and in particular to a file management system and method for containers in cloud computing. Background Art

[0002] Cloud computing refers to a system of extremely powerful computing capabilities formed through computer networks. It can store and aggregate related resources, configure them on demand, and provide personalized services to users. Cloud computing originated from Amazon's Elastic Compute Service. Currently, many companies have launched their own cloud products. Leveraging its powerful computing and storage capabilities, cloud computing can provide IT resources to small and medium-sized enterprises, significantly reducing their IT costs. Cloud computing boasts scalability, high reliability, and support for dynamic expansion. These capabilities are primarily achieved through virtualization technology. Virtualization creates a virtual physical machine within a server, making this machine indistinguishable from a regular server or computer, or, in other words, imperceptible to users.

[0003] In addition to virtual machines, another important technology in cloud computing is containerization. Containers are smaller and more portable than virtual machines. Unlike virtual machines, they don't require virtual CPU, disk, and memory, saving server resources. Containers act like sandboxes; applications can be deployed in them and run using the host kernel. Containers use the Union File System (UnionFS) as their file system. The Union File System employs a layered approach, dividing files into multiple levels. Files at different levels have different content and functions. However, because the Union File System operates at the file level, not the data block level, modifying only a small part of a file requires a copy-up of the entire file. This significantly reduces container performance. Improving the speed of file systems in cloud computing is a key factor in improving container performance. Summary of the Invention

[0004] In order to solve the above problems, the present invention provides a file management method for containers in cloud computing, the method comprising the following steps:

[0005] After receiving a container image creation instruction, each file in the image layer is divided into blocks, a correspondence table between files and data blocks is established, and a container image containing the correspondence table is generated; after receiving a container operation instruction, a container is created using the container image, and an initial united file system of the container is generated; the initial united file system comprises, from bottom to top, an image layer, a container layer, a metadata layer, and a unified view layer; wherein the metadata layer of the initial united file system is generated according to the correspondence table;

[0006] During the running of the container, after receiving a file operation instruction, the file operation type is judged, and data blocks of the image layer and / or the container layer are operated according to the file operation type and the metadata layer.

[0007] Preferably, each file of the image layer is chunked, and a corresponding table of files and data blocks is established, specifically:

[0008] The image layer is divided into two layers, i.e., a first sub-image layer and a second sub-image layer, the first sub-image layer is a basic image layer, the basic image layer is an operating system image layer, and other image layers are second sub-image layers.

[0009] Each file corresponding to the first sub-image layer is taken as a data block, and each file corresponding to the second image layer is divided into at least one data block according to a preset data block size, and the corresponding relationship between the files and the data blocks is recorded in the file table.

[0010] Preferably, each file of the image layer is chunked, and a corresponding table of files and data blocks is established, specifically:

[0011] The image layer is divided into N sub-image layers, and the sub-image layers are sequentially numbered from low to high as 1, …, N; the first sub-image layer is a basic image layer, and a sub-image layer is generated by performing a commit operation once each time on the basis of the first sub-image layer; wherein the basic image layer is an operating system image layer; N is a positive integer greater than or equal to 1;

[0012] Each file corresponding to the first sub-image layer is taken as a data block, and each file corresponding to the kth sub-image layer is divided into at least one data block according to a data block size corresponding to the image layer, wherein the data block size corresponding to the image layer is 2 -(k-2) Block, wherein k is the number of the sub-image layer, and Block is a data block size set by a user.

[0013] Preferably, the data blocks of the image layer and / or the container layer are operated according to the file operation type and the metadata layer, specifically:

[0014] If a new file is added, a data block corresponding to the new file is created in the container layer, metadata of the new file is recorded in the metadata layer, and file content is stored in the data block;

[0015] If a file is deleted, if part or all data blocks of the file to be deleted exist in the container layer, the part or all data blocks in the container layer are deleted, and metadata corresponding to the file to be deleted is deleted from the metadata layer, if all data blocks of the file to be deleted exist in the image layer, metadata corresponding to the file to be deleted is deleted from the metadata layer;

[0016] If the file is to be modified, the location of the data block to be modified is determined. If it is in the container layer, the data block is modified. If it is in the image layer, the data block is copied to the container layer and modified. The metadata of the file to be modified is updated in the metadata layer.

[0017] If the file is to be read, it is determined whether the file to be read exists in the metadata layer. If so, the file is read from the image layer and / or container layer according to the metadata information of the file to be read stored in the metadata layer.

[0018] Preferably, the metadata layer is composed of multiple linked lists, each linked list corresponds to a file in a container image, the first data element of the linked list is the file name, the second data element of the linked list is the file permission information, and each subsequent data element of the linked list is the corresponding data block address and the number of reads and modifications of the file.

[0019] Preferably, each linked list is traversed periodically, the linked lists are sorted according to the number of modifications in the linked lists, and the linked list with the largest number of modifications is taken as the first linked list.

[0020] On the other hand, the present invention also provides a file management system for containers in cloud computing, the system comprising the following modules:

[0021] The container initial united file system generation module is configured to, upon receiving a container image creation instruction, partition each file in the image layer, establish a correspondence table between files and data blocks, and generate a container image containing the correspondence table; upon receiving a container run instruction, create a container using the container image and generate an initial united file system for the container; the initial united file system comprises, from bottom to top, an image layer, a container layer, a metadata layer, and a unified view layer; the metadata layer of the initial united file system is generated based on the correspondence table;

[0022] The container file management module is used to determine the file operation type after receiving a file operation instruction during the container operation process, and operate the data blocks of the image layer and / or container layer according to the file operation type and the metadata layer.

[0023] Preferably, the process of dividing each file in the image layer into blocks and establishing a correspondence table between files and data blocks is as follows:

[0024] The image layer is divided into two layers, namely the first sub-image layer and the second sub-image layer, the first sub-image layer is the base image layer, the base image layer is the operating system image layer, and the other image layers are the second sub-image layers;

[0025] Each file corresponding to the first sub-mirror layer is taken as a data block, and each file corresponding to the second mirror layer is divided into at least one data block according to a preset data block size, and a corresponding relationship between the file and the data block is recorded in the file table.

[0026] Preferably, the file corresponding to each mirror layer is divided into blocks, and a corresponding table between the file and the data block is established, specifically:

[0027] The mirror layer is divided into N sub-mirror layers, and the sub-mirror layers are sequentially numbered from low to high as 1, …, N; the first sub-mirror layer is a basic mirror layer, and a sub-mirror layer is generated by performing a commit operation once each time on the basis of the first sub-mirror layer; wherein the basic mirror layer is an operating system mirror layer; N is a positive integer greater than or equal to 1;

[0028] Each file corresponding to the first sub-mirror layer is taken as a data block, and each file corresponding to the kth sub-mirror layer is divided into at least one data block according to a data block size corresponding to the mirror layer, wherein the data block size corresponding to the mirror layer is 2 -(k-2) Block, wherein k is the number of the sub-mirror layer, and Block is a data block size set by a user.

[0029] Preferably, the data block of the mirror layer and / or the container layer is operated according to the file operation type and the metadata layer, specifically:

[0030] If the file is added, a data block corresponding to the added file is created in the container layer, metadata of the added file is recorded in the metadata layer, and file content is stored in the data block;

[0031] If the file is deleted, if part or all of the data blocks of the file to be deleted exist in the container layer, the part or all of the data blocks in the container layer are deleted from the container layer, and metadata corresponding to the file to be deleted is deleted from the metadata layer, if all of the data blocks of the file to be deleted exist in the mirror layer, metadata corresponding to the file to be deleted is deleted from the metadata layer;

[0032] If the file is modified, a position of the data block to be modified is judged, if the data block is in the container layer, the data block is modified, if the data block is in the mirror layer, the data block is copied to the container layer and modified, and metadata of the file to be modified is updated in the metadata layer;

[0033] If the file is read, it is judged whether the file to be read exists in the metadata layer, if the file to be read exists, the file is read from the mirror layer and / or the container layer according to metadata information of the file to be read stored in the metadata layer.

[0034] Finally, the application also provides a computer readable storage medium, the computer readable storage medium has a computer program stored thereon, the computer program is executed by a processor to perform the method described above.

[0035] For the file system of the container in cloud computing, when performing file modification and other operations, the image layer corresponding file needs to be copied to the container layer as a whole, and for the modification of large files and the modification of a large number of small files, a lot of resources and time will be wasted, and the problem of low efficiency, the application adopts a four-layer structure, from bottom to top, the image layer, the container layer, the metadata layer and the unified view layer, different ways are used for blocking different files in the image layer, the corresponding relationship between the file and the data block of the file is recorded in the metadata layer, when modifying the image layer file, the whole file does not need to be copied to the container layer, but the file block corresponding to the part of the file to be modified is copied to the container layer, and the data block address of the file is updated in the metadata layer, the access speed of the file is improved. BRIEF DESCRIPTION OF DRAWINGS

[0036] In order to more clearly illustrate the specific embodiments of the application or the technical solutions in the prior art, the drawings needed in the specific embodiments or the prior art description will be briefly introduced below, and obviously, the drawings in the following description are some embodiments of the application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.

[0037] Figure 1 The flowchart of the embodiment 1 of the application;

[0038] Figure 2 The hierarchical structure diagram of the container image file system in the prior art;

[0039] Figure 3 The hierarchical structure diagram of the container file system of the application;

[0040] Figure 4 The hierarchical structure diagram of the image layer. EMBODIMENT

[0041] In this document, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0042] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

[0043] Embodiment one

[0044] The present application provides a file management method of a container in cloud computing, as shown in the accompanying drawings, the method comprises the following steps: Figure 1

[0045] S1, after receiving a container image creation instruction, each file of the image layer is divided into blocks, a corresponding table of files and data blocks is established, a container image containing the corresponding table is generated; after receiving a container running instruction, a container is created by using the container image, and an initial joint file system of the container is generated; the initial joint file system is sequentially from bottom to top: image layer, container layer, metadata layer, unified view layer; wherein the metadata layer of the initial joint file system is generated according to the corresponding table;

[0046] Before using the image to create the container, the container image is needed first, the container image is used to create the running container, which is similar to the operating system in the computer. When creating the image, a basic image is used as the basis, and various applications are added on the basic image, for example, the basic image is CentOS, and Tomcat needs to be added on CentOS in advance.

[0047] The structure of the image file system of the prior art is as shown in Figure 2 ​As shown, it includes an image layer (Image Layer or Lowerdir), a container layer (Container Layer or Upperdir), a unified view layer (Container Mount or Merged), wherein the files of the image layer are unchangeable, if the files of the image layer are modified, the files of the image layer are copied (copy-up) to the container layer, and then the modified files are used to replace the files of the image layer in the container layer. Figure 3 As shown, it includes an image layer, a container layer, a metadata layer, and a unified view layer, and the files of the image layer are chunked, a corresponding table of files and data blocks is established, and a container image containing the corresponding table is generated.

[0048] After receiving a container running instruction, such as docker run, a container is created by using the image, and an initial union file system of the container is generated, wherein the initial union file system refers to a file system created according to the image, at this time, no modification, deletion, or addition operation is performed on the files, and only the files in the image are read. The initial union file system adopts the same organization structure as the image file, that is, it includes the four-layer structure.

[0049] S2, during the running of the container, after receiving a file operation instruction, judging the file operation type, and performing an operation on the data blocks of the image layer and / or the container layer according to the file operation type and the metadata layer.

[0050] After the initial union file system is generated, if there is an instruction for operating the files, the data blocks of the image layer and / or the container layer are operated according to the instruction type, which will be further described in detail below.

[0051] Since the files of the image layer provide basic services, different image layer file operations are different, for example, for operating system files, basically all read operations are performed, and for application program files in the image layer, operations such as adding, deleting, modifying, and querying may be involved, and different chunking granularities are adopted for different files, which helps to improve the efficiency of the file system. For configuration files of the operating system, basically all read operations are performed, if chunking is performed, the efficiency of reading the configuration files will be reduced, and for a certain application program file, modification is involved, if no chunking is performed, the entire file is read to the container layer, when a large number of such operations are involved, the efficiency of the file system will be reduced, based on this, the present application further adopts different chunking manners for different files of the image layer, in a specific embodiment, each file of the image layer is chunked, and a corresponding table of files and data blocks is established, specifically:

[0052] The mirror image layer is divided into two layers, i.e., a first sub-mirror image layer and a second sub-mirror image layer, the first sub-mirror image layer is a basic mirror image layer, the basic mirror image layer is an operating system mirror image layer, and other mirror image layers are second sub-mirror image layers;

[0053] Each file corresponding to the first sub-mirror image layer is taken as a data block, and each file corresponding to the second mirror image layer is divided into at least one data block according to a preset data block size, and the corresponding relationship between the file and the data block is recorded in the file table.

[0054] In this embodiment, the files in the mirror image layer belong to the second sub-mirror image layer except the files of the first sub-mirror image layer;

[0055] For example, a file A is a file in the operating system, i.e., a file of the first sub-mirror image layer, the file is not divided into blocks or the whole file is taken as a data block, and the file and the data block of the file are recorded in the metadata layer. File B is a file of an application program, i.e., a file of the second sub-mirror image layer, and file B is divided into blocks according to a preset data block size. If file B is 121M and the block size is 20M, file B is divided into 6 blocks. If the user modifies file B and the modified part involves the third data block of file B, only the third data block needs to be copied to the container layer and modified, and other data blocks of file B do not need to be copied. Then, the third data block address of file B in the metadata layer is updated to the modified file block in the container layer. If the third data block is modified again next time, the third data block of file B does not need to be copied, and the third data block is directly modified in the container layer.

[0056] In another embodiment, each file in the mirror image layer is divided into blocks, and a corresponding table of the file and the data block is established, specifically:

[0057] The mirror image layer is divided into N sub-mirror image layers, and the sub-mirror image layers are sequentially numbered from low to high as 1, …, N; the first sub-mirror image layer is a basic mirror image layer, and a sub-mirror image layer is generated by performing a commit operation once each time on the basis of the first sub-mirror image layer, as shown in Figure 4 The basic mirror image layer is an operating system mirror image layer; N is a positive integer greater than or equal to 1;

[0058] Each file corresponding to the first sub-mirror image layer is taken as a data block, and each file corresponding to the kth sub-mirror image layer is divided into at least one data block according to a data block size corresponding to the mirror image layer, the data block size corresponding to the mirror image layer is 2 -(k-2) Block, wherein k is the number of the sub-mirror image layer, and Block is a data block size set by the user.

[0059] The file system of the application is different from the file management of the container, in a specific embodiment, the data block of the mirror layer and / or the container layer is operated according to the file operation type and the metadata layer, specifically:

[0060] If a new file is added, the data block corresponding to the new file is created in the container layer, and the metadata of the new file is recorded in the metadata layer, and the file content is stored in the data block;

[0061] In a specific embodiment, a linked list corresponding to the new file is generated in the metadata layer, and the information recorded in the linked list includes but is not limited to file creation time, file corresponding data block address, data block modification times, data block read times, etc.

[0062] If a file is deleted, if part or all of the data block of the file to be deleted exists in the container layer, the part or all of the data block in the container layer is deleted from the container layer, and the metadata corresponding to the file to be deleted is deleted from the metadata layer, if all the data blocks of the file to be deleted are located in the mirror layer, the metadata corresponding to the file to be deleted is deleted from the metadata layer;

[0063] If a file is modified, the position of the data block to be modified is determined, if in the container layer, the data block is modified, if in the mirror layer, the data block is copied to the container layer and modified, and the metadata of the file to be modified is updated in the metadata layer;

[0064] When modifying a file, if the data block to be modified is located in the mirror layer, the data block needs to be copied to the container layer and modified, and after modification, the metadata corresponding to the file to be modified in the metadata layer is updated, and the modified metadata is: the data block address in the metadata layer is modified to the modified data block address in the container layer, and the modification times of the data block are increased by one.

[0065] If a file is read, it is determined whether the file to be read exists in the metadata layer, if it exists, the file is read from the mirror layer and / or the container layer according to the metadata information of the file to be read stored in the metadata layer.

[0066] In order to be able to manage all files in the metadata layer, in an embodiment, the metadata layer is composed of multiple linked lists, each linked list corresponds to a file in a container image, the first data element of the linked list is the file name, the second data element of the linked list is the file permission information, and each subsequent data element of the linked list is the file corresponding data block address and read times, modification times.

[0067] The file or data block that is frequently modified has a higher possibility of being modified or accessed in the following time. In order to improve the efficiency of traversing the metadata layer, in an embodiment, the method further comprises: timing traversing each chain table, sorting the chain tables according to the number of modifications in the chain tables, and taking the chain table with the most modifications as the first chain table.

[0068] Embodiment two

[0069] In another aspect, the present application also provides a file management system of a container in cloud computing, the system comprising the following modules:

[0070] A container initial union file system generation module is configured to, after receiving a container image creation instruction, block each file of the image layer, establish a corresponding table of files and data blocks, and generate a container image containing the corresponding table; and, after receiving a container running instruction, create a container by using the container image and generate an initial union file system of the container; the initial union file system comprises, from bottom to top, an image layer, a container layer, a metadata layer, and a unified view layer; wherein, the metadata layer of the initial union file system is generated according to the corresponding table;

[0071] A container file management module is configured to, during the running of the container, after receiving a file operation instruction, judge a file operation type, and operate the data blocks of the image layer and / or the container layer according to the file operation type and the metadata layer.

[0072] Preferably, the blocking each file of the image layer and establishing the corresponding table of files and data blocks are specifically as follows:

[0073] The image layer is divided into two layers, i.e., a first sub-image layer and a second sub-image layer; the first sub-image layer is a basic image layer; the basic image layer is an operating system image layer; and other image layers are the second sub-image layer.

[0074] Each file corresponding to the first sub-image layer is taken as a data block; each file corresponding to the second image layer is divided into at least one data block according to a preset data block size; and the corresponding relationship between the files and the data blocks is recorded in the file table.

[0075] Preferably, the blocking each file of the image layer and establishing the corresponding table of files and data blocks are specifically as follows:

[0076] The image layer is divided into N sub-image layers; the sub-image layers are sequentially numbered from low to high as 1, …, N; the first sub-image layer is a basic image layer; a sub-image layer is generated by performing a commit operation once each time on the basis of the first sub-image layer; wherein, the basic image layer is an operating system image layer; N is a positive integer greater than or equal to 1.

[0077] each file corresponding to the first sub-mirror layer is taken as a data block, and each file corresponding to the kth sub-mirror layer is divided into at least one data block according to a data block size corresponding to a mirror layer, the data block size corresponding to the mirror layer being 2 -(k-2) Block, wherein k is the number of the sub-mirror layer, and Block is a data block size set by a user.

[0078] Preferably, the data block of the mirror layer and / or the container layer is operated according to the file operation type and the metadata layer, specifically:

[0079] If the file is to be added, a data block corresponding to the added file is created in the container layer, metadata of the added file is recorded in the metadata layer, and the file content is stored in the data block;

[0080] If the file is to be deleted, if part or all of the data block of the file to be deleted exists in the container layer, the part or all of the data block in the container layer is deleted from the container layer, and the metadata corresponding to the file to be deleted is deleted from the metadata layer, if all of the data block of the file to be deleted exists in the mirror layer, the metadata corresponding to the file to be deleted is deleted from the metadata layer;

[0081] If the file is to be modified, the position of the data block to be modified is judged, if the data block is in the container layer, the data block is modified, if the data block is in the mirror layer, the data block is copied to the container layer and modified, and the metadata of the file to be modified is updated in the metadata layer;

[0082] If the file is to be read, it is judged whether the file to be read exists in the metadata layer, if the file to be read exists, the file is read from the mirror layer and / or the container layer according to the metadata information of the file to be read stored in the metadata layer.

[0083] Finally, the application further provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program is run by a processor to execute the method as described above.

[0084] Embodiment three

[0085] The application further provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program is run by a processor to execute the method as described in Embodiment 1.

[0086] Embodiment four

[0087] The application further provides a device, wherein the device comprises a computer readable storage medium and a processor, a computer program is stored on the computer readable storage medium, and the computer program is run by the processor to execute the method as described in Embodiment 1.

[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of the necessary general hardware platform, and of course can also be implemented by means of the combination of hardware and software. Based on such understanding, the above technical solutions can be embodied in the form of computer products, and the present application can be in the form of computer program products 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 codes.

[0089] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A file management system for containers in cloud computing, characterized in that: The system includes the following modules: The container initial united file system generation module is configured to, upon receiving a container image creation instruction, divide each file in the image layer into blocks, establish a correspondence table between files and data blocks, and generate a container image containing the correspondence table; upon receiving a container run instruction, create a container using the container image and generate an initial united file system for the container; the initial united file system comprises, from bottom to top, an image layer, a container layer, a metadata layer, and a unified view layer; wherein the metadata layer of the initial united file system is generated based on the correspondence table; The container file management module is used to determine the file operation type after receiving a file operation instruction during the container operation process, and operate the data blocks of the image layer and / or container layer according to the file operation type and the metadata layer; The method further comprises dividing each file of the image layer into blocks and establishing a correspondence table between files and data blocks, specifically: dividing the image layer into two layers, namely a first sub-image layer and a second sub-image layer, wherein the first sub-image layer is a base image layer, the base image layer is an operating system image layer, and the other image layers are second sub-image layers; treating each file corresponding to the first sub-image layer as a data block, dividing each file corresponding to the second image layer into at least one data block according to a preset data block size, and recording the correspondence between the files and the data blocks in a file table; The method divides each file of the image layer into blocks and establishes a correspondence table between files and data blocks, specifically: divide the image layer into N sub-image layers, and number the sub-image layers from low to high as 1, ..., N; the first sub-image layer is the base image layer, and on the basis of the first sub-image layer, a commit operation is performed each time to generate a sub-image layer; wherein, the base image layer is the operating system image layer; N is a positive integer greater than or equal to 1; each file corresponding to the first sub-image layer is regarded as a data block, and each file corresponding to the kth sub-image layer is divided into at least one data block according to the data block size corresponding to the image layer, and the data block size corresponding to the image layer is Block, where k is the sub-image layer number and Block is the data block size set by the user.

2. The system according to claim 1, wherein The operation on the data blocks of the image layer and / or the container layer according to the file operation type and the metadata layer is specifically as follows: If it is a newly added file, a data block corresponding to the newly added file is created in the container layer, and the metadata of the newly added file is recorded in the metadata layer, and the file content is stored in the data block; If the file is to be deleted, if some or all of the data blocks of the file to be deleted exist in the container layer, then some or all of the data blocks in the container layer will be deleted from the container layer, and the metadata corresponding to the file to be deleted will be deleted from the metadata layer. If all of the data blocks of the file to be deleted are in the image layer, then the metadata corresponding to the file to be deleted will be deleted from the metadata layer. If the file is to be modified, the location of the data block to be modified is determined. If it is in the container layer, the data block is modified. If it is in the image layer, the data block is copied to the container layer and modified. Update the metadata of the file to be modified at the metadata layer; If the file is to be read, it is determined whether the file to be read exists in the metadata layer. If so, the file is read from the image layer and / or container layer according to the metadata information of the file to be read stored in the metadata layer.

3. A file management method for containers in cloud computing, characterized in that: The method comprises the following steps: After receiving a container image creation instruction, each file in the image layer is divided into blocks, a correspondence table between files and data blocks is established, and a container image containing the correspondence table is generated; after receiving a container operation instruction, a container is created using the container image, and an initial united file system of the container is generated; the initial united file system comprises, from bottom to top, an image layer, a container layer, a metadata layer, and a unified view layer; wherein the metadata layer of the initial united file system is generated according to the correspondence table; During the container operation process, after receiving a file operation instruction, the file operation type is determined, and the data blocks of the image layer and / or container layer are operated according to the file operation type and the metadata layer; The method further comprises dividing each file of the image layer into blocks and establishing a correspondence table between files and data blocks, specifically: dividing the image layer into two layers, namely a first sub-image layer and a second sub-image layer, wherein the first sub-image layer is a base image layer, the base image layer is an operating system image layer, and the other image layers are second sub-image layers; treating each file corresponding to the first sub-image layer as a data block, dividing each file corresponding to the second image layer into at least one data block according to a preset data block size, and recording the correspondence between the files and the data blocks in a file table; The method divides each file of the image layer into blocks and establishes a correspondence table between files and data blocks, specifically: divide the image layer into N sub-image layers, and number the sub-image layers from low to high as 1, ..., N; the first sub-image layer is the base image layer, and on the basis of the first sub-image layer, a commit operation is performed each time to generate a sub-image layer; wherein, the base image layer is the operating system image layer; N is a positive integer greater than or equal to 1; each file corresponding to the first sub-image layer is regarded as a data block, and each file corresponding to the kth sub-image layer is divided into at least one data block according to the data block size corresponding to the image layer, and the data block size corresponding to the image layer is Block, where k is the sub-image layer number and Block is the data block size set by the user.

4. The method according to claim 3, wherein The operation on the data blocks of the image layer and / or the container layer according to the file operation type and the metadata layer is specifically as follows: If it is a newly added file, a data block corresponding to the newly added file is created in the container layer, and the metadata of the newly added file is recorded in the metadata layer, and the file content is stored in the data block; If the file is to be deleted, if some or all of the data blocks of the file to be deleted exist in the container layer, then some or all of the data blocks in the container layer will be deleted from the container layer, and the metadata corresponding to the file to be deleted will be deleted from the metadata layer. If all of the data blocks of the file to be deleted are in the image layer, then the metadata corresponding to the file to be deleted will be deleted from the metadata layer. If the file is to be modified, the location of the data block to be modified is determined. If it is in the container layer, the data block is modified. If it is in the image layer, the data block is copied to the container layer and modified. Update the metadata of the file to be modified at the metadata layer; If the file is to be read, it is determined whether the file to be read exists in the metadata layer. If so, the file is read from the image layer and / or container layer according to the metadata information of the file to be read stored in the metadata layer.

5. The method according to claim 3, wherein The metadata layer is composed of multiple linked lists, each of which corresponds to a file in a container image. The first data element of the linked list is the file name, the second data element of the linked list is the file permission information, and each subsequent data element of the linked list is the corresponding data block address and the number of reads and modifications of the file.

6. The method according to claim 5, wherein Traverse each linked list regularly, sort the linked lists according to the number of modifications in the linked lists, and take the linked list with the most modifications as the first linked list.

Citation Information

Patent Citations

  • Container mirror image acceleration method and application based on loading delay on demand

    CN116048728A

  • Mirror image storage method and computing device

    CN116661681A