Physical volume access method, apparatus, computer device and storage medium

By storing the mapping relationship files between volume groups and physical volumes in the memory file system, the required physical volumes can be quickly obtained and accessed, which solves the problem of low execution efficiency of LVM commands in a multi-block device environment and improves access and execution efficiency.

WO2024174894A1PCT designated stage expired Publication Date: 2024-08-29ZTE CORP

Patent Information

Application Number
PCT/CN2024/076301
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-22
Filing Date
2024-02-06
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

When using Logical Volume Manager (LVM), the more block devices in the system, the longer it takes to directly access the block devices for reading and writing, resulting in slow execution of LVM commands and slow return of execution results.

Method used

By storing the mapping relationship file between the volume group and the physical volume in the memory file system, the identification information of the physical volume can be quickly obtained based on the volume group identification information in the LVM command, and only the required physical volumes can be accessed, reducing the need for system block devices. Number of visits.

Benefits of technology

Significantly improves the access efficiency of physical volumes and the execution efficiency of LVM commands, reducing the time required to access physical volumes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024076301_29082024_PF_FP_ABST
    Figure CN2024076301_29082024_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a physical volume access method, an apparatus, a computer device and a storage medium. The method comprises: according to first identification information of a volume group in a currently executed LVM command, obtaining from a mapping relation file stored in a memory file system second identification information of a physical volume involved in executing the LVM command, wherein the mapping relation file is used for describing a mapping relationship between the volume group and the physical volume; and accessing the physical volume corresponding to the second identification information.
Need to check novelty before this filing date? Find Prior Art

Description

Physical volume access method, device, computer equipment and storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to patent application No. 202310191319.6 filed with the China Patent Office on February 22, 2023, the entire contents of which are incorporated herein by reference. Technical Field

[0003] The present application relates to, but is not limited to, the field of disk storage. Background Art

[0004] Logical Volume Manager (LVM) is a mechanism for managing disk partitions in Linux. When using LVM, users can adjust the usage of each disk partition without stopping the system. It can also solve many problems that the size of disk partitions cannot be adjusted flexibly, and can allocate disk space more reasonably. LVM commands learn about the logical volume (Logical Volume,

[0005] The Linux kernel then creates a mapping device object corresponding to the logical volume (LV). However, executing LVM commands requires scanning and querying all block devices in the system. Therefore, the more block devices a system has, the longer it takes to directly access the block devices for reading and writing. This also increases the read and write pressure on the physical volume, resulting in slower LVM command execution and delayed result return. Therefore, improving the execution efficiency of LVM commands is a pressing issue.

[0006] Summary of the Invention

[0007] Embodiments of the present application provide a physical volume access method, apparatus, computer device, and storage medium.

[0008] In a first aspect, an embodiment of the present application provides a physical volume access method, comprising: obtaining, based on first identification information of a volume group in a currently executed logical volume manager LVM command, second identification information of a physical volume involved in executing the LVM command from a mapping relationship file stored in a memory file system, wherein the mapping relationship file is used to describe a mapping relationship between a volume group and a physical volume; and accessing the physical volume corresponding to the second identification information.

[0009] In the second aspect, an embodiment of the present application also provides a physical volume access device, including: an acquisition module, which is configured to obtain second identification information of the physical volume involved in executing the logical volume manager LVM command from a mapping relationship file stored in the memory file system based on the first identification information of the volume group in the currently executed LVM command, and the mapping relationship file is used to describe the mapping relationship between the volume group and the physical volume; an access module, which is configured to access the physical volume corresponding to the second identification information.

[0010] In a third aspect, an embodiment of the present application further provides a computer device, comprising a processor, a memory, a computer program stored on the memory and executable by the processor, and a data bus for implementing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the physical volume access method described in the first aspect is implemented.

[0011] In a fourth aspect, an embodiment of the present application further provides a storage medium, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the physical volume access method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0013] FIG1 is a flow chart of a physical volume access method provided in an embodiment of the present application;

[0014] FIG2 is a schematic diagram of a directory hierarchy structure of a mapping relationship file in an embodiment of the present application;

[0015] FIG3 is a flow chart of another physical volume access method provided in an embodiment of the present application;

[0016] FIG4 is a flow chart of another physical volume access method provided in an embodiment of the present application;

[0017] FIG5 is another schematic diagram of the directory hierarchy structure of the mapping relationship file in an embodiment of the present application;

