File system repair method, device and computing equipment

By detecting repair snapshots of the file system and using snapshots to roll back data, the destructive problems of file system repair operations in the prior art are solved, and the fault tolerance and reversibility of the repair process are improved.

CN114443357BActive Publication Date: 2025-04-15RUIJIE NETWORKS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111583198.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-22
Publication Date
2025-04-15
Estimated Expiration
2041-12-22

AI Technical Summary

Technical Problem

In the prior art, file system repair operations are destructive repairs. If the repair fails, it may lead to damage to the damaged site and the losses are immeasurable.

Method used

By detecting whether the file system has a corresponding repair snapshot, if so, call the corresponding repair tool for repair. When the repair fails, roll back the data to the data recorded in the repair snapshot. If there is no repair snapshot, create a repair snapshot before repairing it.

Benefits of technology

Improves fault tolerance of the file system repair process, ensuring that the file system can be restored to the pre-failure state when repair fails, and avoids damage to the damaged site.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443357B_ABST
    Figure CN114443357B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a file system repair method, device and computing device. The file system repair method includes: when a file system failure is detected, determining whether the file system has a corresponding repair snapshot; when the file system has a corresponding repair snapshot, calling a repair tool corresponding to the file system to repair the file system; when the repair tool fails to repair the file system, rolling back the data in the file system to the data recorded in the repair snapshot. The technical solution provided by the embodiment of the present invention achieves the technical effect of improving the fault tolerance of file system repair.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of distributed storage technology, and in particular to a file system repair method, device and computing equipment. Background Art

[0002] Distributed storage is a data storage technology that can use the disk space on each storage device in the storage environment through the network, and form these scattered storage resources into a virtual storage device, namely a resource pool, so that data is stored in various corners.

[0003] The resource pool includes multiple cloud hard disks. When the file system of the cloud hard disk is damaged, it may cause business blockage. In serious cases, it may even cause cloud service interruption, causing immeasurable losses to users.

[0004] In the related art, manual intervention is usually performed to manually restore the file system or data.

[0005] The inventors discovered during the process of implementing the concept of the present invention that such repair operations in the related art are all destructive repairs. If the repair fails, it will cause damage to the damaged site and the loss will be immeasurable. Summary of the invention

[0006] The embodiments of the present invention provide a file system repair method, apparatus and computing device to achieve the invention purpose of improving the fault tolerance of a file system repair process.

[0007] In a first aspect, an embodiment of the present invention provides a file system repair method, comprising:

[0008] When a file system failure is detected, determining whether the file system has a corresponding repair snapshot;

[0009] In the case where the file system has a corresponding repair snapshot, calling a repair tool corresponding to the file system to repair the file system;

[0010] In the case where the repair tool fails to repair the file system, the data in the file system is rolled back to the data recorded in the repair snapshot.

[0011] Further, the repair snapshot has a timestamp corresponding to the time when the file system failure was detected;

[0012] The step of rolling back the data in the file system to the data recorded in the repair snapshot includes:

[0013] Based on the timestamp, data generated after the timestamp in the file system is deleted.

[0014] Furthermore, in the case that the file system does not have a corresponding repair snapshot, the method further includes:

[0015] Obtain resource information of the file system;

[0016] A repair snapshot is created for the file system according to the resource information.

[0017] Further, the resource information represents a storage location of the file system in the distributed storage framework;

[0018] The creating a repair snapshot for the file system according to the resource information includes:

[0019] Obtaining an operation identifier from a configuration center, and generating a timestamp corresponding to a time when the file system failure is detected;

[0020] At the storage location of the representation of the resource information, the repair snapshot is created according to the operation identifier and the timestamp.

[0021] Furthermore, after the repair tool completes repairing the file system, the method further includes:

[0022] Mounting the cloud hard disk corresponding to the file system;

[0023] If the mounting is successful, the operation identifier is deleted from the configuration center; otherwise, the operation identifier is retained in the configuration center.

[0024] Further, the repair snapshot is named according to a preset naming rule;

[0025] The method further comprises:

[0026] Based on the preset naming rule, determining a repair snapshot from the plurality of snapshots of the file system;

[0027] Determine a matching relationship between the operation identifier of the repair snapshot and the operation identifier stored in the configuration center;

[0028] When the matching relationship indicates that the operation identifier does not exist in the configuration center, the repair snapshot corresponding to the operation identifier is deleted.

[0029] Further, deleting the repair snapshot corresponding to the operation identifier includes:

[0030] Determining whether the repair snapshot satisfies a deletion condition based on a timestamp of the repair snapshot;

[0031] If the repair snapshot meets the deletion condition, the repair snapshot is deleted.

[0032] Furthermore, after the repair tool completes repairing the file system, the method further includes:

[0033] Based on the repair result, prompt information is sent to the user, wherein the prompt information is used to characterize the failure condition of the file system and the repair result.

