Capacity expansion method, electronic equipment and computer readable storage medium

文档序号:7114 发布日期:2021-09-17 浏览:32次 中文

1. A capacity expansion method is characterized by comprising the following steps:

detecting the utilization rate of a storage pool, wherein the storage pool is provided with a thin provisioning function;

if the utilization rate of the storage pool exceeds a utilization rate threshold, at least part of storage space of the expansion storage medium is divided into the storage pool so as to expand the storage pool.

2. The method of claim 1, further comprising, after said dividing at least a portion of the storage space of the expanded storage media into the storage pool:

continuously detecting the utilization rate of the storage pool;

when detecting that the duration time of the current usage space of the storage pool lower than a space threshold reaches a time threshold according to the usage rate of the storage pool, judging whether the storage space belonging to the extended storage media in the storage pool is already allocated for use, wherein the space threshold is the product of the total capacity of the storage pool before capacity expansion and the usage rate threshold;

and if the storage pool is not allocated for use, moving the storage space belonging to the extended storage medium in the storage pool out of the storage pool so as to reduce the capacity of the storage pool.

3. The method of claim 2, further comprising:

if the storage pool is judged to be allocated for use, migrating the data in the storage space belonging to the expansion storage medium in the storage pool to the main storage medium in the storage pool before the expansion;

if the usage space of the storage pool exceeds the space threshold value in the migration process, stopping the migration, and returning to execute the step of continuously detecting the usage rate of the storage pool;

and if the used space of the storage pool does not exceed the space threshold after the migration is completed, moving the storage space belonging to the extended storage medium in the storage pool out of the storage pool so as to reduce the capacity of the storage pool.

4. The method of claim 3, wherein the step of migrating the data in the storage space belonging to the extended storage media in the storage pool to the primary storage media in the storage pool before the expansion comprises:

and when the read-write frequency of the storage pool is lower than a frequency threshold, migrating the data in the storage space belonging to the expansion storage medium in the storage pool to the main storage medium in the storage pool before the expansion.

5. The method of claim 3, wherein the step of migrating the data in the storage space belonging to the extended storage media in the storage pool to the primary storage media in the storage pool before the expansion comprises:

and migrating the data in the storage space belonging to the extended storage medium in the storage pool to the main storage medium in the storage pool before capacity expansion according to the block size of the storage pool.

6. The method of claim 1, further comprising, after said dividing at least a portion of the storage space of the expanded storage media into the storage pool:

when receiving the storage data, allocating a storage space for the storage data from the main storage medium in the storage pool before capacity expansion until the storage space of the main storage medium in the storage pool before capacity expansion is used up, and then allocating a storage space for the storage data from the storage space belonging to the extended storage medium in the storage pool.

7. The method of claim 1, wherein the step of partitioning at least a portion of the storage space of the expanded storage media into the storage pool comprises:

acquiring the total capacity of the storage pool;

and dividing a storage space with a preset size in the extended storage medium into the storage pool, so that the proportion of the product of the total capacity of the storage pool and the utilization rate threshold to the total capacity of the storage pool after capacity expansion is a preset proportion.

8. The method of claim 1, further comprising, after said dividing at least a portion of the storage space of the expanded storage media into the storage pool:

updating the usage threshold;

and returning to the step of detecting the utilization rate of the storage pool.

9. An electronic device, comprising a processor, a memory and a communication circuit, wherein the processor is coupled to the memory and the communication circuit, respectively, and the memory stores program data, and the processor executes the program data in the memory to implement the steps of the method according to any one of claims 1-8.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executable by a processor to implement the steps in the method according to any one of claims 1-8.

Background

The storage pool is a block storage space composed of physical hard disks or RAID equipment, manual capacity expansion is generally needed when the size of the storage pool is insufficient in the prior art, an early warning threshold value is set for the utilization rate of the storage pool, and a user performs manual capacity expansion when the utilization rate of the storage pool exceeds the early warning threshold value for warning, but the technical scheme has the following defects: when the usage amount of the storage space of the service program changes rapidly, the user may not be able to expand the capacity of the storage pool in time, which is likely to cause problems such as service interruption or data loss.