[0018] FIG6 is another schematic diagram of the directory hierarchy structure of the mapping relationship file in an embodiment of the present application;

[0019] FIG7 is a schematic block diagram of a physical volume access device provided by an embodiment of the present application;

[0020] FIG8 is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0022] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined, or partially merged, so the actual execution order may vary depending on the actual situation.

[0023] It should be understood that the terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0024] The Logical Volume Manager (LVM) is a mechanism for managing disk partitions in the Linux environment. Using LVM allows users to adjust the usage of individual disk partitions without downtime, resolves issues with inflexible disk partition resizing, and allocates disk space more efficiently. LVM commands parse LVM metadata to learn how logical volumes (LVs) are created on physical volumes (PVs), and then notify the Linux kernel to create a mapping device object corresponding to the logical volume. However, executing LVM commands requires scanning and querying all block devices in the system. Therefore, the more block devices a system has, the longer it takes to directly access block devices for reading and writing, and the greater the read and write pressure on the physical volumes, resulting in slower LVM command execution and slower result return.

[0025] To at least solve the above-mentioned problems, embodiments of the present application provide a physical volume access method, apparatus, computer device, and storage medium. In the embodiments of the present application, the mapping relationship file between the volume group and the physical volume is stored in the memory file system. In this way, when executing an LVM command, based on the first identification information of the volume group in the LVM command, the mapping relationship file in the memory file system can be quickly accessed to quickly obtain the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file, and only the physical volume corresponding to the obtained second identification information is accessed, that is, only the physical volume involved in executing the LVM command is accessed. This can effectively reduce the number of times the LVM command accesses the block device in the system, reduce the time required to access the physical volume, and greatly improve the access efficiency of the physical volume and the execution efficiency of the LVM command.

[0026] The physical volume access method can be applied to a computer device to improve the efficiency of accessing a physical volume through an LVM. The computer device may include a mobile phone, a camera, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, a personal computer (PC), a netbook, a personal digital assistant (PDA), and a server. The server may be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, a content delivery network (CDN), and big data and artificial intelligence platforms.

[0027] The following embodiments of the present application are described in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.

[0028] FIG1 is a flow chart of a physical volume access method provided in an embodiment of the present application.

[0029] As shown in FIG. 1 , the physical volume access method includes steps S101 to S102 .

[0030] Step S101: According to the first identification information of the volume group in the currently executed LVM command, obtain the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system.

[0031] In this embodiment, a physical volume (PV) is at the bottom layer of the logical volume manager (LVM). It can be a partition on an actual physical hard disk or an entire physical hard disk. A volume group (VG) is created on top of a physical volume. A volume group includes at least one physical volume. After a volume group is created, physical volumes can be dynamically added to the volume group. A logical volume management system can include one or more volume groups.

[0032] The LVM command is a command for controlling the Logical Volume Manager (LVM) to perform related operations, and the LVM command is triggered by an upper-layer application. For example, the LVM command may be a command for physical volume-related operations, volume group-related operations, or logical volume-related operations. The commands for physical volume-related operations may include lvmdiskscan, pvcreate, pvs, pvscan, pvdisplay, pvchange, or pvmove, the commands for volume group-related operations may include vgcreate, vgs, vgscan, vgdisplay, vgrename, vgchange, vgmove, vgextend, or vgreduce, and the commands for logical volume-related operations may include lvcreate, lvs, lvscan, lvdisplay, lvchange, lvextend, or lvreduce.

[0033] Among them, the memory file system is a memory-based file system. The directory of the memory file system is placed in the memory, not on the disk, so that the mapping relationship file between the volume group and the physical volume can be quickly queried through the memory file system. The memory file system includes at least one of tmpfs (temporary file system), ramfs (file system based on random access memory), shmfs (shared memory file system) and hugetlbfs (memory file system based on huge pages). Before using the memory file system, the memory file system can be mounted to a preset directory in the memory. After mounting the memory file system, the memory file system can provide higher file reading, writing and access efficiency, thereby improving performance. For example, mount tmpfs to the / dev / shm directory in the memory.