[0034] In a second aspect, an embodiment of the present invention provides a file system repair device, comprising:

[0035] A first determination module, configured to determine whether the file system has a corresponding repair snapshot when a file system failure is detected, wherein the file system includes a file system in a distributed storage framework;

[0036] a calling module, configured to call a repair tool corresponding to the file system to repair the file system if the file system has a corresponding repair snapshot;

[0037] The snapshot rollback module is used to roll back the data in the file system to the data recorded in the repair snapshot when the repair tool fails to repair the file system.

[0038] In a third aspect, an embodiment of the present invention provides a computing device, including a processing component and a storage component;

[0039] The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component;

[0040] The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the file system repair method provided by the embodiment of the present invention.

[0041] In a third aspect, an embodiment of the present invention provides a computer storage medium storing a computer program, which, when executed by a computer, implements the file system repair method provided by an embodiment of the present invention.

[0042] In an embodiment of the present invention, when a file system failure is detected, it is first determined whether the file system has a corresponding repair snapshot. When the file system has a corresponding repair snapshot, a repair tool corresponding to the file system is called to repair the file system. When the repair tool fails to repair the file system, the repair snapshot is used to roll back the data in the file system to the data recorded in the repair snapshot, thereby achieving a technical effect of increasing the fault tolerance of repair failures, and when necessary, the file system can be restored to the fault site, thereby achieving reversible repair.

[0043] These and other aspects of the present invention will become more apparent from the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0045] Figure 1 A flowchart of a file system repair method provided by an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of rolling back a file system based on a repair snapshot is exemplarily shown;

[0047] Figure 3 A schematic structural diagram of an embodiment of a file system repair device provided by the present invention is shown;

[0048] Figure 4 A schematic structural diagram of another embodiment of a file system repair device provided by the present invention is shown;

[0049] Figure 5 A schematic diagram of the structure of another electronic device provided by this embodiment. DETAILED DESCRIPTION

[0050] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] The file system repair method provided in the embodiment of the present invention can be executed by an electronic device, which can be a terminal device such as a PC, a laptop, etc., or a server. The server can be a physical server, or a virtual server. The server can be a physical or virtual server on the user side, or a cloud server.

[0052] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.

[0053] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0054] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0055] For example, terms may include:

[0056] Distributed storage: Distributed storage is a data storage technology that uses the disk space on each machine in the enterprise through the network and forms these distributed storage resources into a virtual storage device. Data is stored in various corners of the enterprise.

[0057] Cluster: A collection of physical resources corresponding to a distributed storage. From the perspective of physical resources, this collection of physical resources is a combination of servers including hard disks.

[0058] Node: A basic member of a cluster. A node usually refers to a server that contains several hard disks for distributed storage of components.

[0059] Storage pool: A storage pool is a logical concept in a distributed storage pool. It can be regarded as a collection of logical resources for a specific purpose, and its members are cloud hard disks.

[0060] Cloud hard disk (volume): A logical volume based on distributed storage allocation processing, equivalent to a physical disk, except that its actual storage space is in distributed storage.

[0061] Snapshot: A fully available copy of a specified data set, which includes an image of the corresponding data at a certain point in time (the point in time when the copy starts). A snapshot can be a copy of the data it represents, or a replica of the data. The main function of a snapshot is to enable online data backup and recovery. When an application failure or file corruption occurs on a storage device, data can be quickly restored to the state at a certain available point in time. Another function of a snapshot is to provide storage users with another data access channel. When the original data is being processed by an online application, users can access the snapshot data and use the snapshot for testing and other tasks. For all storage systems, regardless of high, medium or low-end, snapshots become an indispensable function as long as they are applied to online systems.

[0062] Configuration center: When applications are started and running, they often need to read some configuration information. Configuration basically accompanies the entire life cycle of the application, such as database connection parameters, startup parameters, etc. The configuration center is a basic service component that manages the configuration of various applications in a unified manner. It stores the configuration files of various applications. In a cluster, the configuration in the configuration center can be accessed from any access point, regardless of the access point environment. The configuration center is the basic business of a cluster environment and needs to maintain absolute security and uniqueness.

[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0064] Figure 1 A flowchart of a file system repair method provided by an embodiment of the present invention is as follows: Figure 1 As shown, the file system repair method may include the following steps:

[0065] 101 . When a file system failure is detected, determine whether the file system has a corresponding repair snapshot.

[0066] According to an embodiment of the present invention, the file system may be a file system in a distributed storage system, wherein the distributed storage system may include multiple cloud hard disks, and at least one file system may be deployed in each cloud hard disk.

[0067] According to an embodiment of the present invention, when a cloud hard disk loses power abnormally or the hard disk medium corresponding to the cloud hard disk is damaged, the file system deployed in the cloud hard disk may fail, such as causing the data in the file system to be unable to be read normally, etc., which puts the user's data stored in the cloud hard disk at risk. Therefore, in this case, the file system needs to be repaired.