Disclosure of Invention

The present application mainly solves the technical problem of providing a capacity expansion method, an electronic device, and a computer-readable storage medium, which can implement automatic capacity expansion to avoid the problem of service interruption or data loss caused by untimely manual capacity expansion.

In order to solve the technical problem, the application adopts a technical scheme that: providing a capacity expansion method, wherein the capacity expansion method comprises the following steps: detecting the utilization rate of a storage pool, wherein the storage pool is provided with a thin provisioning function; if the utilization rate of the storage pool exceeds a utilization rate threshold, at least part of storage space of the expansion storage medium is divided into the storage pool so as to expand the storage pool.

In order to solve the above technical problem, another technical solution adopted by the present application is: there is provided an electronic device comprising a processor, a memory and a communication circuit, wherein the processor is coupled to the memory and the communication circuit respectively, the memory stores program data therein, and the processor implements the steps of the above method by executing the program data in the memory.

In order to solve the above technical problem, another technical solution adopted by the present application is: there is provided a computer readable storage medium having stored thereon a computer program executable by a processor to perform the steps of the above method.

The beneficial effect of this application is: according to the method and the device, when the utilization rate of the storage pool exceeds the utilization rate threshold value, at least part of storage space of the expansion storage medium is automatically drawn into the storage pool to increase the total capacity of the storage pool, so that the whole expansion process does not need manual participation, and compared with manual expansion, the method in the application has stronger timeliness, and can avoid the problem of service interruption or data loss caused by untimely manual expansion.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:

FIG. 1 is a schematic flow chart diagram illustrating an embodiment of a capacity expansion method according to the present application;

FIG. 2 is a schematic structural diagram of an embodiment of an electronic device of the present application;

FIG. 3 is a schematic flow chart diagram illustrating another embodiment of a capacity expansion method according to the present application;

FIG. 4 is a schematic flow chart diagram illustrating a capacity expansion method according to another embodiment of the present application;

FIG. 5 is a schematic structural diagram of an embodiment of an electronic device of the present application;

FIG. 6 is a schematic diagram of another embodiment of an electronic device;

FIG. 7 is a schematic structural diagram of an embodiment of a computer-readable storage medium according to the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

It should be noted that, the capacity expansion method of the present application is applied to the technical field of data storage, including but not limited to SAN storage, NAS storage, cloud storage, and the like.

Referring to fig. 1, fig. 1 is a schematic flow chart diagram of an embodiment of a capacity expansion method of the present application, where the method includes:

s110: the usage rate of the storage pool is detected.

With reference to fig. 2, a storage medium (hard disk or RAID) in the storage pool before capacity expansion is defined as a primary storage medium, where the number of the primary storage medium in the storage pool before capacity expansion may be one or multiple, that is, a storage pool is created by a certain number of primary storage media, and a user may create a logical volume (LUN) in the storage pool, where the number of the logical volume may be one or multiple, and when the number of the logical volume is multiple, the sizes of the multiple logical volumes may be the same or different.

Meanwhile, the storage pool is provided with an automatic reduction function, the automatic reduction function is a storage management characteristic based on a logical volume, and the core principle is to deceive an operating system, so that the operating system considers that the storage pool has a large storage space, and the actual physical storage space is not so large. For example, after the thin auto-reduce function is deployed, a storage pool may display 2TB of logical space, while only hundreds of GB of physical space may actually be allocated. In addition to the operating system, applications also consider there to be a lot of storage space left, although most of it is virtualized. As more and more applications write, the physical storage utilization of the storage pool will also increase. After the storage pool is configured with the automatic compaction function, the phenomenon that a large amount of space is idle but cannot be used is avoided.

In short, after a storage pool is configured with a thin provisioning function, the total space (logical space) size of multiple logical volumes may exceed the actual space (physical space) size of the storage pool.

