A method, device, computer equipment and storage medium for replacing a disk

By obtaining a list of disk slot IDs and generating drive letters, automated disk replacement is achieved, solving the problems of low efficiency and high error rate in existing disk replacement technologies and improving replacement efficiency and accuracy.

CN116521058BActive Publication Date: 2026-05-29HANGZHOU WOQU NETWORK TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU WOQU NETWORK TECH
Filing Date
2022-05-31
Publication Date
2026-05-29

Smart Images

  • Figure CN116521058B_ABST
    Figure CN116521058B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of disk replacement, in particular to a control method and device for replacing a disk, computer equipment and a storage medium, wherein the method comprises the following steps: obtaining a target disk slot ID list according to a disk insertion request; obtaining target disk information corresponding to any target disk slot ID in the target disk slot ID list according to the target disk slot ID list; generating a target disk drive letter corresponding to the target disk slot ID according to the target disk information; and performing target disk replacement processing on the target disk of the target disk slot ID according to the target disk drive letter, wherein the target disk is determined to be a newly inserted disk by comparing the target disk drive letter with a preset disk drive letter, and then a disk replacement program is executed to process the newly inserted disk, so that automatic disk replacement is realized, the low efficiency and high error rate caused by traditional manual disk processing are avoided, and the disk replacement efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This invention patent application enjoys priority to "CN202210607028.6 A method, apparatus, computer equipment and storage medium for replacing a disk"; Technical Field

[0002] This invention relates to the field of disk replacement technology, and in particular to a control method, apparatus, computer equipment, and storage medium for replacing disks. Background Technology

[0003] With the rapid development of computer technology, distributed storage clusters for massive data storage have been widely used in various industries. In particular, massive amounts of data are stored on the disks of devices. When a disk malfunctions, it needs to be replaced to prevent device failure due to disk damage.

[0004] In existing technologies, after a new disk is inserted, the disk is usually manually processed, such as partitioning and mounting, which results in low efficiency and a high error rate.

[0005] Therefore, how to effectively solve the problem of automatic disk replacement is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] To address the aforementioned technical problems, this invention protects a control method for replacing a hard disk, the method comprising:

[0007] Based on the disk insertion request, obtain the list of target disk slot IDs;

[0008] Based on the target disk slot ID list, obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list;

[0009] Based on the target disk information, generate the target disk drive letter corresponding to the target disk slot ID;

[0010] Based on the target disk drive letter, perform target disk swapping on the target disk with the target disk slot ID. This step further includes the following steps:

[0011] Get the list of preset disk slot IDs;

[0012] Based on the target disk slot ID, obtain a list of preset disk drive letters corresponding to the preset disk slot ID, wherein the list of preset disk drive letters includes at least two preset disk drive letters;

[0013] Iterate through the preset disk drive letter list and obtain the key disk drive letter from the preset disk drive letter list;

[0014] When the target disk drive letter is consistent with the key disk drive letter, the target disk corresponding to the target disk drive letter is subjected to a first disk swapping process, which is a disk mounting process.

[0015] When the target disk drive letter is inconsistent with the key disk drive letter, a second disk swapping process is performed on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the key disk drive letter. The second disk swapping process includes: disk initialization process, disk partitioning process, and disk mounting process.

[0016] The present invention also protects a control device for replacing a disk, the device comprising:

[0017] The first acquisition module is used to obtain a list of target disk slot IDs based on the disk insertion request;

[0018] The information acquisition module is used to obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list.

[0019] The drive letter generation module is used to generate the target disk drive letter corresponding to the target disk slot ID based on the target disk information.

[0020] A disk swapping module is used to perform target disk swapping processing on a target disk based on the target disk drive letter and the target disk slot ID. The disk swapping module includes:

[0021] The second acquisition module is used to acquire a list of preset disk slot IDs;