[0034] In this embodiment, the mapping relationship file is a mapping relationship file between a volume group and a physical volume. The mapping relationship file is used to describe the mapping relationship between the volume group and the physical volume. The mapping relationship file includes the first identification information of the volume group, the second identification information of the physical volume, and the mapping relationship between the first identification information and the second identification information (i.e., the mapping relationship between the volume group and the physical volume). The first identification information of the volume group is used to uniquely identify the volume group. The first identification information can be the name of the volume group or the number of the volume group. The second identification information of the physical volume is used to uniquely identify the physical volume. The second identification information can include the name of the physical volume or the second identification information can include the name and access path of the physical volume. In the case where a mapping relationship file exists in the memory file system, the second identification information of the physical volume involved in executing the LVM command can be queried from the mapping relationship file through the first identification information.

[0035] In some embodiments, the mapping relationship file between the volume group and the physical volume is stored in the form of a linked list. The mapping relationship file between the volume group and the physical volume is stored in the memory in the form of a linked list, so that the second identification information of the physical volume involved in executing the LVM command can be quickly obtained through the linked list. For example, as shown in Figure 2, tmpfs is mounted on the top-level directory / dev / shm, and the mapping relationship file between volume groups and physical volumes is stored in the / dev / shm directory. The mapping relationship file includes the mapping relationship between VG_A and PV_A and PV_B (the mapping relationship between volume group A and physical volume A and physical volume B), and the mapping relationship between VG_B and PV_C and PV_D (the mapping relationship between volume group B and physical volume C and physical volume D). The physical volume link table corresponding to VG_A (volume group A) is stored in the / dev / shm / VG_A directory. The physical volume link table includes PV_Name_A_Path_A and PV_Name_B_Path_B, which means that volume group A corresponds to physical volume A and physical volume B, and the access path of physical volume A is Path_A, and the access path of physical volume B is Path_B. Similarly, the physical volume linked list corresponding to VG_B (volume group B) is stored in the directory / dev / shm / VG_B. The physical volume linked list includes PV_Name_C_Path_C and PV_Name_C_Path_C, which means that volume group B corresponds to physical volume C and physical volume D, and the access path of physical volume C is Path_C, and the access path of physical volume D is Path_D.

[0036] Step S102: Access the physical volume corresponding to the second identification information.

[0037] In this embodiment, after obtaining the second identification information of the physical volume involved in executing the LVM command, the access path of the physical volume involved in executing the LVM command can be obtained through the second identification information, and the physical volume involved in executing the LVM command can be accessed through the access path.

[0038] In one embodiment, the second identification information includes the name and access path of the physical volume involved in executing the LVM command. When the name and access path of the physical volume involved in executing the LVM command are obtained, the physical volume can be quickly accessed through the name and access path of the physical volume, which can effectively reduce the number of times the LVM command accesses the block device in the system, greatly improving the access efficiency of the physical volume and the execution efficiency of the LVM command.

[0039] For example, assuming that the first identification information is VG_B, the mapping relationship file between the volume group and the physical volume is shown in Figure 2. When executing the LVM command containing VG_B, the physical volume linked table corresponding to VG_B can be found in the directory / dev / shm / VG_B of the memory file system. The physical volume linked table corresponding to VG_B includes the name and access path of physical volume C (PV_Name_C_Path_C) and the name and access path of physical volume D (PV_Name_C_Path_C). Volume group B corresponds to physical volume C and physical volume D, and the access path of physical volume C is Path_C, and the access path of physical volume D is Path_D. In this way, when executing the LVM command containing VG_B, physical volume C can be quickly accessed through the name and access path of physical volume C, and physical volume D can be quickly accessed through the name and access path of physical volume D.

[0040] In some embodiments, as shown in FIG3 , before step S101 , the method further includes: step S103 , when the currently executed LVM command includes the first identification information of the volume group, determining whether there is a mapping relationship file between the volume group and the physical volume in the memory file system.

[0041] In this embodiment, the method for determining whether there is a mapping relationship file between the volume group and the physical volume in the memory file system can be: when the currently executed LVM command includes the first identification information of the volume group, determining whether there is a mapping relationship file between the volume group and the physical volume in a preset directory, and the memory file system is mounted under the preset directory; when there is a mapping relationship file between the volume group and the physical volume in the preset directory, determining whether there is a mapping relationship file between the volume group and the physical volume in the memory file system; when there is no mapping relationship file between the volume group and the physical volume in the preset directory, determining that there is no mapping relationship file between the volume group and the physical volume in the memory file system.

[0042] As shown in FIG3 , the method further includes: step S104 , generating a mapping relationship file between the volume group and the physical volume if no mapping relationship file exists in the memory file system, and storing the generated mapping relationship file between the volume group and the physical volume in the memory file system.

