Hard disk drift management method, electronic equipment and storage medium
By performing dual verification of the target hard disk in kernel state and user state, the abnormal problems caused by hot plugging of hard disks in cloud storage systems are solved, ensuring that the hard disk operates stably in cloud storage systems, and improving the robustness of the system.
Patent Information
- Application Number
- CN202510272348.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-07-22
AI Technical Summary
When hard disks are hot-swaped in cloud storage systems, kernel crashes, file system corruption and compatibility issues often cause cluster business to be affected.
By performing dual verification of the target hard disk in kernel state and user state, we ensure that the hard disk information is compatible with the current server and then mount it, including reading the hard disk information, the first check and the second check, and ensuring that the hard disk is compatible with the current server in kernel state and user state.
It reduces storage system abnormalities caused by hard disk hot swap and improves the robustness and stability of cloud storage systems.
Smart Images

Figure CN120353382A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of hard disk management, and particularly to a hard disk drift management method, an electronic device, and a storage medium. Background Art
[0002] Due to business requirements, cloud storage systems often have the need for hard disk drift (hot plugging a hard disk from one server and then hot plugging it into another server). Since the hard disk is directly hot plugged during hard disk drift, some problems are often introduced, affecting the cluster business.
[0003] Therefore, how to improve the robustness of the cloud storage system during hot plugging of hard disks has become an urgent problem to be solved. Summary of the Invention
[0004] This application provides at least a hard disk drift management method, an electronic device, and a storage medium to improve the robustness of the cloud storage system during hot plugging of hard disks.
[0005] In the first aspect of this application, a hard disk drift management method is provided, which is applied to a storage system. The hard disk drift management method includes: reading the hard disk information of a target hard disk; performing a first verification on the target hard disk based on the hard disk information to obtain a first verification result; the first verification is used to determine whether the target hard disk supports the current server in the kernel mode; in response to the first verification result indicating that the verification passes, performing a second verification on the target hard disk to obtain a second verification result, and in the case where the second verification result indicates that the verification passes, mounting the target hard disk to the current server, and the second verification is used to determine whether the target hard disk supports the current server in the user mode.
[0006] In the second aspect of this application, an electronic device is provided, including a memory and a processor coupled to each other. The processor is configured to execute program instructions stored in the memory to implement the hard disk drift management method in the first aspect above.
[0007] In the third aspect of this application, a computer-readable storage medium is provided, on which program instructions are stored. When the program instructions are executed by a processor, the hard disk drift management method in the first aspect above is implemented.
[0008] Therefore, by performing the first verification and the second verification on the target hard disk respectively, and only mounting the target hard disk to the storage system when both the first verification and the second verification pass, it is possible to determine that the target hard disk inserted into the current server is compatible with the current server in both the kernel mode and the user mode by comparing the hard disk information of the target hard disk with the relevant information of the current server, thereby reducing the storage system anomalies caused by hot plugging of hard disks and helping to improve the robustness of the cloud storage system during hot plugging of hard disks.
[0009] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, rather than limiting the present application. Description of the Drawings
[0010] The drawings herein are incorporated into and constitute a part of this specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to explain the technical solutions of the present application.
[0011] Figure 1 is a schematic flowchart of an embodiment of the hard disk drift management method of the present application;
[0012] Figure 2 is a schematic structural diagram of hard disk information in an embodiment of the present application;
[0013] Figure 3 is a schematic flowchart of another embodiment of the hard disk drift management method of the present application;
[0014] Figure 4 is a schematic flowchart of the hard disk removal in an embodiment of the hard disk drift management method of the present application;
[0015] Figure 5 is a schematic framework diagram of an embodiment of an electronic device of the present application;
[0016] Figure 6 is a schematic framework diagram of an embodiment of the computer-readable storage medium of the present application. Detailed Embodiments
[0017] The following will combine the specification drawings to elaborate in detail on the solutions of the embodiments of the present application.
[0018] In the following description, specific details such as specific system architectures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the present application.
[0019] The term "and / or" herein merely describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after. In addition, "a plurality" herein means two or more than two. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set composed of A, B, and C.
[0020] Cloud storage systems generally have the characteristics of large cluster scale, a large number of hard disks, and a mixed deployment of servers with different forms. And due to business needs, there is often a need for hard disk drifting (hot plugging a hard disk from one server and then hot inserting it into another server). Possible scenarios are as follows:
[0021] 1. Storage server exception: After the server is abnormal, all the hard disks on the abnormal server will be pulled out and hot inserted into other normal storage servers in the cluster reasonably to ensure that all data in the entire cluster is not lost.
[0022] 2. Storage server expansion: After expansion, there are no new disks temporarily. Hard disk drifting will be carried out. Hard disks will be hot pulled from other storage servers and then hot inserted into the expanded server to ensure the normal use of the expanded server and ensure high redundancy and high reliability of the cluster.
[0023] 3. Balance the capacity of each storage server: The capacities of different storage servers may be unbalanced, resulting in abnormal cluster services. Therefore, hard disk drifting needs to be carried out between different storage servers to ensure the capacity balance between each storage server and ensure the normal cluster services. Replace abnormal hard disks: After the hard disk is abnormal, it needs to be hot pulled out and then replaced with a new disk.
[0024] Through hard disk drifting, the above problems can be effectively solved without affecting the overall cluster business. However, since the hard disks are directly hot plugged during hard disk drifting, some problems are often introduced, resulting in the impact on the cluster business. Possible impacts are as follows:
[0025] 1. Kernel crash: When there are still IO operations on the hard disk being hot pulled out, the kernel may not be able to handle the hot plug hard disk error normally and crash, resulting in the restart of the storage server, especially more likely to occur when hot pulling a batch of hard disks.
[0026] 2. Hard disk file system corruption: When there are still IO operations on the hard disk being hot pulled out, the file system metadata may not be correctly processed, resulting in file system corruption and the hard disk cannot be used normally after drifting to another server.
[0027] 3. Compatibility issues: When a hard disk drifts from one server to another, due to differences in kernel versions, operating systems, file system types / versions, etc. between different servers, there are often compatibility issues, resulting in the hard disk being unable to be used or data loss (for example: drifting a hard disk from the openEuler system to the centos6.5 system).
[0028] Therefore, it is necessary to solve the problem of storage system exceptions caused by hot plugging hard disks.
[0029] Please refer to Figure 1 This application provides a hard disk drifting management method on the one hand, which is applied to a storage system. The hard disk drifting management method includes:
[0030] Step S20: Read the hard disk information of the target hard disk.
[0031] Step S40: Perform a first check on the target hard disk based on the hard disk information to obtain a first check result; the first check is used to determine whether the target hard disk supports the current server in the kernel mode.
[0032] Step S60: In response to the first check result indicating that the check passes, perform a second check on the target hard disk to obtain a second check result, and when the second check result indicates that the check passes, mount the target hard disk to the current server. The second check is used to determine whether the target hard disk supports the current server in the user mode.
[0033] In the above solution, by performing the first check and the second check on the target hard disk respectively, and only when both the first check and the second check pass, mounting the target hard disk to the storage system, it is possible to determine that the target hard disk inserted into the current server is compatible with the current server in both the kernel mode and the user mode by comparing the hard disk information of the target hard disk with the relevant information of the current server, thereby reducing the storage system anomalies caused by hot plugging of hard disks.
[0034] In some embodiments, the hard disk information may include hard disk description information and a hard disk description information check code. The structure of the hard disk information may refer to Figure 2 , and the hard disk information may include but is not limited to the following information: kernel type (x86, arm, mips, etc.), kernel version, operating system type (centos, openEuler, etc.), operating system version, file system type (xfs, ext4, etc.), formatting tool version, mounting tool version, hard disk type / manufacturer / capacity, etc. And a check code information can be generated for the hard disk description information (for example, algorithms such as CRC, MD5, SHA1, etc. can be used to calculate the check code) to ensure the integrity and credibility of the hard disk description information. The hard disk information can be used for information comparison and verification during hard disk drift to ensure that the target hard disk can correctly identify the differences in the kernel, operating system, file system, etc. when drifting between different servers, and intercept or release the hard disk according to the set policy, which is beneficial to ensuring the compatibility, reliability, and stability of the target hard disk when drifting between different servers.
[0035] In some embodiments, when the target hard disk passes the first verification, the target hard disk can be brought online in the kernel mode, and then notify the user-mode process, so as to perform a second verification on the target hard disk. When performing the second verification on the target hard disk in the user mode, if the verification fails, the kernel is notified to intercept the hard disk I / O operations (all I / O operations of the target hard disk will be intercepted). If the verification is successful, the target hard disk can be mounted to the current server and connected to the service, that is, brought online in the service mode. It should be noted that when the hard disk is inserted into the current server, the target hard disk is first verified in the kernel mode. When verifying the target hard disk in the kernel mode, the user mode cannot perceive the target hard disk. If the target hard disk fails to pass the first verification, the subsequent user mode cannot perceive the target hard disk either; only after the first verification passes can the user mode perceive the target hard disk and then trigger the second verification of the target hard disk.
[0036] It can be understood that the current server refers to the server to which the target hard disk needs to be connected; the storage system may include several servers.
[0037] In some embodiments, the hard disk drift management method further includes:
[0038] Step S80: In response to a hard disk offline command, unmount the file system corresponding to the target hard disk from the current server, and intercept the read and write operations on the target hard disk.
[0039] The hard disk offline command may be issued by the current server, and the hard disk offline command is used to indicate that the target hard disk is about to be removed from the current server. Exemplarily, when it is necessary to remove the target hard disk from the current server, a hard disk offline command can be first triggered in the current server (for example, the hard disk can be operated offline in the cloud storage operation and maintenance interface), and then the file system corresponding to the target hard disk is unmounted from the current server, and the read and write operations on the target hard disk are intercepted, which is beneficial to ensuring that there are no ongoing read and write operations between the communication interface of the target hard disk and the current server during the subsequent hot removal of the target hard disk, thereby improving the reliability and stability of the hard disk file system and the server during removal.
[0040] In some embodiments, the step of in response to a hard disk offline command, unmount the file system corresponding to the target hard disk from the current server, and intercept the read and write operations on the target hard disk includes:
[0041] In response to a hard disk offline command, close the business read and write handle of the target hard disk corresponding to the offline command, unmount the file system corresponding to the target hard disk from the current server, and intercept the read and write operations on the target hard disk.
[0042] Referring to the foregoing embodiments, when hot-plugging the target hard disk, the target hard disk can be taken offline through the cloud storage operation and maintenance interface. When the user-mode process obtains the offline command for the target hard disk, it can close all the read and write handles related to the services on the target hard disk to ensure that there are no IO operations related to any services (i.e., IO operations in the service state) on the target hard disk. Then, the user-mode process can unmount the file system of the target hard disk and notify the kernel to intercept all IO operations of the target hard disk. Finally, the hard disk can be removed normally. Through the above operations, it can be ensured that there are no IO operations (including IO operations in the service state and IO operations caused by background operations or native operating system operations, etc.) on the hard disk when the hard disk is removed, which is beneficial to ensuring the reliability and stability of the hard disk file system and the server system during removal.
[0043] Therefore, compared with the technical solution that only shields the service-state IO operations of the hard disk during hot-plugging, in this embodiment, by closing all the read and write handles related to the services on the target hard disk and notifying the kernel to intercept all IO operations of the target hard disk, it is not only beneficial to ensure the interception of service-state IO operations, but also beneficial to ensure the interception of hard disk IO caused by background operations or native operating system operations, etc., so as to ensure that there are no IO operations on the target hard disk when the target hard disk is removed, which is beneficial to ensuring the reliability and stability of the hard disk file system and the server system during removal.
[0044] In some embodiments, the method further includes:
[0045] In the case where the first verification result or the second verification result indicates that the verification fails, intercept the read and write operations of the target hard disk.
[0046] In this embodiment, by sequentially verifying whether the target hard disk is compatible with the current server in the kernel state and the user state respectively, and intercepting the read and write operations of the target hard disk if any verification fails, it is determined that the target hard disk inserted into the current server is compatible with the current server in both the kernel state and the user state, thereby reducing the storage system anomalies caused by hot-plugging of the hard disk.
[0047] In some embodiments, before reading the hard disk information of the target hard disk, the method further includes:
[0048] Step S11: In response to a hard disk insertion event, determine whether there is reserved space in the target hard disk; the reserved space is used to store the hard disk information.
[0049] Step S12: In response to the absence of the reserved space in the target hard disk, perform a space reservation operation on the target hard disk and write the hard disk information corresponding to the current server into the reserved space.
[0050] When the target hard disk is inserted and the kernel recognizes the target hard disk, it first checks whether there is reserved space in the kernel. If there is no reserved space, a space reservation operation is performed (the space reserved by the kernel is not visible in the user state); if there is reserved space, the information in the reserved space is read, and the kernel version, operating system, etc. information of the current server is compared with the kernel version, operating system, etc. information recorded in the reserved space of the target hard disk. If the verification fails, the target hard disk is directly intercepted from going online in the kernel, and the subsequent user state cannot perceive the target hard disk either. If the verification passes, the user state can perceive the target hard disk.
[0051] If there is no reserved space in the target hard disk, it means that the target hard disk is a brand-new hard disk and has not been used on other servers. Create a reserved space on the target hard disk and write the hard disk information corresponding to the current server into the newly created reserved space. Referring to the foregoing embodiments, the hard disk information may include kernel type (x86, arm, mips, etc.), kernel version, operating system type (centos, openEuler, etc.), operating system version, file system type (xfs, ext4, etc.), formatting tool version, mounting tool version, hard disk type / manufacturer / capacity, etc. The hard disk information corresponding to the current server may include the kernel type (x86, arm, mips, etc.), kernel version, operating system type (centos, openEuler, etc.), operating system version, file system type, etc. of the current server. The present application does not make any restrictions.
[0052] After writing the hard disk information corresponding to the current server into the newly created reserved space, it can be determined that the target hard disk is compatible with the current server in the kernel state. Therefore, in some embodiments, when there is no reserved space in the target hard disk, after performing the space reservation operation on the target hard disk, steps S20 - S40 can be skipped, and a first verification result indicating that the verification passes can be directly obtained.
[0053] In some embodiments, the reading of the hard disk information of the target hard disk includes: in response to the existence of the reserved space in the target hard disk, reading the hard disk information from the reserved space. Subsequently, a first verification of the target hard disk is performed based on the hard disk information read from the reserved space. For specific details, reference can be made to the descriptions in other embodiments, which will not be elaborated here.
[0054] In some embodiments, the in response to the existence of the reserved space in the target hard disk, reading the hard disk information from the reserved space includes:
[0055] Step S21: In response to the failure of reading the hard disk information from the reserved space, reading the hard disk information from the hard disk label.
[0056] Step S22: In response to successfully reading the hard disk information from the hard disk label, update the hard disk information in the hard disk label to the reserved space.
[0057] The hard disk information can be saved in both the hard disk label and the reserved space, and they are backup to each other. Therefore, when reading the hard disk information from the reserved space fails, the hard disk information can be read from the hard disk label, and the hard disk information in the hard disk label is updated to the reserved space. Conversely, if reading the hard disk information from the hard disk label fails, the hard disk information can be read from the reserved space, and the hard disk information in the reserved space is updated to the hard disk label.
[0058] In some embodiments, before the step of performing a second check on the target hard disk in response to the first check result indicating that the check passes to obtain a second check result, the method further includes:
[0059] Step S50: Determine whether a file system exists on the target hard disk.
[0060] In some embodiments, performing a second check on the target hard disk to obtain a second check result includes:
[0061] Step S61: In response to the file system not existing on the target hard disk, perform a formatting operation on the target hard disk, update the hard disk information in the hard disk label and the reserved space based on the check information of the current storage system, and obtain the second check result indicating that the check passes; the check information of the storage system is used to fill the hard disk information.
[0062] In some embodiments, performing a second check on the target hard disk to obtain a second check result includes:
[0063] Step S62: In response to the file system existing on the target hard disk, read the hard disk information from the hard disk label or the reserved space, and perform a second check on the target hard disk based on the hard disk information to obtain a second check result.
[0064] After the target hard disk goes online in the kernel mode, it will trigger a hot plug event to notify the user-mode process. The user-mode process will determine whether a file system exists on the target hard disk. If not, it will format the hard disk file system (xfs, ext4, etc.). By formatting the file system of the target hard disk, the file system type of the target hard disk can meet the requirements of the current server kernel.
[0065] If the hard disk already has a file system, it will attempt to obtain hard disk information from the hard disk label. If it fails, it will read from the reserved space of the hard disk (or first read the hard disk information from the reserved space and then from the hard disk label if it fails). After reading the hard disk information, it will be verified. If the verification fails, the kernel will be notified to intercept the hard disk IO (all IO operations on the target hard disk will return failures). If the verification is successful, it will proceed to the next step.
[0066] In some embodiments, reading the hard disk information from the hard disk label or the reserved space includes: in response to reading the hard disk information from one of the hard disk label or the reserved space failing and reading the hard disk information from the other successfully, updating the hard disk information to the hard disk label or the reserved space where the reading failed.
[0067] In some embodiments, the mounting the target hard disk to the current server in response to the second verification result indicating that the verification is passed includes:
[0068] In response to the second verification result indicating that the verification is passed, updating the hard disk information in the hard disk label and the reserved space based on the verification information of the current storage system, and mounting the target hard disk to the current server; wherein, the verification information of the storage system is used to fill the hard disk information.
[0069] After the hard disk is formatted or the second verification is passed, new hard disk information in the current server can be obtained and updated to the hard disk label and the hard disk reserved space. The two are backups of each other, ensuring the reliability of the hard disk information.
[0070] In some embodiments, when verifying hard disk information (including the first verification and the second verification), strict mode, compatible mode, and loose mode may be included. Among them, strict mode means that as long as any hard disk information in the hard disk does not match the current server information, the hard disk online connection is directly intercepted; compatible mode means: determining whether the hard disk information in the hard disk is compatible with the current server information. If they are compatible, the hard disk is allowed to go online, otherwise the hard disk online connection is directly intercepted (for example, a higher version is usually compatible with a lower version, and a lower version is not compatible with a higher version); loose mode: allows all drifting hard disks to go online without verification. In the first verification, for the target hard disk to support the current server in the kernel state may include: all the hard disk information of the target hard disk is consistent with the information of the current server (for example, the kernel type (x86, arm, mips, etc.), kernel version, operating system type (centos, openEuler, etc.), operating system version, file system type (xfs, ext4, etc.), formatting tool version, etc. are all the same), or all the hard disk information of the target hard disk is consistent with or compatible with the information of the current server. Similarly, in the second verification, for the target hard disk to support the current server in the kernel state may include: all the hard disk information of the target hard disk is consistent with the information of the current server (for example, the kernel type (x86, arm, mips, etc.), kernel version, operating system type (centos, openEuler, etc.), operating system version, file system type (xfs, ext4, etc.), formatting tool version, etc. are all the same), or all the hard disk information of the target hard disk is consistent with or compatible with the information of the current server.
[0071] In some embodiments, when the second verification result indicates that the verification is passed, the target hard disk can be locked. For example, after the second verification passes, a locking instruction can be sent to lock the target hard disk on the corresponding interface of the server. Correspondingly, when performing a hot plug of the target hard disk, in response to the hard disk offline command, close the business read / write handle of the target hard disk corresponding to the offline command, unmount the file system corresponding to the target hard disk from the current server, and after intercepting the read / write operations for the target hard disk, an unlocking instruction can be sent, and then the target hard disk can be normally unplugged. Through the above operations, it is beneficial to ensure that when there is IO on the hard disk, the hard disk cannot be unplugged or misplugged, and at the same time ensure that there is no any IO operation on the hard disk when the hard disk is unplugged, ensuring the reliability and stability of the hard disk file system and the server system during unplugging.
[0072] The following combines Figure 3 and Figure 4 to give an exemplary illustration of the hard disk drift management method of the present application:
[0073] When the target hard disk is hot - inserted into the current server, after the kernel of the current server recognizes the target hard disk, it can first check whether there is reserved hard - disk space in the kernel. If there is no reservation, a space - reservation operation is performed (the space reserved by the kernel is invisible in the user space); if there is reserved space, the hard - disk information in the reserved space is read, and the kernel version, operating system, and other information recorded in the current server and the target hard disk are compared (i.e., the first check is performed); if the first check fails, the target hard disk is directly intercepted from going online in the kernel, and the subsequent user space cannot perceive this hard disk either. If the check passes, the user space can perceive the target hard disk.
[0074] After the hard disk goes online in the kernel space, a hot - plug event is triggered to notify the user - space process. The user - space process can first determine whether there is a file system on the hard disk. If there is no file system, the hard - disk file system (such as xfs, ext4, etc.) is formatted; if the hard disk already has a file system, it will try to obtain the hard - disk information from the hard - disk label. If the hard - disk information cannot be read from the hard - disk label, it will try to read the hard - disk information from the hard - disk reserved space. After obtaining the hard - disk information, a second check is performed. If the second check fails, the kernel is notified to intercept the hard - disk IO (all IO operations on this hard disk will return failures).
[0075] After hard - disk formatting (if there is no file system on the hard disk and the hard - disk file system is formatted, the second check may not be performed) or the hard - disk information passes the check, new hard - disk information can be obtained from the current server and updated to the hard - disk label and the hard - disk reserved space. The hard - disk label and the hard - disk reserved space are backed up each other, ensuring the reliability of the hard - disk information. Then, the physical lock of the target hard disk is locked, and finally, the target hard disk is mounted and connected to the service.
[0076] When the target hard disk is hot - removed, first, the hard disk is operated to go offline on the cloud - storage operation and maintenance interface. When the user - space process obtains the hard - disk offline command, all the read - write handles related to the business on the target hard disk are closed to ensure that there are no IO operations related to the business on the target hard disk. Then, the user - space process unmounts the file system of the target hard disk, notifies the kernel to intercept all IO operations of the target hard disk, and issues an instruction to unlock the physical lock of the target hard disk. Finally, the target hard disk can be normally removed. Through the above operations, it is beneficial to ensure that when there is IO on the target hard disk, the target hard disk cannot be removed or mis - removed, and at the same time, when the target hard disk is removed, there are no IO operations on the hard disk, ensuring the reliability and stability of the hard - disk file system and the server system when the hard disk is removed.
[0077] Those skilled in the art can understand that in the above - mentioned method of the specific implementation manner, the writing order of each step does not mean a strict execution order that constitutes any limitation to the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0078] Please refer to Figure 5 , Figure 5 which is a schematic diagram of the framework of an embodiment of the electronic device of the present application. The electronic device 40 includes a memory 41 and a processor 42 which are coupled to each other. The processor 42 is configured to execute program instructions stored in the memory 41 to implement the steps in any of the above embodiments of the hard disk drift management method. In a specific implementation scenario, the electronic device 40 may include, but is not limited to, a microcomputer, a server. In addition, the electronic device 40 may also include mobile devices such as a laptop computer, a tablet computer, etc., which are not limited herein.
[0079] Specifically, the processor 42 is configured to control itself and the memory 41 to implement the steps in any of the above embodiments of the hard disk drift management method. The processor 42 may also be referred to as a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Additionally, the processor 42 may be implemented jointly by integrated circuit chips.
[0080] In the above solution, by performing the first check and the second check on the target hard disk respectively, and mounting the target hard disk to the storage system only when both the first check and the second check pass, it is possible to determine that the target hard disk inserted into the current server is compatible with the current server in both the kernel state and the user state by comparing the hard disk information of the target hard disk with the relevant information of the current server, thereby reducing the storage system anomalies caused by hot plugging of the hard disk.
[0081] Please refer to Figure 6 , Figure 6 which is a schematic diagram of the framework of an embodiment of the computer-readable storage medium of the present application. The computer-readable storage medium 50 stores program instructions 501 that can be run by a processor. The program instructions 501 are used to implement the steps in any of the above embodiments of the hard disk drift management method.
[0082] In the above solution, by performing the first verification and the second verification on the target hard disk respectively, and mounting the target hard disk to the storage system only when both the first verification and the second verification are passed, it is possible to determine that the target hard disk inserted into the current server is compatible with the current server in both the kernel mode and the user mode by comparing the hard disk information of the target hard disk with the relevant information of the current server, thereby reducing the storage system anomalies caused by hot plugging of the hard disk.
[0083] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0084] The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments. Their similarities or similarities can be referred to each other. For the sake of brevity, they will not be repeated in this article.
[0085] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation manners described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.
[0086] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0088] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A hard disk drift management method, characterized in that Applied to a storage system, the method includes: Reading the hard disk information of the target hard disk; Performing a first verification on the target hard disk based on the hard disk information to obtain a first verification result; the first verification is used to determine whether the target hard disk supports the current server in the kernel state; In response to the first verification result indicating that the verification passes, performing a second verification on the target hard disk to obtain a second verification result, and mounting the target hard disk to the current server when the second verification result indicates that the verification passes; the second verification is used to determine whether the target hard disk supports the current server in the user state.
2. The hard disk drift management method according to claim 1, characterized in that The method further includes: In response to a hard disk offline command, unmounting the file system corresponding to the target hard disk from the current server and intercepting read and write operations on the target hard disk.
3. The hard disk drift management method according to claim 2, wherein The step of, in response to a hard disk offline command, unmounting the file system corresponding to the target hard disk from the current server and intercepting read and write operations on the target hard disk includes: In response to a hard disk offline command, closing the business read and write handle of the target hard disk corresponding to the offline command, unmounting the file system corresponding to the target hard disk from the current server, and intercepting read and write operations on the target hard disk.
4. The hard disk drift management method according to claim 1, characterized in that, The method further includes: Intercepting read and write operations on the target hard disk when the first verification result or the second verification result indicates that the verification fails.
5. The hard disk drift management method according to claim 1, characterized in that Before reading the hard disk information of the target hard disk, the method further includes: In response to a hard disk insertion event, determining whether there is reserved space in the target hard disk; the reserved space is used to store the hard disk information; In response to the target hard disk not having the reserved space, performing a space reservation operation on the target hard disk and writing the hard disk information corresponding to the current server into the reserved space; The step of reading the hard disk information of the target hard disk includes: In response to the target hard disk having the reserved space, reading the hard disk information from the reserved space.
6. The hard disk drift management method according to claim 1, characterized in that, Before, in response to the first verification result indicating that the verification passes, performing a second verification on the target hard disk to obtain a second verification result, the method further includes: Determining whether the target hard disk has a file system.
7. The hard disk drift management method according to claim 6, wherein The step of performing a second verification on the target hard disk to obtain a second verification result includes: In response to the target hard disk not having the file system, performing a formatting operation on the target hard disk, updating the hard disk label and the hard disk information in the reserved space based on the verification information of the current storage system, and obtaining the second verification result indicating that the verification passes; the verification information of the storage system is used to fill the hard disk information.
8. The hard disk drift management method according to any one of claims 6-7, characterized in that, The step of, in response to the second verification result indicating that the verification passes, mounting the target hard disk to the current server includes: In response to the second verification result indicating that the verification passes, updating the hard disk label and the hard disk information in the reserved space based on the verification information of the current storage system, and mounting the target hard disk to the current server; wherein, the verification information of the storage system is used to fill the hard disk information.
9. An electronic device, characterized in that, Comprising a mutually coupled memory and a processor, the processor is configured to execute program instructions stored in the memory to implement the hard disk drift management method according to any one of claims 1 to 8.
10. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by the processor, the hard disk drift management method according to any one of claims 1 to 8 is implemented.