[0022] The third acquisition module is used to acquire a list of preset disk drive letters corresponding to the preset disk slot ID based on the target disk slot ID, wherein the list of preset disk drive letters includes at least two preset disk drive letters;

[0023] The second drive letter acquisition module is used to traverse the preset disk drive letter list and obtain the key disk drive letter from the preset disk drive letter list;

[0024] The first execution module is used to perform a first disk swapping process on the target disk corresponding to the target disk when the target disk drive letter is consistent with the key disk drive letter. The first disk swapping process is the disk mounting process.

[0025] The second execution module is used to perform a second disk swapping process on the target disk corresponding to the target disk drive letter when the target disk drive letter is inconsistent with the key disk drive letter, based on the disk information corresponding to the key disk drive letter. The second disk swapping process includes: disk initialization processing, disk partitioning processing, and disk mounting processing.

[0026] The present invention protects a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described disk replacement control method.

[0027] The present invention protects a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described disk replacement control method.

[0028] Compared with existing technologies, this invention has significant advantages and beneficial effects. Through the above technical solution, the disk replacement control method, device, computer equipment, and storage medium provided by this invention achieve considerable technological advancement and practicality, and have broad industrial application value. It possesses at least the following advantages:

[0029] This invention discloses a control method, apparatus, computer device, and storage medium for replacing a disk. The method includes: obtaining a list of target disk slot IDs based on a disk insertion request; obtaining target disk information corresponding to any target disk slot ID in the target disk slot ID list; generating a target disk drive letter corresponding to the target disk slot ID based on the target disk information; and performing target disk replacement processing on the target disk of the target disk slot ID based on the target disk drive letter. Specifically, the target disk drive letter is compared with a preset disk drive letter to determine if the target disk is a newly inserted disk, and then a disk replacement program is executed to process the newly inserted disk. This achieves automatic disk replacement, avoiding the low efficiency and high error rate caused by traditional manual disk processing, and improving disk replacement efficiency and accuracy.

[0030] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0031] Figure 1 This is a flowchart of a disk replacement control method provided in Embodiment 1 of the present invention;

[0032] Figure 2 This is a flowchart of step S600 provided in Embodiment 1 of the present invention;

[0033] Figure 3 This is a flowchart of step S700 provided in Embodiment 1 of the present invention;

[0034] Figure 4A flowchart of another S700 step provided in Embodiment 1 of the present invention;

[0035] Figure 5 This is a flowchart for determining whether the target disk drive letter is consistent with the preset disk drive letter, provided in Embodiment 1 of the present invention;

[0036] Figure 6 This is a flowchart of step S705 provided in Embodiment 1 of the present invention;

[0037] Figure 7 This is a flowchart of step S709 provided in Embodiment 1 of the present invention;

[0038] Figure 8 This is a schematic diagram of a control device for replacing a hard disk provided in Embodiment 2 of the present invention;

[0039] Figure 9 This is a schematic diagram of the structure of module 60 provided in Embodiment 2 of the present invention;

[0040] Figure 10 This is a schematic diagram of the structure of module 70 provided in Embodiment 2 of the present invention;

[0041] Figure 11 This is a schematic diagram of the structure of another module 70 provided in Embodiment 2 of the present invention;

[0042] Figure 12 This is a schematic diagram of the determining module provided in Embodiment 1 of the present invention;

[0043] Figure 13 This is a schematic diagram of the structure of module 75 provided in Embodiment 2 of the present invention;

[0044] Figure 14 This is a schematic diagram of the structure of module 79 provided in Embodiment 2 of the present invention. Detailed Implementation

[0045] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the following detailed description, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementation and effects of a data processing system for obtaining target location proposed according to the present invention.

[0046] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0047] Example 1

[0048] like Figure 1 As shown in the figure, this embodiment provides a control method for replacing a disk, the method including the following steps:

[0049] S100. Obtain the target disk slot ID list based on the disk insertion request.