[0068] According to an embodiment of the present invention, the repair snapshot may include a snapshot used only for rolling back the file system when the file system repair fails.

[0069] According to an embodiment of the present invention, when creating a repair snapshot, the repair snapshot can be named based on a preset naming rule so as to distinguish the repair snapshot from snapshots for other purposes. When a file system failure is detected, it can be determined whether the file system has a corresponding repair snapshot by traversing and reading the snapshot name of each snapshot of the file system.

[0070] According to an embodiment of the present invention, the pre-set naming rules may include, for example: adding specific identification information to the snapshot name of the repair snapshot, the specific identification information may include numbers, letters, symbols and combinations thereof, and the repair snapshot may be named in the form of specific identification information "repair" + snapshot number. It should be noted that the above naming rules are only exemplary descriptions of the embodiments of the present invention, and those skilled in the art may flexibly set the naming rules based on actual application situations.

[0071] For example, file system A may include three snapshots, where snapshot 1 may be named 001, snapshot 2 may be named repair002, and snapshot 3 may be named 003, wherein snapshot 2 is a repair snapshot. When a file system failure is detected, the names of snapshot 1, snapshot 2, and snapshot 3 may be traversed to detect whether the names of snapshot 1, snapshot 2, and snapshot 3 contain specific identification information "repair", thereby determining that the file system has a repair snapshot, namely, snapshot 2.

[0072] 102. In a case where the file system has a corresponding repair snapshot, a repair tool corresponding to the file system is called to repair the file system.

[0073] According to an embodiment of the present invention, if a file system has a corresponding repair snapshot, it can be considered that even if a failure occurs during the repair of the file system due to power failure or other factors, the repair snapshot can be used to roll back the file system, so that the file system can recover the failure scene to replace a safer repair strategy. Therefore, when it is determined that the file system has a corresponding repair snapshot, the repair tool corresponding to the file system can be called to repair the file system.

[0074] According to an embodiment of the present invention, since different file systems may be deployed in a cloud hard disk according to application requirements, such as an XFS file system, a UFS file system, etc., and the repair tools for each file system are usually different, it is necessary to call the repair tool corresponding to the file system to repair the file system. For example, if the file system is an XFS file system, the xfs_repair repair tool can be called to repair the XFS file system.

[0075] 103. When the repair tool fails to repair the file system, the data in the file system is rolled back to the data recorded in the repair snapshot.

[0076] According to an embodiment of the present invention, the repair failure may include, for example, that the repair tool does not completely and accurately restore the data stored in the file system. In this case, the file system repaired by the repair tool is not the file system required by the user, and the repair snapshot can be used to roll back the file system, that is, to roll back the data in the file system to the data recorded in the repair snapshot, so that after the file system is restored to the scene where the failure occurred, safer measures can be taken to repair the file system again.

[0077] In an embodiment of the present invention, when a file system failure is detected, it is first determined whether the file system has a corresponding repair snapshot. When the file system has a corresponding repair snapshot, a repair tool corresponding to the file system is called to repair the file system. The repair tool may fail in the process of repairing the file system. When the repair tool fails to repair the file system, the repair snapshot is used to roll back the data in the file system to the data recorded in the repair snapshot, thereby solving the technical problem of the file system repair process being non-rollable in the related art, achieving the technical effect of increasing the fault tolerance of repair failure, and when necessary, the file system can be restored to the fault site to replace a safer repair strategy.

[0078] According to an embodiment of the present invention, after a file system failure is detected, the type of the file system may also be determined.

[0079] As an optional implementation, the process of determining the type of the file system may be specifically implemented as follows:

[0080] Use the blkid (locate / print block device attributes) command to determine the type of file system.

[0081] According to an embodiment of the present invention, the blkid command can be used to display the status of the system hard disk partition and query the type of the file system used on the storage device. Executing the blkid command can display all mounted partition information, such as UUID and TYPE file system type information.

[0082] As another optional implementation, the process of determining the type of the file system may be specifically implemented as follows:

[0083] Use the configuration center record to identify the file system type.

[0084] According to an embodiment of the present invention, since each node can connect to the configuration center, and each cloud hard disk has a unique serial number identifier, when mounting the cloud hard disk, the serial number identifier of the cloud hard disk can be recorded in the configuration center, such as: {"9edf7906-50fe-4976-96ef-6fa75e4179a0": "xfs"}; then when a file system fails, the information is read in the configuration center according to the serial number identifier of the cloud hard disk to obtain the file system type corresponding to the cloud hard disk. In the above example, the type of the file system can be read as: xfs.

[0085] According to an embodiment of the present invention, the repair snapshot may have a timestamp corresponding to the time when the file system failure was detected.