Meanwhile, the storage pool supports the discard/trim function, and can sense and effectively recycle the storage space corresponding to the deleted file of the upper-layer service program, so that the storage space actually used by the logical volume can be dynamically increased or dynamically reduced.

In the prior art, when the thin provisioning function is not used in the storage pool, the size of the logical volume space actually used by the user is determined before the storage pool is used, and the total capacity does not exceed the size of the storage pool, so that the logical volume can be manually expanded when the logical volume creation fails due to insufficient space. However, in the case of using the thin provisioning function, the size of the physical space actually used by the plurality of logical volumes is dynamically changed, and the total capacity of the storage pool may be exceeded during operation of the service.

In order to deal with the above situation, in the prior art, an early warning threshold is set for the usage rate of the storage pool, and when the usage rate of the storage pool exceeds the threshold, the user performs manual expansion, but the technical scheme has the following defects: when the usage amount of the storage space of the service program changes rapidly, the user may not be able to expand the capacity of the storage pool in time, which is likely to cause problems such as service interruption or data loss.

Therefore, in order to avoid the above drawbacks, the present application discloses a capacity expansion method, and with reference to fig. 1, step S120 is performed after step S110 is performed.

S120: it is determined whether the usage of the storage pool exceeds a usage threshold.

If the result exceeds the predetermined value, the process proceeds to step S130, and if the result does not exceed the predetermined value, the process returns to step S110.

The usage threshold is preset, for example, 80%, 90%, etc., and when the usage of the storage pool exceeds the usage threshold, it indicates that there is a risk that the usage of the plurality of logical volumes exceeds the actual storage space of the storage pool, and at this time, the capacity of the storage pool needs to be expanded, so the process proceeds to step S130, whereas when the usage of the storage pool does not exceed the usage threshold, the process returns to step S110, i.e., the usage of the storage pool continues to be detected.

S130: at least a portion of the storage space of the expanded storage media is moved into the storage pool to expand the storage pool.

Specifically, at this time, at least part of the storage space of the expansion storage medium is automatically allocated into the storage pool to increase the total capacity of the storage pool, so that the whole expansion process does not need manual participation, and compared with manual expansion, the method in the application has stronger timeliness, and can avoid the problem of service interruption or data loss caused by untimely manual expansion.

The expansion storage medium may be a physical hard disk or a RAID.

In step S130, all the storage space of the extended storage medium may be divided into the storage pool, or a part of the storage space of the extended storage medium may be divided into the storage pool.

For example, in an application scenario, step S130 specifically includes: acquiring the total capacity of a storage pool; and dividing a storage space with a preset size in the expanded storage medium into the storage pool so as to enable the proportion of the product of the total capacity of the storage pool before expansion and the utilization rate threshold value to the total capacity of the storage pool after expansion to be a preset proportion. For better understanding, specific examples are given here: if the total capacity of the storage pool before capacity expansion is 1T, the usage threshold is 80%, and the preset ratio is 0.5, then step S130 needs to allocate a storage space of 0.6T in the extended storage medium into the storage pool at this time.

The capacity expansion method in this embodiment is applicable to any electronic device with a storage function, and is not limited herein, and the capacity expansion method in this embodiment is executed by a management module in the electronic device.

Meanwhile, the management module in the electronic device may perform steps S110 to S130 for multiple storage pools at the same time, and the management module may allocate different storage spaces in one extended storage medium into different storage pools, that is, one extended storage medium may expand the storage pools for multiple storage pools at the same time, for example, in fig. 2, when both the storage pool a and the storage pool B need to expand the storage pool, the management module may allocate two different storage spaces from the extended storage medium to join the storage pool a and the storage pool B, respectively, so as to achieve expansion of the storage pool a and the storage pool B at the same time.