[0050] Specifically, the disk insertion request is determined by a preset daemon process in the system monitoring the disk slot. Those skilled in the art know the method by which the daemon process monitors the disk slot, and it will not be described in detail here.

[0051] Furthermore, the preset daemon process is the udev daemon process.

[0052] Specifically, the target disk slot ID list refers to a data list constructed based on the target disk slot ID, where the target disk slot ID is a unique device identifier for the target disk slot, and the target disk slot is a preset disk slot for re-inserting the disk.

[0053] Furthermore, the preset disk slots refer to all disk slots that can be monitored by the preset daemon process in the system.

[0054] S300: Based on the target disk slot ID list, obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list.

[0055] Specifically, the target disk information refers to the disk information of the target disk, which includes the disk type, the kernel device name corresponding to the disk, etc. For example, the kernel device name can be the disk device name in the Linux kernel driver.

[0056] Furthermore, the target disk refers to the disk currently inserted into the target disk slot.

[0057] S500. Generate the target disk drive letter corresponding to the target disk slot ID based on the target disk information. Those skilled in the art will know that any method for generating a disk drive letter based on disk information is within the protection scope of this invention, and will not be described in detail here.

[0058] Specifically, the steps preceding S700 also include:

[0059] S600: Based on the storage space of the target disk and the storage space of the initial disk, determine to execute step S700.

[0060] like Figure 2 As shown, step S600 also includes the following steps:

[0061] S601. Obtain the storage space of the target disk and the storage space of the initial disk, wherein the initial disk refers to the disk that is first inserted into the disk slot;

[0062] S603. When the storage space of the target disk is less than the storage space of the initial disk, issue a prompt message and stop the target disk swapping process.

[0063] S605. When the storage space of the target disk is not less than the storage space of the initial disk, proceed to step S700.

[0064] In the above embodiments, by comparing the space of the target disk with the space of the initial disk, it is determined whether to perform disk swapping, thus avoiding the inability to perform disk swapping due to the small space of the newly inserted disk, thereby improving the efficiency and accuracy of disk swapping.

[0065] S700: Based on the target disk drive letter, perform target disk swapping on the target disk with the target disk slot ID.

[0066] like Figure 3 As shown, step S700 also includes the following steps:

[0067] S701. Obtain a list of preset disk slot IDs, wherein each preset disk slot ID in the list corresponds to only a single preset disk drive letter.

[0068] Specifically, the preset disk slot ID list refers to a data list constructed based on preset disk slot IDs, wherein the preset disk slot ID is a unique identifier of the preset disk slot.

[0069] S703. Based on the target disk slot ID, obtain the preset disk drive letter corresponding to the preset disk slot ID from the preset disk slot ID list; this can be understood as: when the target disk slot ID is consistent with any preset disk slot ID, obtain the preset disk drive letter corresponding to the preset disk slot ID.

[0070] Specifically, the preset disk drive letter refers to the unique identifier of the preset disk, such as the disk's serial number.

[0071] S705. When the target disk drive letter is consistent with the preset disk drive letter, the first disk swapping process is performed on the target disk corresponding to the target disk drive letter.

[0072] S707. When the target disk drive letter is inconsistent with the preset disk drive letter, a second disk swapping process is performed on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the preset disk.

[0073] Specifically, the target disk swapping process includes a first disk swapping process and a second disk swapping process. The first disk swapping process is a disk mounting process, and the second disk swapping process includes: disk initialization process, disk partitioning process, and disk mounting process.

[0074] like Figure 4 As shown, the method further includes the following step: determining whether the target disk drive letter matches the preset disk drive letter:

[0075] S1. Obtain the target editing distance between the target disk drive letter and the preset disk drive letter;

[0076] S3. When the target editing distance is not greater than the preset distance threshold, the target disk drive letter is determined to be consistent with the preset disk drive letter;

[0077] S5. When the target editing distance is greater than the preset distance threshold, it is determined that the target disk drive letter is inconsistent with the preset disk drive letter.