[0086] According to an embodiment of the present invention, a timestamp may be added to the snapshot name of the repair snapshot. For example, a file system failure is detected at 10:00, so a timestamp of 1000 may be added to the snapshot name of the repair snapshot. Taking the above snapshot 2 as an example, the snapshot name after adding the timestamp may be "repair0021000".

[0087] Optionally, the process of rolling back the data in the file system to the data recorded in the repair snapshot may be specifically implemented as follows:

[0088] Based on the timestamp, the data generated after the timestamp in the file system is deleted.

[0089] According to an embodiment of the present invention, since the data in the file system repaired by the repair tool is not the data required by the user, it can be considered that the repair tool has added some dirty data to the cloud hard disk. Therefore, based on the timestamp corresponding to the time of the file system failure, the data generated after that time in the cloud hard disk, that is, the data generated by the failure of the file system repair, can be erased, and the storage state of the cloud hard disk can be restored to the time point when the file system failure occurred.

[0090] According to an embodiment of the present invention, the time required for rolling back the file system may depend on the amount of differential data from the repair snapshot creation time point to the current time point.

[0091] Figure 2 The schematic diagram of rolling back a file system based on a repair snapshot is exemplarily shown.

[0092] like Figure 2 As shown, 200 may represent the timeline of file system repair. At 10:00, a file system failure is detected, and it is determined that the file system has a repair snapshot. The repair snapshot has a timestamp corresponding to the time when the file system failure is detected, that is, 1000. After it is determined that the file system has a corresponding repair snapshot, a repair tool corresponding to the file system is called to repair the file system. The repair time may be, for example, 4 seconds, that is, at 10:04, it is determined that the file system repair fails. After it is determined that the file system repair fails, the file system may be rolled back using the repair snapshot at 10:05, that is, the data generated after the time corresponding to the timestamp is deleted, and the file system is rolled back to the data state at 10:00, completing the snapshot rollback operation.

[0093] According to an embodiment of the present invention, if it is determined that the file system does not have a corresponding repair snapshot, the file system repair tool is directly called to repair the file system. Due to abnormal power failure and other reasons, the file system repair tool may fail in the repair process of the file system. If the file system repair fails, it may cause consequences such as permanent data loss, causing inconvenience to the user.

[0094] Therefore, according to an embodiment of the present invention, when it is determined that the file system does not have a corresponding repair snapshot, the file system repair method may further include:

[0095] Get resource information of the file system;

[0096] Create a recovery snapshot for the file system based on the resource information.

[0097] According to an embodiment of the present invention, since there is a data security risk when repairing a file system when the file system does not have a corresponding repair snapshot, after determining that the file system does not have a corresponding repair snapshot, the resource information of the file system can be first obtained, and then a repair snapshot can be created for the file system based on the resource information. After the repair snapshot is created, the file system repair tool can be called to repair the file system.

[0098] According to an embodiment of the present invention, the resource information represents the storage location of the file system in the distributed storage framework.

[0099] According to an embodiment of the present invention, the resource information may include, for example, the cluster affiliation, storage pool affiliation, and disk volume identification of the cloud hard disk corresponding to the file system.

[0100] Optionally, the process of creating a recovery snapshot for the file system according to the resource information may be specifically implemented as follows:

[0101] Obtain the operation identifier from the configuration center and generate a timestamp corresponding to the time when the file system failure was detected;

[0102] At the storage location of the resource information representation, a repair snapshot is created according to the operation identifier and the timestamp.

[0103] According to an embodiment of the present invention, when creating a repair snapshot for a file system, an operation identifier having a unique mapping relationship with the repair snapshot can be obtained from the configuration center. The operation identifier can be a fixed-length string, and the string can be composed of any one or more of numbers, letters, and symbols.

[0104] According to an embodiment of the present invention, the operation identifier can be used to identify whether a repair operation is completed, so as to ensure the integrity of each repair operation.

[0105] According to an embodiment of the present invention, before creating a repair snapshot, the cluster affiliation, storage pool affiliation, disk volume identification and other information of the cloud hard disk corresponding to the file system should be specified, so that a repair snapshot can be created in the cluster corresponding to the cloud hard disk.

[0106] According to an embodiment of the present invention, after obtaining an operation identifier, generating a timestamp and determining the storage location of the cloud hard disk corresponding to the file system based on the obtained resource information, a repair snapshot can be generated in the storage location and named using specific identification information, timestamp and operation identifier.

[0107] According to an embodiment of the present invention, the following may be a specific example of creating a repair snapshot:

[0108]

[0109]

[0110] "ClusterId" can indicate the cluster to which the cloud disk corresponding to the file system belongs, "PoolId" can indicate the storage pool to which it belongs, "VolumeId" can indicate the disk volume identifier, snapshot_name can indicate the name of the repair snapshot, "repair" can indicate specific identification information, 34FD456 can indicate the operation identifier, and 1637656384 can indicate the timestamp.