[0043] By generating a mapping relationship file between the volume group and the physical volume and storing the mapping relationship file in the memory file system when there is no mapping relationship file between the volume group and the physical volume in the memory file system, and executing step S101 when there is a mapping relationship file in the memory file system, that is, obtaining the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system according to the first identification information of the volume group in the currently executed LVM command, and then accessing the physical volume corresponding to the second identification information, the execution efficiency of the LVM command and the access efficiency of the physical volume are greatly improved.

[0044] In some embodiments, a mapping relationship file between a volume group and a physical volume may be generated by: scanning all block devices to obtain a status identifier for each block device; for each block device, if the status identifier of the block device is a first preset identifier, determining that the block device is a physical volume in a logical volume manager (LVM); if the status identifier of the block device is a second preset identifier, determining that the block device is not a physical volume in a logical volume manager (LVM); obtaining the second identification information of each determined physical volume and determining the first identification information of the volume group to which the physical volume belongs; and generating a mapping relationship file between the volume group and the physical volume based on the second identification information of each determined physical volume and the first identification information of the volume group to which each physical volume belongs. The first preset identifier and the second preset identifier may be set based on actual conditions, and the embodiments of the present application do not impose any special restrictions on this.

[0045] In some embodiments, as shown in Figure 4, before step S101, the following is also included: step S105, when the currently executed LVM command includes the first identification information of the volume group, according to the first identification information, query the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system.

[0046] For example, assuming that the first identification information is VG_B, the mapping relationship file between the volume group and the physical volume is shown in Figure 2. When the LVM command containing VG_B is executed, the mapping relationship file shown in Figure 2 is queried to see whether there is a physical volume linked table corresponding to VG_B. The physical volume linked table corresponding to VG_B can be queried in the mapping relationship file shown in Figure 2. The physical volume linked table includes the name and access path (PV_Name_C_Path_C) of physical volume C and the name and access path (PV_Name_C_Path_C) of physical volume D.

[0047] For another example, assuming that the first identification information is VG_B, the mapping relationship file between the volume group and the physical volume is shown in Figure 5. When the LVM command containing VG_B is executed, the mapping relationship file shown in Figure 5 is queried to see whether there is a physical volume linked list corresponding to VG_B. However, the physical volume linked list corresponding to VG_B is not found in the mapping relationship file shown in Figure 5, that is, the second identification information of the physical volume corresponding to VG_B cannot be queried.

[0048] As shown in Figure 4, the method also includes: step S106, when the second identification information of the physical volume involved in executing the LVM command is not queried according to the first identification information, regenerate the mapping relationship file between the volume group and the physical volume, and replace the current mapping relationship file in the memory file system with the regenerated mapping relationship file.

[0049] In this embodiment, when the second identification information of the physical volume involved in executing the LVM command is not queried, it can be known that there is an error in the current mapping relationship file. The erroneous mapping relationship file can be corrected by regenerating the mapping relationship file between the volume group and the physical volume, and replacing the current mapping relationship file in the memory file system with the regenerated mapping relationship file. This makes it convenient to quickly query the physical volume involved in executing the LVM command through the correct mapping relationship file when executing the LVM command later, thereby improving the access efficiency of the physical volume and the execution efficiency of the LVM command.

[0050] In some embodiments, when the second identification information of the physical volume involved in executing the LVM command is queried based on the first identification information, step S101 is executed, that is, based on the first identification information of the volume group in the currently executed LVM command, the second identification information of the physical volume involved in executing the LVM command is obtained from the mapping relationship file stored in the memory file system, and then the physical volume corresponding to the second identification information is accessed.

[0051] For example, assuming that the first identification information is VG_B, the mapping relationship file between the volume group and the physical volume is shown in Figure 5. When executing the LVM command containing VG_B, the physical volume linked list corresponding to VG_B cannot be queried in the mapping relationship file shown in Figure 5 based on VG_B. In this case, the mapping relationship file between the volume group and the physical volume is regenerated, and the regenerated mapping relationship file between the volume group and the physical volume is shown in Figure 6. In this way, when executing the LVM command containing VG_B, the physical volume linked list corresponding to VG_B can be queried in the mapping relationship file shown in Figure 6 based on VG_B. The physical volume linked list corresponding to VG_B includes the name and access path of physical volume C (PV_Name_C_Path_C) and the name and access path of physical volume D (PV_Name_D_Path_D).