[0078] Preferably, the distance threshold is 0, which can accurately determine whether the target disk drive letter is consistent with the preset disk drive letter.

[0079] like Figure 5 As shown, in another specific embodiment, step S700 further includes the following step:

[0080] S701. Obtain the list of preset disk slot IDs.

[0081] S703. Based on the target disk slot ID, obtain a list of preset disk drive letters corresponding to the preset disk slot ID, wherein the list of preset disk drive letters includes at least two preset disk drive letters; this can be understood as: any preset disk slot ID corresponds to more than just a single preset disk drive letter, and can retain information on all disks inserted into any preset disk slot, which is beneficial for improving the efficiency and accuracy of disk replacement in the future.

[0082] S705. Traverse the preset disk drive letter list and obtain the key disk drive letter from the preset disk drive letter list.

[0083] like Figure 6 As shown, step S705 also includes the following steps:

[0084] S7051. Obtain the target time of the target disk drive letter based on the target disk information.

[0085] Specifically, the target time refers to the point in time when the target disk is inserted into the disk slot.

[0086] S7053. Based on the target time point and the preset disk drive letter list, obtain the preset time interval list corresponding to the preset disk drive letter list, wherein the preset time interval in the preset time interval list refers to the time interval between the target time and the preset time corresponding to each preset disk drive letter in the preset disk drive letter list.

[0087] Specifically, the preset time refers to the time point corresponding to each preset disk being inserted into the disk slot.

[0088] S7055. Traverse the list of preset time intervals and obtain the preset disk drive letter corresponding to the smallest preset time interval in the list as the key disk drive letter.

[0089] In the above embodiments, based on the time point of the target disk drive letter, the preset disk drive letter closest to the time point of the target disk drive letter is determined from the preset disk drive letter list. This enables the comparison of adjacent disk drive letters corresponding to the same disk slot to determine whether the currently inserted disk is a new disk.

[0090] S707. When the target disk drive letter is consistent with the key disk drive letter, perform the first disk swapping process on the target disk corresponding to the target disk drive letter.

[0091] S709. When the target disk drive letter is inconsistent with the key disk drive letter, a second disk swapping process is performed on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the key disk drive letter.

[0092] Specifically, the method for determining whether the target disk drive letter is consistent with the key disk drive letter can refer to the method for determining whether the target disk drive letter is consistent with the preset disk drive letter in the above embodiments, and will not be repeated here.

[0093] like Figure 7 As shown, step S709 also includes the following steps:

[0094] S7091. Obtain the list of preset time intervals;

[0095] S7093. When the preset time interval is less than the preset time interval threshold, an intermediate disk drive letter list is generated based on the preset disk drive letter corresponding to the preset time interval.

[0096] S7095. Traverse the intermediate disk drive letter list and when all intermediate disk drive letters are inconsistent with the target disk drive letter, perform a second disk swapping process on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the key disk drive letter.

[0097] S7097. When the intermediate disk drive letter is the same as the target disk drive letter, perform the first disk swapping process on the target disk corresponding to the target disk drive letter.

[0098] Furthermore, the intermediate disk drive letter refers to the preset disk drive letter corresponding to the preset time interval when the preset time interval is less than a preset time interval threshold.

[0099] In the above embodiments, by adjusting the time interval, when the disk is only removed for a short time, the disk replacement process can be reduced. When the disk is reinserted into the slot, only mounting is required, which simplifies the process and improves disk replacement efficiency and accuracy.

[0100] Preferably, in step S700, when performing target disk swapping on the target disk drive letter, the target disk drive letter replaces the preset disk drive letter or is inserted into the preset disk drive letter list; this updates the preset disk drive letter or the preset disk drive letter list, so that when a new disk is inserted into the disk slot, it can accurately and effectively determine whether a second disk swapping process needs to be performed, thereby improving the efficiency and accuracy of disk swapping.