[0111] As can be seen from the above specific examples, before creating a repair snapshot, first obtain resource information, which may include the cluster affiliation, storage pool affiliation, and disk volume identification of the cloud hard disk corresponding to the file system. After obtaining the resource information, you can create a repair snapshot in the storage location indicated by the resource information, and use the specific identification information, operation identification, and timestamp to name the created repair snapshot. In this specific example, the name of the created repair snapshot can be repair_34FD456_1637656384.

[0112] According to an embodiment of the present invention, after the repair tool completes repairing the file system, the file system repair method further includes:

[0113] Mount the cloud hard disk corresponding to the file system;

[0114] If the mount is successful, the operation identifier is deleted from the configuration center; otherwise, the operation identifier is retained in the configuration center.

[0115] According to an embodiment of the present invention, after the repair tool completes the repair operation on the file system, an attempt may be made to mount the cloud hard disk corresponding to the file system.

[0116] According to an embodiment of the present invention, if the cloud hard disk corresponding to the file system is mounted successfully, it indicates that the file system is repaired successfully, that is, there is no need to perform subsequent operations on the file system; since the operation identifier has a unique mapping relationship with the file system, the operation identifier can be deleted from the configuration center.

[0117] According to an embodiment of the present invention, if the cloud hard disk corresponding to the file system fails to mount, it means that the file system repair has failed. In this case, since the file system needs to be repaired using the updated repair strategy later, the operation identifier can be temporarily retained to determine the repair progress during the next repair.

[0118] According to an embodiment of the present invention, taking into account that the file system repair task may be unexpectedly stopped during execution due to reasons such as a storage device crash, when the storage device is restarted, it is necessary to restart the file system repair task. If the file system repair task is executed directly from the beginning, a lot of repetitive work will be caused, affecting the work efficiency of the file system repair task.

[0119] Therefore, before executing a file system repair task, you can first determine whether the file system has a unique corresponding operation identifier. If the file system has an operation identifier, it means that the file system has a corresponding repair snapshot, so there is no need to obtain an operation identifier for the file system and create a corresponding repair snapshot, thereby improving the work efficiency of file system repair.

[0120] According to an embodiment of the present invention, in a distributed storage system, a repair snapshot usually occupies a large amount of storage resources. If all the repair snapshots are retained after creating a repair snapshot for a file system, the storage performance of the distributed storage framework may be affected. Therefore, it is necessary to delete some repair snapshots that meet the deletion conditions to release resources for the distributed storage framework.

[0121] According to an embodiment of the present invention, the repair snapshot is named according to a preset naming rule.

[0122] The file system repair method provided by the embodiment of the present invention also includes:

[0123] Based on a preset naming rule, determine a recovery snapshot from multiple snapshots of the file system;

[0124] According to the embodiment of the present invention, based on the operation identifier, a repair snapshot can be preliminarily screened out from multiple snapshots of the file system.

[0125] According to an embodiment of the present invention, the preset naming rule may include, for example, naming the repair snapshot using at least one of specific identification information, operation identification, and timestamp. For example, the name of the repair snapshot may be repair_34FD456_1637656384, where "repair" may represent specific identification information, 34FD456 may represent operation identification, and 1637656384 may represent timestamp.

[0126] According to an embodiment of the present invention, the file system may include, for example, four snapshots, wherein the third snapshot and the fourth snapshot may be named, for example, according to specific identification information "repair", so that the snapshot names of the four snapshots stored in the file system can be traversed to determine that the third snapshot and the fourth snapshot are repair snapshots.

[0127] According to an embodiment of the present invention, when releasing storage resources for a distributed storage framework, the repair snapshots, i.e., the third snapshot and the fourth snapshot, can be first screened out from the four snapshots stored in the distributed storage framework according to a preset naming rule, so as to subsequently determine the matching relationship between the operation identifier of the repair snapshot to be deleted and the operation identifier stored in the configuration center.

[0128] According to an embodiment of the present invention, by pre-screening snapshots stored in the distributed storage framework based on operation identifiers when releasing storage resources for the distributed storage framework, and determining repair snapshots to be deleted, the technical effect of improving the resource release efficiency of the distributed storage framework can be achieved.

[0129] Determine a matching relationship between the operation identifier of the repair snapshot to be deleted and the operation identifier stored in the configuration center;

[0130] According to an embodiment of the present invention, after determining the repair snapshot, the snapshot name of the repair snapshot can be parsed, the operation identifier of the repair snapshot can be obtained, and then based on the operation identifier, it is determined whether there is a target operation identifier in the configuration center that has a matching relationship with the operation identifier.