[0052] In some embodiments, the mapping relationship file between the volume group and the physical volume can be regenerated by: obtaining the status information of each physical volume when the second identification information of the physical volume involved in executing the LVM command is not found according to the first identification information; and regenerating the mapping relationship file between the volume group and the physical volume when it is determined that each physical volume is in an activated state according to the status information of each physical volume. Wherein, when the status information of the physical volume is the first status information, it can be determined that the physical volume is in an activated state; when the status information of the physical volume is the second status information, it can be determined that the physical volume is in a lost state. By regenerating the mapping relationship file between the volume group and the physical volume when it is determined that each physical volume is in an activated state, that is, there are no inaccessible or lost physical volumes, it can be ensured that the generated mapping relationship file can contain the mapping relationships between all volume groups and physical volumes in the system. This facilitates the subsequent query of the physical volumes involved in executing the LVM command through the correct mapping relationship file when executing the LVM command, thereby improving the access efficiency of the physical volume and the execution efficiency of the LVM command.

[0053] In some embodiments, the mapping relationship file between the volume group and the physical volume can be regenerated by: obtaining status information of each physical volume when the second identification information of the physical volume involved in executing the LVM command is not found according to the first identification information; obtaining status information of the at least one physical volume at a preset interval when at least one physical volume is determined to be in a lost state according to the status information of each physical volume; and regenerating the mapping relationship file between the volume group and the physical volume when the status information of the at least one physical volume determines that the status of the at least one physical volume has changed from a lost state to an active state. The preset interval can be set based on actual conditions and is not limited in the embodiments of the present application. For example, the preset interval is 5 seconds. By periodically obtaining status information of a physical volume in a lost state when a physical volume is determined to be in a lost state, and regenerating the mapping relationship file between the volume group and the physical volume when the status of the physical volume has changed from a lost state to an active state, it can be ensured that the generated mapping relationship file contains all mapping relationships between volume groups and physical volumes in the system. This facilitates the subsequent query of the physical volumes involved in executing the LVM command through the correct mapping relationship file when executing the LVM command, thereby improving the access efficiency of the physical volumes and the execution efficiency of the LVM command.

[0054] For example, assuming that only physical volume A is in the lost state among all physical volumes, the status information of physical volume A can be obtained after 5 seconds. If it is determined based on the status information of physical volume A that physical volume A is still in the lost state, the status information of physical volume A can continue to be obtained after 5 seconds. If it is determined based on the status information of physical volume A that the lost state of physical volume A changes to the activated state, the mapping relationship file between the volume group and the physical volume can be regenerated.

[0055] The physical volume access method provided by the above embodiment, since the mapping relationship file between the volume group and the physical volume is stored in the memory file system, when executing the LVM command, the mapping relationship file in the memory file system can be quickly accessed according to the first identification information of the volume group in the LVM command, so as to quickly obtain the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file, and only access the physical volume corresponding to the obtained second identification information, that is, only access is performed on the physical volume involved in executing the LVM command. This can effectively reduce the number of times the LVM command accesses the block device in the system, reduce the time required to access the physical volume, and greatly improve the access efficiency of the physical volume and the execution efficiency of the LVM command.

[0056] FIG7 is a schematic block diagram of a physical volume access device provided in an embodiment of the present application.

[0057] As shown in Figure 7, the physical volume access device 200 includes: an acquisition module 210, which is configured to obtain second identification information of the physical volume involved in executing the LVM command from a mapping relationship file stored in the memory file system based on the first identification information of the volume group in the currently executed LVM command, and the mapping relationship file is used to describe the mapping relationship between the volume group and the physical volume; an access module 220, which is configured to access the physical volume corresponding to the second identification information.

[0058] In one embodiment, the mapping relationship file is stored in the form of a linked list.

[0059] In one embodiment, the physical volume access device 200 also includes: a determination module, which is configured to determine whether there is a mapping relationship file between the volume group and the physical volume in the memory file system when the currently executed LVM command includes the first identification information of the volume group; a file generation module, which is configured to generate a mapping relationship file between the volume group and the physical volume when the mapping relationship file does not exist in the memory file system, and store the generated mapping relationship file between the volume group and the physical volume in the memory file system.

[0060] In one embodiment, the physical volume access device 200 also includes: a query module, which is configured to query the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system according to the first identification information when the currently executed LVM command includes the first identification information of the volume group; the file generation module is also configured to regenerate the mapping relationship file between the volume group and the physical volume when the second identification information of the physical volume involved in executing the LVM command is not queried according to the first identification information; and a file replacement module is configured to replace the current mapping relationship file in the memory file system with the regenerated mapping relationship file.