In an application scenario, after the storage pool is expanded, the physical space mapped by the logical volume is preferentially allocated from the main storage medium in the storage pool before the expansion, and then allocated from the storage space belonging to the extended storage medium in the storage pool. That is, when the storage data is received, the storage space is allocated for the storage data from the main storage medium in the storage pool before capacity expansion until the storage space of the main storage medium in the storage pool before capacity expansion is used up, and then the storage space is allocated for the storage data from the storage space belonging to the extended storage medium in the storage pool.

In other application scenarios, after capacity expansion of the storage pool, the physical space mapped by the logical volume may also be randomly allocated from the primary storage medium in the storage pool before capacity expansion and the extended storage medium in the storage pool. That is, when the storage data is received, the storage space is randomly allocated for the storage data from the expanded storage pool.

Referring to fig. 3, fig. 3 is a schematic flow chart of another embodiment of the capacity expansion method of the present application. The method comprises the following steps:

s210: the usage rate of the storage pool is detected.

S220: it is determined whether the usage of the storage pool exceeds a usage threshold.

If the result exceeds the predetermined value, the process proceeds to step S230, and if the result does not exceed the predetermined value, the process returns to step S210.

S230: at least a portion of the storage space of the expanded storage media is moved into the storage pool to expand the storage pool.

S240: the usage threshold is updated.

After step S240 is executed, the process returns to step S210.

Steps S210 to S230 correspond to steps S110 to S130 in the foregoing embodiment, and reference may be made to the foregoing embodiment for details, which are not described herein again.

Specifically, unlike the above embodiments, the present embodiment may expand the storage pool multiple times.

In an application scenario, for the same storage pool, the same extended storage media may be used for multiple capacity expansion of the storage pool, or multiple different extended storage media may be used for multiple capacity expansion of the storage pool.

In an application scenario, assuming that the total capacity of the storage pool before capacity expansion is C1 and the usage threshold is P1, step S230 allocates the storage space with the capacity of E1 in the expanded storage medium into the storage pool, after capacity expansion, the usage threshold is updated as:

in other application scenarios, the usage threshold may not be updated before returning to step S210, for example, the usage threshold is always kept at 80%.

Referring to fig. 4, fig. 4 is a schematic flow chart diagram illustrating another embodiment of the capacity expansion method according to the present application. The method comprises the following steps:

s301: the usage rate of the storage pool is detected.

S302: it is determined whether the usage of the storage pool exceeds a usage threshold.

If the result exceeds the predetermined value, the process proceeds to step S303, and if the result does not exceed the predetermined value, the process returns to step S301.

S303: at least a portion of the storage space of the expanded storage media is moved into the storage pool to expand the storage pool.

Steps S301 to S303 are the same as steps S110 to S130 in the foregoing embodiment, and reference may be made to the foregoing embodiment for details, which are not described herein again.

S304: and continuously detecting the utilization rate of the storage pool.

S305: it is determined whether the duration of time that the current usage space of the storage pool is below the space threshold has reached a time threshold.

If yes, the process proceeds to step S306, and if not, the process returns to step S304.

Specifically, the current usage space of the storage pool is equal to the product of the current total capacity of the storage pool and the current usage rate, and the space threshold is the product of the total capacity of the storage pool before capacity expansion and the usage rate threshold.

When the current usage space of the storage pool is lower than the space threshold, it indicates that the storage space of the storage pool before capacity expansion can also meet the current storage demand, and the storage pool at this time has a situation of waste of storage space, so when the duration of the current usage space of the storage pool lower than the space threshold reaches a time threshold (e.g. 1 hour, 2 hours, etc.), whether to perform the capacity reduction step next is considered.

S306: it is determined whether storage space in the storage pool that belongs to the expanded storage media has been allocated for use.

If the usage is already allocated, the process proceeds to step S307, and if the usage is not allocated, the process proceeds to step S310.

Specifically, if the storage space belonging to the extended storage medium in the storage pool is not allocated for use, step S310 is directly performed, that is, the storage space belonging to the extended storage medium in the storage pool is directly moved out of the storage pool. If the storage space belonging to the extended storage medium in the storage pool has already been allocated for use, step S307 is performed.