[0131] According to an embodiment of the present invention, determining whether the operation identifier of the repair snapshot has a matching relationship with the operation identifier stored in the configuration center can be specifically implemented by calculating the similarity of the operation identifier of the repair snapshot and the operation identifier stored in the configuration center one by one. If there is an operation identifier in the configuration center whose similarity result with the operation identifier of the repair snapshot is greater than a preset similarity threshold, it can be determined that the operation identifier of the repair snapshot has a matching relationship with the operation identifier stored in the configuration center. Otherwise, it can be determined that the operation identifier of the repair snapshot has no matching relationship with the operation identifier stored in the configuration center. Among them, the preset similarity threshold can be, for example, 80%, 90%, 95%, etc. The embodiment of the present invention does not limit the specific value of the preset similarity threshold. Those skilled in the art can flexibly set the preset similarity threshold according to actual application requirements.

[0132] When the matching relationship represents that the configuration center does not have the operation identifier, the repair snapshot corresponding to the operation identifier is deleted.

[0133] According to an embodiment of the present invention, when the matching relationship represents the existence of the operation identifier in the configuration center, indicating that the repair operation of the file system has not been completed, the operation identifier and the repair snapshot corresponding to the operation identifier can be retained in the configuration center.

[0134] According to an embodiment of the present invention, if the operation identifier does not exist in the configuration center, it means that the file system repair operation corresponding to the operation identifier has been completed and the repair snapshot is no longer needed. Therefore, the operation identifier can be deleted from the configuration center, and the repair snapshot corresponding to the operation identifier can be deleted to release storage resources for the distributed storage framework.

[0135] According to an embodiment of the present invention, deleting a repair snapshot corresponding to an operation identifier includes:

[0136] Based on the timestamp of the repair snapshot, determine whether the repair snapshot meets the deletion condition;

[0137] According to an embodiment of the present invention, the deletion condition may include, for example, whether the storage time of the repair snapshot is greater than a preset storage time threshold.

[0138] According to an embodiment of the present invention, after obtaining the timestamp of the repair snapshot, the current time can be obtained, and then the first time span can be calculated based on the timestamp of the repair snapshot and the current time. After the first time span is calculated, it can be determined whether the repair snapshot meets the deletion condition by comparing the first time span with a preset storage time threshold.

[0139] If the repair snapshot meets the deletion conditions, delete the repair snapshot.

[0140] According to an embodiment of the present invention, on the basis of judging whether to delete a repair snapshot based on whether an operation identifier exists in the configuration center, an innovative judgment condition is added for determining whether a repair snapshot satisfies the deletion condition based on the repair timestamp of the repair snapshot. Thus, repair snapshots with an earlier creation time can be deleted, while repair snapshots with a later creation time can be retained. Thus, repair snapshots with a later creation time can be used as additional security backups, further increasing the security of user data.

[0141] According to an embodiment of the present invention, after the repair tool completes repairing the file system, the file system repair method further includes:

[0142] Based on the repair result, prompt information is sent to the user, wherein the prompt information is used to characterize the failure condition and the repair result of the file system.

[0143] According to the embodiment of the present invention, when the user has a high requirement for the availability of the file system, the repair can be performed in a manner of first repair and then warning, so as to ensure the availability of the service first and then perform subsequent processing, such as sending a prompt message to the user. Thus, the technical effect of increasing the availability of the service can be achieved.

[0144] According to an embodiment of the present invention, the fault condition of the file system may include, for example, the location where the fault occurred, a list of data affected by the fault, the time when the fault occurred, etc.

[0145] According to an embodiment of the present invention, the repair result may include, for example, repair success and repair failure.

[0146] According to an embodiment of the present invention, when the prompt information indicates that the file system repair has failed, the user can determine whether to roll back the file system based on the repair snapshot based on the prompt information.

[0147] In an embodiment of the present invention, based on the above, the file system repair method can be implemented as follows:

[0148] Step 1: Mount the cloud hard disk. If the mount fails, it is identified as a file system failure. If the mount succeeds, jump to step 10.

[0149] Step 2: The file system identifier identifies the type of the cloud disk's file system. The identification methods include but are not limited to using the lsblk command to identify and using the configuration center records to identify;

[0150] Step 3: Obtain resource information of the distributed storage vendor corresponding to the cloud hard disk, including but not limited to cluster information, storage pool information, and cloud hard disk information;

[0151] Step 4: Obtain an operation identifier from the configuration center (if the operation identifier does not exist, generate a new one). The operation identifier is used to identify whether a repair operation is completed and to ensure the integrity of each repair operation.

[0152] Step 5: Get the snapshot list of the cloud hard disk from the distributed storage system, and check whether there is a snapshot with the snapshot name containing the operation identifier and a specific identifier (such as repair). If not, jump to step 6. If so, jump directly to step 7.