[0061] In one embodiment, the file generation module is further configured to: obtain status information of each physical volume when the second identification information of the physical volume involved in executing the LVM command is not queried according to the first identification information; and regenerate the mapping relationship file between the volume group and the physical volume when it is determined according to the status information of each physical volume that each physical volume is in an activated state.

[0062] In one embodiment, the file generation module is further configured to: when it is determined based on the status information of each physical volume that at least one physical volume is in a lost state, obtain the status information of the at least one physical volume at a preset interval; when it is determined based on the status information of the at least one physical volume that the state of the at least one physical volume has changed from a lost state to an activated state, regenerate the mapping relationship file between the volume group and the physical volume.

[0063] In one embodiment, the memory file system includes at least one of tmpfs, ramfs, shmfs and hugetlbfs.

[0064] It should be noted that those skilled in the art can clearly understand that for the convenience and brevity of description, the working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned physical volume access method embodiment and will not be repeated here.

[0065] The apparatus provided in the above embodiment may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in FIG8 .

[0066] FIG8 is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.

[0067] As shown in FIG8 , a computer device 300 includes a processor 301 and a memory 302 . The processor 301 and the memory 302 are connected via a bus 303 , such as an I 2 C (Inter-Integrated Circuit) bus.

[0068] The processor 301 is used to provide computing and control capabilities to support the operation of the entire computer device. The processor 301 can be a central processing unit (CPU), 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, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0069] The memory 302 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.

[0070] Those skilled in the art will understand that the structure shown in FIG8 is merely a block diagram of a portion of the structure related to the embodiment of the present application, and does not constitute a limitation on the computer device to which the embodiment of the present application is applied. The computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0071] The processor 301 is configured to run a computer program stored in the memory 302 and implement any one of the physical volume access methods provided in the embodiments of the present application when executing the computer program.

[0072] In one embodiment, the processor 301 is configured to run a computer program stored in a memory, and implement the following steps when executing the computer program: based on the first identification information of the volume group in the currently executed LVM command, obtain the second identification information of the physical volume involved in executing the LVM command from a mapping relationship file stored in the memory file system, wherein the mapping relationship file is used to describe the mapping relationship between the volume group and the physical volume; and access the physical volume corresponding to the second identification information.

[0073] In one embodiment, the mapping relationship file is stored in the form of a linked list.

[0074] In one embodiment, before obtaining, from a mapping relationship file stored in a memory file system, the second identification information of the physical volume involved in executing the LVM command based on the first identification information of the volume group in the currently executed LVM command, the processor 301 is further configured to implement:

[0075] In a case where the currently executed LVM command includes first identification information of the volume group, it is determined whether there is a mapping relationship file between the volume group and the physical volume in the memory file system; in a case where the mapping relationship file does not exist in the memory file system, a mapping relationship file between the volume group and the physical volume is generated, and the generated mapping relationship file between the volume group and the physical volume is stored in the memory file system.

[0076] In one embodiment, before obtaining the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system based on the first identification information of the volume group in the currently executed LVM command, the processor 301 is further configured to implement: when the currently executed LVM command includes the first identification information of the volume group, query the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system based on the first identification information; when the second identification information of the physical volume involved in executing the LVM command is not queried based on the first identification information, regenerate the mapping relationship file between the volume group and the physical volume, and replace the current mapping relationship file in the memory file system with the regenerated mapping relationship file.

[0077] In one embodiment, when implementing the regeneration of the mapping relationship file between the volume group and the physical volume, the processor 301 is configured to implement: obtaining the status information of each physical volume when the second identification information of the physical volume involved in executing the LVM command is not queried according to the first identification information; and regenerating the mapping relationship file between the volume group and the physical volume when it is determined according to the status information of each physical volume that each physical volume is in an activated state.

[0078] In one embodiment, after obtaining the status information of each physical volume, the processor 301 is further configured to: obtain the status information of the at least one physical volume at a preset interval when it is determined based on the status information of each physical volume that at least one physical volume is in a lost state; and regenerate the mapping relationship file between the volume group and the physical volume when it is determined based on the status information of the at least one physical volume that the state of the at least one physical volume changes from a lost state to an activated state.