[0101] This embodiment provides a control method for replacing a disk. The method includes: obtaining a list of target disk slot IDs based on a disk insertion request; obtaining target disk information corresponding to any target disk slot ID in the list of target disk slot IDs; generating a target disk drive letter corresponding to the target disk slot ID based on the target disk information; and performing target disk replacement processing on the target disk of the target disk slot ID based on the target disk drive letter. Specifically, the target disk drive letter is compared with a preset disk drive letter to determine whether the target disk is a newly inserted disk, and then a disk replacement program is executed to process the newly inserted disk. This achieves automatic disk replacement, avoiding the low efficiency and high error rate caused by traditional manual disk processing, and improving disk replacement efficiency and accuracy.

[0102] like Figure 8 As shown, this embodiment provides a control device for replacing a hard disk, the device comprising:

[0103] The first acquisition module 10 is used to acquire a list of target disk slot IDs based on the disk insertion request.

[0104] Specifically, the disk insertion request is determined by a preset daemon process in the system monitoring the disk slot. Those skilled in the art know the method by which the daemon process monitors the disk slot, and it will not be described in detail here.

[0105] Furthermore, the preset daemon process is the udev daemon process.

[0106] Specifically, the target disk slot ID list refers to a data list constructed based on the target disk slot ID, where the target disk slot ID is a unique device identifier for the target disk slot, and the target disk slot is a preset disk slot for re-inserting the disk.

[0107] Furthermore, the preset disk slots refer to all disk slots that can be monitored by the preset daemon process in the system.

[0108] The information acquisition module 30 is used to acquire target disk information corresponding to any target disk slot ID in the target disk slot ID list.

[0109] Specifically, the target disk information refers to the disk information of the target disk, which includes the disk type, the kernel device name corresponding to the disk, etc. For example, the kernel device name can be the disk device name in the Linux kernel driver.

[0110] Furthermore, the target disk refers to the disk currently inserted into the target disk slot.

[0111] The drive letter generation module 50 is used to generate a target disk drive letter corresponding to the target disk slot ID based on the target disk information. Those skilled in the art will know that any method for generating a disk drive letter based on disk information is within the protection scope of this invention, and will not be described in detail here.

[0112] Specifically, prior to the disk swapping module 70, the following are also included:

[0113] The determination module 60 is used to determine the disk swapping module 70 to execute based on the storage space of the target disk and the storage space of the initial disk.

[0114] like Figure 9 As shown, the determining module 60 further includes:

[0115] Storage space acquisition module 61 is used to acquire the storage space of the target disk and the storage space of the initial disk, wherein the initial disk refers to the disk that is first inserted into the disk slot;

[0116] The third execution module 63 is used to issue a prompt message and stop the target disk swapping process when the storage space of the target disk is smaller than the storage space of the initial disk.

[0117] The fourth execution module 65 is used to execute the disk swapping module 70 when the storage space of the target disk is not less than the storage space of the initial disk.

[0118] In the above embodiments, by comparing the space of the target disk with the space of the initial disk, it is determined whether to perform disk swapping, thus avoiding the inability to perform disk swapping due to the small space of the newly inserted disk, thereby improving the efficiency and accuracy of disk swapping.

[0119] The disk swapping module 70 is used to perform target disk swapping processing on the target disk slot ID based on the target disk drive letter.

[0120] like Figure 10 As shown, the disk changing processing module 70 further includes:

[0121] The second acquisition module 71 is used to acquire a list of preset disk slot IDs, wherein each preset disk slot ID in the list of preset disk slot IDs corresponds to only a single preset disk drive letter.

[0122] Specifically, the preset disk slot ID list refers to a data list constructed based on preset disk slot IDs, wherein the preset disk slot ID is a unique identifier of the preset disk slot.