[0153] Step 6: Create a repair snapshot based on specific rules (rules include but are not limited to specific snapshot names, such as: specific identifier (such as repair) + operation ID + timestamp. The purpose of this naming method is to distinguish repair snapshots from snapshots for other purposes).

[0154] Step 7: Based on the file system type identified in step 2, call a specific file system repair tool to repair the file system;

[0155] Step 8: Mount the cloud hard disk again. If the mounting fails, jump to step 10.

[0156] Step 9: Delete the operation identifier in the configuration center;

[0157] Step 10: The file system repair process is completed.

[0158] Figure 3 FIG. 1 is a schematic diagram showing a structure of an embodiment of a file system repair device provided by the present invention. Figure 3 As shown, the file system repairing device 300 may include a first determining module 301 , a calling module 302 and a snapshot rollback module 303 .

[0159] A first determination module 301 is used to determine whether the file system has a corresponding repair snapshot when a file system failure is detected, wherein the file system includes a file system in a distributed storage framework;

[0160] The calling module 302 is used to call a repair tool corresponding to the file system to repair the file system when the file system has a corresponding repair snapshot.

[0161] The snapshot rollback module 303 is used to roll back the data in the file system to the data recorded in the repair snapshot when the repair tool fails to repair the file system.

[0162] According to an embodiment of the present invention, the repair snapshot has a timestamp corresponding to the time when the file system failure was detected.

[0163] According to an embodiment of the present invention, the snapshot rollback module 303 includes a rollback submodule.

[0164] The rollback submodule is used to delete the data generated after the timestamp in the file system based on the timestamp.

[0165] According to an embodiment of the present invention, in the case that the file system does not have a corresponding repair snapshot, the file system repairing apparatus 300 may further include a first obtaining module and a creating module.

[0166] The first acquisition module is used to acquire resource information of the file system.

[0167] A creation module is used to create a recovery snapshot for a file system based on resource information.

[0168] According to an embodiment of the present invention, the resource information represents the storage location of the file system in the distributed storage framework.

[0169] According to an embodiment of the present invention, the creation module includes a first generation submodule and a creation submodule.

[0170] The first generating submodule is used to obtain an operation identifier from a configuration center and generate a timestamp corresponding to the time when a file system failure is detected.

[0171] A submodule is created, which is used to create a repair snapshot according to the operation identifier and the timestamp at the storage location of the resource information representation.

[0172] According to an embodiment of the present invention, the file system repair device 300 may further include a mounting module and a configuration center operation module.

[0173] The mount module is used to mount the cloud hard disk corresponding to the file system.

[0174] The configuration center operation module is used to delete the operation identifier from the configuration center if the mounting module is successfully mounted, otherwise, the operation identifier is retained in the configuration center.

[0175] According to an embodiment of the present invention, the repair snapshot is named according to the operation identifier.

[0176] According to an embodiment of the present invention, the file system repairing device 300 may further include a second determining module, a third determining module and a first deleting module.

[0177] The second determining module is used to determine the repair snapshot from multiple snapshots of the file system based on the operation identifier.

[0178] The third determination module is used to determine the matching relationship between the operation identifier of repairing the snapshot and the operation identifier stored in the configuration center.

[0179] The first deletion module is used to delete the repair snapshot corresponding to the operation identifier when the matching relationship representation configuration center does not have the operation identifier.

[0180] According to an embodiment of the present invention, the first deleting module includes a first determining unit and a first deleting unit.

[0181] A first determining unit, configured to determine whether the repair snapshot satisfies a deletion condition based on a timestamp of the repair snapshot;

[0182] The first deleting unit is configured to delete the repair snapshot if the repair snapshot meets the deletion condition.

[0183] According to an embodiment of the present invention, after the repair tool completes repairing the file system, the file system repairing device 300 may further include a sending module.

[0184] The sending module is used to send prompt information to the user based on the repair result, wherein the prompt information is used to characterize the failure status and repair result of the file system.

[0185] Figure 3 The file system repair device can perform Figure 1 The implementation principle and technical effect of the file system repair method described in the embodiment are not described in detail. The specific way in which each module, submodule and unit performs operations in the file system repair device in the above embodiment has been described in detail in the embodiment of the method, and will not be described in detail here.

[0186] In one possible design, the above Figure 3 The structure of the file system repair device shown can be implemented as an electronic device. Figure 4 As shown, the electronic device 400 may include: a processor 401 and a memory 402. The memory 402 stores executable code, and when the executable code is executed by the processor 401, the processor 401 can at least implement the above-mentioned Figure 1 The file system repair method provided in the illustrated embodiment.

[0187] The structure of the electronic device may further include a communication interface 403 for communicating with other devices.

[0188] Figure 5A schematic diagram of the structure of another electronic device provided in this embodiment, such as Figure 5 As shown, electronic device 500 may include one or more of the following components: processing component 502 , memory 504 , power component 506 , multimedia component 508 , audio component 510 , input / output (I / O) interface 512 , sensor component 514 , and communication component 516 .