S307: and migrating the data in the storage space belonging to the expansion storage medium in the storage pool to the main storage medium in the storage pool before the expansion.

S308: it is determined whether the usage space of the storage pool exceeds a space threshold before the migration is complete.

If the determination result is that the spatial threshold is exceeded, the process proceeds to step S309, and if the determination result is that the spatial threshold is not exceeded, the process proceeds to step S310.

If it is detected that the usage space of the storage pool exceeds the space threshold in the migration process, it indicates that new data is stored in the storage pool in the migration process, and at this time, the storage space of the storage pool before capacity expansion cannot meet the current storage requirement, the migration process is interrupted, i.e., step S309 is entered, and if it is not detected that the usage space of the storage pool exceeds the space threshold before the migration is completed, the storage space belonging to the extended storage medium in the storage pool is moved out of the storage pool after the data migration is completed, i.e., step S310 is executed.

S309: the migration is stopped.

S310: storage space in the storage pool that belongs to the expanded storage media is moved out of the storage pool.

Unlike the above embodiments, in the present embodiment, since the storage pool supports the discard/trim function, the space utilization rate may be reduced at any time, and therefore, after capacity expansion, capacity reduction processing is performed on the expanded storage pool when a certain condition is satisfied, so that effective use of the expanded storage medium is improved, and waste of the storage space is minimized.

In another embodiment, when it is determined in step S306 that the storage space belonging to the extended storage medium in the storage pool has been allocated for use, the data migration may not be performed, that is, steps S307, S308, and S309 may not be performed, and the process may directly return to step S304. That is, at this time, the capacity reduction is performed only when the storage space belonging to the extended storage medium in the storage pool is not allocated for use.

In an application scenario, in order to reduce the impact of data migration on service performance, after determining that the storage space belonging to the extended storage medium in the storage pool has been allocated for use in step S306, when the read-write frequency (I/O frequency) of the storage pool is lower than a frequency threshold, data in the storage space belonging to the extended storage medium in the storage pool may be migrated to the main storage medium in the pre-expansion storage pool.

Specifically, after determining that the storage space belonging to the extended storage medium in the storage pool has been allocated for use in step S306, it is determined whether the current read-write frequency of the storage pool is lower than a frequency threshold, if so, the data in the storage space belonging to the extended storage medium in the storage pool is migrated to the main storage medium in the storage pool before the extension, if not, the waiting is continued, and when waiting until the current read-write frequency of the storage pool is lower than the frequency threshold, the data in the storage space belonging to the extended storage medium in the storage pool before the extension is migrated to the main storage medium in the storage pool before the extension.

It should be noted that, if the currently used space in the storage pool is higher than the space threshold in the process of waiting for the current read-write frequency of the storage pool to be lower than the frequency threshold, the process returns to execute step S304.

And simultaneously, when data migration is carried out, data in the storage space belonging to the expansion storage medium in the storage pool is migrated to the main storage medium in the storage pool before capacity expansion according to the block size of the storage pool.

Specifically, when data migration is performed, data to be migrated is first divided into multiple data shares, wherein the size of each data share is equal to the block size of the storage pool, and then the multiple data shares are migrated.

Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of an electronic device according to the present application. The electronic device 200 includes a processor 210, a memory 220, and a communication circuit 230, wherein the processor 210 is coupled to the memory 220 and the communication circuit 230, respectively, the memory 220 stores program data, and the processor 210 executes the program data in the memory 220 to implement the steps in the capacity expansion method according to any of the above embodiments, wherein detailed steps may refer to the above embodiments and are not described herein again.

The electronic device 200 may be any device with a storage capability, and is not limited herein.

In this embodiment, when the usage rate of the internal storage pool exceeds the usage rate threshold, the electronic device 200 automatically allocates at least a part of the storage space of the extended storage medium into the storage pool to increase the total capacity of the storage pool, so that the whole capacity expansion process does not need manual participation, and compared with manual capacity expansion, the timeliness is higher, and the problem of service interruption or data loss caused by untimely manual capacity expansion can be avoided.