[0123] The first drive letter acquisition module 73 is used to obtain the preset disk drive letter corresponding to the preset disk slot ID from the preset disk slot ID list according to the target disk slot ID; it can be understood that: when the target disk slot ID is consistent with any preset disk slot ID, the preset disk drive letter corresponding to the preset disk slot ID is obtained.

[0124] Specifically, the preset disk drive letter refers to the unique identifier of the preset disk, such as the disk's serial number.

[0125] The first execution module 75 is used to perform a first disk swapping process on the target disk corresponding to the target disk when the target disk drive letter is consistent with the preset disk drive letter;

[0126] The second execution module 77 is used to perform a second disk swapping process on the target disk corresponding to the target disk drive letter when the target disk drive letter is inconsistent with the preset disk drive letter, based on the disk information corresponding to the preset disk.

[0127] Specifically, the target disk swapping process includes a first disk swapping process and a second disk swapping process. The first disk swapping process is a disk mounting process, and the second disk swapping process includes: disk initialization process, disk partitioning process, and disk mounting process.

[0128] Furthermore, the device also includes:

[0129] The determination module is used to determine whether the target disk drive letter is consistent with the preset disk drive letter.

[0130] like Figure 11 As shown, the determination module includes:

[0131] Edit distance acquisition module 1 is used to acquire the target edit distance between the target disk drive letter and the preset disk drive letter;

[0132] The first determining module 3 is used to determine that the target disk drive letter is consistent with the preset disk drive letter when the target editing distance is not greater than a preset distance threshold.

[0133] The second determining module 5 is used to determine that the target disk drive letter is inconsistent with the preset disk drive letter when the target editing distance is greater than the preset distance threshold.

[0134] Preferably, the distance threshold is 0, which can accurately determine whether the target disk drive letter is consistent with the preset disk drive letter.

[0135] In another specific embodiment, step S700 further includes the following steps, such as... Figure 12 As shown:

[0136] The second acquisition module 71 is used to acquire a list of preset disk slot IDs.

[0137] The third acquisition module 73 is used to acquire a list of preset disk drive letters corresponding to a preset disk slot ID based on the target disk slot ID. The list of preset disk drive letters includes at least two preset disk drive letters. This can be understood as: any preset disk slot ID corresponds to more than just a single preset disk drive letter. It can retain information about all disks inserted into any preset disk slot, which is beneficial for improving the efficiency and accuracy of disk replacement in the future.

[0138] The second drive letter acquisition module 75 is used to traverse the preset disk drive letter list and obtain the key disk drive letter from the preset disk drive letter list.

[0139] Specifically, the second drive letter acquisition module 75 also includes, for example, Figure 13 As shown:

[0140] The time acquisition module 751 is used to acquire the target time of the target disk drive letter based on the target disk information.

[0141] Specifically, the target time refers to the point in time when the target disk is inserted into the disk slot.

[0142] The time interval acquisition module 753 is used to acquire a preset time interval list corresponding to the preset disk drive letter list based on the target time point and the preset disk drive letter list, wherein the preset time interval in the preset time interval list refers to the time interval between the target time and the preset time corresponding to each preset disk drive letter in the preset disk drive letter list.

[0143] Specifically, the preset time refers to the time point corresponding to each preset disk being inserted into the disk slot.

[0144] The drive letter determination module 755 is used to traverse the preset time interval list and obtain the preset disk drive letter corresponding to the smallest preset time interval in the preset time interval list as the key disk drive letter.

[0145] In the above embodiments, based on the time point of the target disk drive letter, the preset disk drive letter closest to the time point of the target disk drive letter is determined from the preset disk drive letter list. This enables the comparison of adjacent disk drive letters corresponding to the same disk slot to determine whether the currently inserted disk is a new disk.

[0146] The first execution module 77 is used to perform a first disk swapping process on the target disk corresponding to the target disk drive letter when the target disk drive letter is consistent with the key disk drive letter.