[0189] The processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to complete all or part of the steps 101-103 of the above method. In addition, the processing component 502 may include one or more modules to facilitate the interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate the interaction between the multimedia component 508 and the processing component 502.

[0190] The memory 504 is configured to store various types of data to support operations on the electronic device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0191] The power supply component 506 provides power to the various components of the electronic device 500. The power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 500.

[0192] The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the electronic device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0193] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), and when the electronic device 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.

[0194] The input / output (I / O) interface 512 provides an interface between the processing component 502 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0195] The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor assembly 514 can detect the open / closed state of the electronic device 500, the relative positioning of components, such as the display and keypad of the electronic device 500, and the sensor assembly 514 can also detect the position change of the electronic device 500 or a component of the electronic device 500, the presence or absence of user contact with the electronic device 500, the orientation or acceleration / deceleration of the electronic device 500, and the temperature change of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0196] The communication component 516 is configured to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 500 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G or 4G or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0197] In an exemplary embodiment, the electronic device 500 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0198] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 504 including instructions, and the instructions can be executed by the processor 520 of the electronic device 500 to complete the above method. For example, the non-transitory computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0199] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, wherein the non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor executes the aforementioned Figure 1 The address mapping method provided in the illustrated embodiment.

[0200] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0201] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the present invention can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0202] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A file system repair method, characterized in that: include: When a file system failure is detected, determining whether the file system has a corresponding repair snapshot; In the case where the file system has a corresponding repair snapshot, calling a repair tool corresponding to the file system to repair the file system; In the case where the repair tool fails to repair the file system, rolling back the data in the file system to the data recorded in the repair snapshot, wherein the data recorded in the repair snapshot is the data corresponding to the failure site of the file system; The repair snapshot has a timestamp corresponding to the time when the file system failure was detected; The step of rolling back the data in the file system to the data recorded in the repair snapshot includes: Based on the timestamp, data generated after the timestamp in the file system is deleted.

2. The method according to claim 1, characterized in that In a case where the file system does not have a corresponding repair snapshot, the method further includes: Obtain resource information of the file system; A repair snapshot is created for the file system according to the resource information.

3. The method according to claim 2, characterized in that The resource information represents the storage location of the file system in the distributed storage framework; The creating a repair snapshot for the file system according to the resource information includes: Obtaining an operation identifier from a configuration center, and generating a timestamp corresponding to a time when the file system failure is detected; At the storage location of the resource information representation, the repair snapshot is created according to the operation identifier and the timestamp.

4. The method according to claim 3, characterized in that After the repair tool completes repairing the file system, the method further includes: Mounting the cloud hard disk corresponding to the file system; If the mounting is successful, the operation identifier is deleted from the configuration center; otherwise, the operation identifier is retained in the configuration center.

5. The method according to claim 4, characterized in that The repair snapshot is named according to a preset naming rule; The method further comprises: Based on the preset naming rule, determining a repair snapshot from the multiple snapshots of the file system; Determine a matching relationship between the operation identifier of the repair snapshot and the operation identifier stored in the configuration center; When the matching relationship indicates that the operation identifier does not exist in the configuration center, the repair snapshot corresponding to the operation identifier is deleted.

6. The method according to claim 5, characterized in that Deleting the repair snapshot corresponding to the operation identifier includes: Determining whether the repair snapshot satisfies a deletion condition based on a timestamp of the repair snapshot; If the repair snapshot meets the deletion condition, the repair snapshot is deleted.

7. The method according to claim 1, characterized in that After the repair tool completes repairing the file system, the method further includes: Based on the repair result, prompt information is sent to the user, wherein the prompt information is used to characterize the failure condition of the file system and the repair result.

8. A device for repairing a file system, characterized in that: include: A first determination module is used to determine whether the file system has a corresponding repair snapshot when a file system failure is detected, wherein the file system includes a file system in a distributed storage framework; a calling module, configured to call a repair tool corresponding to the file system to repair the file system if the file system has a corresponding repair snapshot; A snapshot rollback module is used to roll back the data in the file system to the data recorded in the repair snapshot when the repair tool fails to repair the file system, wherein the data recorded in the repair snapshot is data corresponding to the failure site of the file system; the repair snapshot has a timestamp corresponding to the time when the file system failure is detected; and rolling back the data in the file system to the data recorded in the repair snapshot includes: based on the timestamp, deleting the data in the file system generated after the timestamp.

9. A computing device, characterized in that including a processing component and a storage component; The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component; The storage component stores one or more computer instructions; the one or more computer instructions are used to be called and executed by the processing component to implement the file system repair method as described in any one of claims 1 to 7.

10. A computer storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a computer, the file system repair method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Using volume snapshots to prevent file corruption in failed restore operations

    US20090249119A1