Referring to fig. 6, fig. 6 is a schematic structural diagram of another embodiment of the electronic device of the present application. The electronic device 300 includes a management module 310.

The management module 310 is configured to detect a usage rate of the storage pool configured with the thin provisioning function, and when the usage rate of the storage pool exceeds a usage rate threshold, allocate at least a portion of the storage space of the extended storage media into the storage pool, so as to expand the storage pool.

In an embodiment, the management module 310 is further configured to continue to detect the usage rate of the storage pool after the storage pool is expanded, determine whether the storage space in the storage pool belonging to the extended storage medium is already allocated for use when it is detected that the duration of the current usage space of the storage pool being lower than the space threshold reaches the time threshold according to the usage rate of the storage pool, and then move the storage space in the storage pool belonging to the extended storage medium out of the storage pool to reduce the storage pool if the management module 310 determines that the storage space in the storage pool belonging to the extended storage medium is not allocated for use. The space threshold is the product of the total capacity of the storage pool before capacity expansion and the utilization rate threshold.

In an embodiment, the management module 310 is further configured to, when storage spaces belonging to the extended storage media in the storage pools have been allocated for use, migrate data in the storage spaces belonging to the extended storage media in the storage pools to the main storage media in the storage pools before expansion, stop migration and continue to detect usage rates of the storage pools if the management module 310 detects that usage spaces in the storage pools exceed a space threshold during migration, and move the storage spaces belonging to the extended storage media in the storage pools out of the storage pools by the management module 310 to reduce the storage volumes after migration is completed and usage spaces in the storage pools that are not detected exceed the space threshold.

In an embodiment, the management module 310 is specifically configured to, when the read-write frequency of the storage pool is lower than a frequency threshold, migrate data in the storage space belonging to the extended storage medium in the storage pool to the main storage medium in the pre-expansion storage pool.

In one embodiment, the management module 310 is specifically configured to migrate data in a storage space belonging to an expanded storage medium in a storage pool to a primary storage medium in a storage pool before capacity expansion according to a block size of the storage pool.

In one embodiment, after the capacity of the storage pool is expanded, when the storage data is received, the management module 310 allocates a storage space for the storage data from the main storage medium in the storage pool before the capacity expansion until the storage space of the main storage medium in the storage pool before the capacity expansion is used up, and then allocates a storage space for the storage data from the storage space belonging to the extended storage medium in the storage pool.

In an embodiment, the management module 310 is specifically configured to: acquiring the total capacity of a storage pool; and dividing a storage space with a preset size in the expanded storage medium into the storage pool so that the proportion of the product of the total capacity of the storage pool and the utilization rate threshold to the total capacity of the expanded storage pool is a preset proportion.

In one embodiment, the management module 310 updates the usage threshold after the storage pool is expanded, and continues to monitor the usage of the storage pool.

In this embodiment, when the usage rate of the internal storage pool exceeds the usage rate threshold, the electronic device 300 automatically allocates at least a part of the storage space of the extended storage medium into the storage pool to increase the total capacity of the storage pool, so that the whole capacity expansion process does not need manual participation, and compared with manual capacity expansion, the timeliness is higher, and the problem of service interruption or data loss caused by untimely manual capacity expansion can be avoided.

Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of a computer-readable storage medium according to the present application. The computer-readable storage medium 400 stores a computer program 410, the computer program 410 being executable by a processor to implement the steps of any of the methods described above.

The computer-readable storage medium 400 may be a device that can store the computer program 410, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, or may be a server that stores the computer program 410, and the server may send the stored computer program 410 to another device for operation, or may self-operate the stored computer program 410.

In summary, when the usage rate of the storage pool exceeds the usage rate threshold, at least part of the storage space of the extended storage medium is automatically allocated into the storage pool to increase the total capacity of the storage pool, so that the whole capacity expansion process does not need manual participation.

The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种在安卓系统上实现存储加速的方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类