[0147] The second execution module 79 is used to perform a second disk swapping process on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the key disk drive letter when the target disk drive letter is inconsistent with the key disk drive letter.

[0148] Specifically, the method for determining whether the target disk drive letter is consistent with the key disk drive letter can refer to the method for determining whether the target disk drive letter is consistent with the preset disk drive letter in the above embodiments, and will not be repeated here.

[0149] Specifically, the second execution module 79 also includes, for example, Figure 14 As shown:

[0150] The time interval list acquisition module 791 is used to acquire the preset time interval list;

[0151] The intermediate disk drive letter list generation module 793 is used to generate an intermediate disk drive letter list based on the preset disk drive letters corresponding to the preset time interval when the preset time interval is less than the preset time interval threshold.

[0152] The fifth execution module 795 is used to traverse the intermediate disk drive letter list and, when all intermediate disk drive letters are inconsistent with the target disk drive letter, perform a second disk swapping process on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the key disk drive letter.

[0153] The sixth execution module 797 is used to perform the first disk swapping process on the target disk corresponding to the target disk when the intermediate disk drive letter is the same as the target disk drive letter.

[0154] Furthermore, the intermediate disk drive letter refers to the preset disk drive letter corresponding to the preset time interval when the preset time interval is less than a preset time interval threshold.

[0155] In the above embodiments, by adjusting the time interval, when the disk is only removed for a short time, the disk replacement process can be reduced. When the disk is reinserted into the slot, only mounting is required, which simplifies the process and improves disk replacement efficiency and accuracy.

[0156] Preferably, in the disk swapping module 70, when performing target disk swapping on the target disk drive letter, the target disk drive letter replaces the preset disk drive letter or is inserted into the preset disk drive letter list; this can update the preset disk drive letter or the preset disk drive letter list, so that when a new disk is inserted into the disk slot, it can accurately and effectively determine whether a second disk swapping process needs to be performed, thereby improving the efficiency and accuracy of disk swapping.

[0157] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0158] Based on the disk insertion request, obtain the list of target disk slot IDs;

[0159] Based on the target disk slot ID list, obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list;

[0160] Based on the target disk information, generate the target disk drive letter corresponding to the target disk slot ID;

[0161] Based on the target disk drive letter, perform target disk swapping on the target disk with the target disk slot ID.

[0162] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0163] Based on the disk insertion request, obtain the list of target disk slot IDs;

[0164] Based on the target disk slot ID list, obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list;

[0165] Based on the target disk information, generate the target disk drive letter corresponding to the target disk slot ID;

[0166] Based on the target disk drive letter, perform target disk swapping on the target disk with the target disk slot ID.

[0167] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0168] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0169] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for controlling disk replacement, characterized in that, The method includes: Based on the disk insertion request, obtain the list of target disk slot IDs; Based on the target disk slot ID list, obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list; Based on the target disk information, generate the target disk drive letter corresponding to the target disk slot ID; Based on the target disk drive letter, perform target disk swapping on the target disk with the target disk slot ID. This step further includes the following steps: Get the list of preset disk slot IDs; Based on the target disk slot ID, obtain a list of preset disk drive letters corresponding to the preset disk slot ID, wherein the list of preset disk drive letters includes at least two preset disk drive letters; Iterate through the preset disk drive letter list and obtain the key disk drive letter from the preset disk drive letter list; When the target disk drive letter is consistent with the key disk drive letter, the target disk corresponding to the target disk drive letter is subjected to a first disk swapping process, which is a disk mounting process. When the target disk drive letter is inconsistent with the key disk drive letter, a second disk swapping process is performed on the target disk corresponding to the target disk drive letter based on the disk information corresponding to the key disk drive letter. The second disk swapping process includes: disk initialization processing, disk partitioning processing, and disk mounting processing, and further includes the following steps: Get the list of preset time intervals; When the preset time interval is less than the preset time interval threshold, an intermediate disk drive letter list is generated based on the preset disk drive letter corresponding to the preset time interval. Traverse the list of intermediate disk drive letters and when all intermediate disk drive letters are inconsistent with the target disk drive letter, perform a second disk swapping process on the target disk corresponding to the key disk drive letter based on the disk information corresponding to the key disk drive letter. When the intermediate disk drive letter matches the target disk drive letter, perform the first disk swapping process on the target disk corresponding to the target disk drive letter.