[0079] In one embodiment, the memory file system includes at least one of tmpfs, ramfs, shmfs and hugetlbfs.

[0080] It should be noted that those skilled in the art can clearly understand that for the convenience and brevity of description, the working process of the computer device described above can refer to the corresponding process in the aforementioned physical volume access method embodiment, and will not be repeated here.

[0081] An embodiment of the present application further provides a storage medium storing one or more programs, which can be executed by one or more processors to implement any physical volume access method provided in the embodiment of the present application.

[0082] The storage medium may be an internal storage unit of the computer device described in the aforementioned embodiment, such as a hard disk or memory of the computer device. The storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device.

[0083] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable, and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0084] It should be understood that the term "and / or" used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system that includes a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system that includes the element.

[0085] The above is merely an exemplary embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and such modifications or substitutions should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A physical volume access method, include: According to first identification information of a volume group in a currently executed logical volume manager (LVM) command, second identification information of a physical volume involved in executing the LVM command is obtained from a mapping relationship file stored in a memory file system, wherein the mapping relationship file is used to describe a mapping relationship between a volume group and a physical volume; Access the physical volume corresponding to the second identification information.

2. The physical volume access method according to claim 1, in, The mapping relationship file is stored in the form of a linked list.

3. The physical volume access method according to claim 1, in, Before obtaining the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system according to the first identification information of the volume group in the currently executed LVM command, the method further includes: In a case where the currently executed LVM command includes the first identification information of the volume group, determining whether there is a mapping relationship file between the volume group and the physical volume in the memory file system; In the case that the mapping relationship file does not exist in the memory file system, a mapping relationship file between the volume group and the physical volume is generated, and the generated mapping relationship file between the volume group and the physical volume is stored in the memory file system.

4. The physical volume access method according to any one of claims 1 to 3, in, Before obtaining the second identification information of the physical volume involved in executing the LVM command from the mapping relationship file stored in the memory file system according to the first identification information of the volume group in the currently executed LVM command, the method further includes: In a case where the currently executed LVM command includes first identification information of the volume group, querying second identification information of the physical volume involved in executing the LVM command from a mapping relationship file stored in the memory file system according to the first identification information; If the second identification information of the physical volume involved in executing the LVM command is not found according to the first identification information, the mapping relationship file between the volume group and the physical volume is regenerated, and the current mapping relationship file in the memory file system is replaced with the regenerated mapping relationship file.

5. The physical volume access method according to claim 4, in, The regenerating the mapping relationship file between the volume group and the physical volume includes: If the second identification information of the physical volume involved in executing the LVM command is not found according to the first identification information, obtaining status information of each physical volume; When it is determined according to the status information of each physical volume that each physical volume is in an activated state, a mapping relationship file between the volume group and the physical volume is regenerated.

6. The physical volume access method according to claim 5, in, After obtaining the status information of each physical volume, the method further includes: When it is determined according to the status information of each physical volume that at least one physical volume is in a lost state, acquiring the status information of the at least one physical volume at a preset interval; When it is determined according to the status information of the at least one physical volume that the status of the at least one physical volume changes from the lost status to the activated status, a mapping relationship file between the volume group and the physical volume is regenerated.

7. The physical volume access method according to any one of claims 1 to 3, in, The memory file system includes at least one of a temporary file system (tmpfs), a random access memory-based file system (ramfs), a shared memory file system (shmfs), and a huge page-based memory file system (hugetlbfs).

8. A physical volume access device, include: an acquisition module configured to obtain, according to first identification information of a volume group in a currently executed LVM command, second identification information of a physical volume involved in executing the LVM command from a mapping relationship file stored in a memory file system, wherein the mapping relationship file is used to describe a mapping relationship between a volume group and a physical volume; An access module is configured to access the physical volume corresponding to the second identification information.

9. A computer device comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of the physical volume access method as described in any one of claims 1 to 7 are realized.

10. A storage medium, in, The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the physical volume access method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Need-based increment recovery disaster-containing system and method based on virtual machine

    CN101414277A

  • Hierarchical memory system and logical volume management method thereof

    CN101840308A

  • Method for storing file and mobile terminal

    CN106775488A

  • Persistent volume allocation method and device, computer equipment and storage medium

    CN111966305A

  • Method and device for quickly compiling program, electronic equipment and storage medium

    CN113485713A

Cited By

  • Method, device and equipment for converting data partition into LVM (Logical Volume Module) logical volume, medium and program

    CN122412370A