2. The control method for replacing a disk according to claim 1, characterized in that, The step of traversing the preset disk drive letter list and obtaining the key disk drive letter from the preset disk drive letter list further includes the following steps: Based on the target disk information, obtain the target time point of the target disk drive letter; Based on the target time point and the preset disk drive letter list, obtain the preset time interval list corresponding to the preset disk drive letter list, wherein the preset time interval in the preset time interval list refers to the time interval between the target time point and the preset time corresponding to each preset disk drive letter in the preset disk drive letter column; Traverse the list of preset time intervals and obtain the preset disk drive letter corresponding to the smallest preset time interval in the list as the key disk drive letter.

3. A control device for replacing a hard disk, characterized in that, The device includes: The first acquisition module is used to obtain a list of target disk slot IDs based on the disk insertion request; The information acquisition module is used to obtain the target disk information corresponding to any target disk slot ID in the target disk slot ID list. The drive letter generation module is used to generate the target disk drive letter corresponding to the target disk slot ID based on the target disk information. A disk swapping module is used to perform target disk swapping processing on a target disk based on the target disk drive letter and the target disk slot ID. The disk swapping module includes: The second acquisition module is used to acquire a list of preset disk slot IDs; The third acquisition module is used to acquire a list of preset disk drive letters corresponding to the preset disk slot ID based on the target disk slot ID, wherein the list of preset disk drive letters includes at least two preset disk drive letters; The second drive letter acquisition module is used to traverse the preset disk drive letter list and obtain the key disk drive letter from the preset disk drive letter list; The first execution module is used to perform a first disk swapping process on the target disk corresponding to the target disk when the target disk drive letter is consistent with the key disk drive letter. The first disk swapping process is the disk mounting process. The second execution module is used to perform a second disk swapping process on the target disk corresponding to the target disk drive letter when the target disk drive letter is inconsistent with the key disk drive letter, based on the disk information corresponding to the key disk drive letter. The second disk swapping process includes: disk initialization processing, disk partitioning processing, and disk mounting processing. The second execution module further includes: The time interval list retrieval module is used to retrieve a list of preset time intervals; The intermediate disk drive letter list generation module is used to generate an intermediate disk drive letter list based on the preset disk drive letters corresponding to the preset time interval when the preset time interval is less than the preset time interval threshold. The fifth execution module is used to traverse the list of intermediate disk drive letters and, when all intermediate disk drive letters are inconsistent with the target disk drive letter, perform a second disk swapping process on the target disk corresponding to the key disk drive letter based on the disk information corresponding to the key disk drive letter. The sixth execution module is used to perform the first disk swapping process on the target disk corresponding to the target disk when the intermediate disk drive letter is the same as the target disk drive letter.

4. The control device for replacing the disk according to claim 3, characterized in that, The drive letter acquisition module includes: The time acquisition module is used to acquire the target time point of the target disk drive letter based on the target disk information; The time interval acquisition module is used to acquire a preset time interval list corresponding to the preset disk drive letter list based on the target time point and the preset disk drive letter list, wherein the preset time interval in the preset time interval list refers to the time interval between the target time point and the preset time corresponding to each preset disk drive letter in the preset disk drive letter column; The drive letter determination module is used to traverse the preset time interval list and obtain the preset disk drive letter corresponding to the smallest preset time interval in the preset time interval list as the key disk drive letter.

5. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the disk replacement control method as described in any one of claims 1 to 2.

6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the disk replacement control method as described in any one of claims 1 to 2.