Disk symbol calibration method and system, electronic device, and storage medium

CN117270756BActive Publication Date: 2026-10-27FULIAN PRESION ELECTRONICS (TIANJIN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210671763.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2026-10-27
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

操作人员或系统无法根据原有盘符对发生盘符漂移的硬盘内的文件进行查找或调用,存在使用不便的缺陷

Benefits of technology

[0015]本申请实现方式提供的盘符校准方法、系统、电子设备及存储介质,可以对各硬盘分配过渡盘符后,再根据过渡盘符的排序对各硬盘重新分配系统盘符,以解决盘符漂移的问题。重新分配的系统盘符与原系统盘符的格式相同,操作人员需要查找指定硬盘中的文件,或系统需要调取指定硬盘中的文件时,不需要考虑盘符漂移问题以对原先查找文件的目录进行修改,仍在原目录中即可获取指定的文件。可提高对硬盘内文件查找及调用的方便性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117270756B_ABST
    Figure CN117270756B_ABST
Patent Text Reader

Abstract

The application provides a disk symbol calibration method, system, electronic equipment and storage medium, which are used for calibrating system disk symbols corresponding to hard disks. The disk symbol calibration method comprises the following steps: obtaining the number of hard disks and device information, wherein the device information comprises slot information of the hard disks; allocating transition disk symbols to the hard disks according to the number of the hard disks and the device information, wherein the transition disk symbols comprise slot numbers corresponding to the slot information; and re-allocating system disk symbols to the hard disks in sequence according to the order of the transition disk symbols. Through the embodiments of the application, the transition disk symbols can be allocated to the hard disks after the slots corresponding to the hard disks are determined, and the system disk symbols can be re-allocated to the hard disks according to the transition disk symbols, so that the calibration of the system disk symbols is realized, and the convenience of file searching and calling in the hard disks is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically to a disk letter calibration method, system, electronic device, and storage medium for solving the problem of disk letter drift. Background Technology

[0002] A server has multiple hard drives for data storage, and can have multiple drive bays, allowing multiple hard drives to be connected to multiple drive bays. The server's processor can assign drive letters to the multiple hard drives connected to the drive bays according to preset rules. When an operator needs to read a file stored on a specific hard drive, or when the system needs to retrieve a file stored on a specific hard drive, it can obtain the file directory of the corresponding hard drive based on the drive letter and then retrieve the corresponding file from the directory.

[0003] Currently, in situations such as hot-swapping hard drives in their slots or malfunctions during system drive letter assignment, the system may not assign drive letters to the hard drives according to preset rules, resulting in drive letter drift. Operators or the system cannot search for or access files on the hard drive with the drifted drive letter based on the original drive letter, leading to inconvenience. Summary of the Invention

[0004] In view of the above, it is necessary to provide a drive letter calibration method, system, electronic device and storage medium, which calibrates the drive letters of each hard drive after determining the corresponding slot, thereby improving the convenience of searching and retrieving files on the hard drive.

[0005] In a first aspect, embodiments of this application provide a drive letter calibration method for calibrating the system drive letter corresponding to a hard drive. The drive letter calibration method includes: obtaining the number of hard drives and device information, wherein the device information includes the slot information of the hard drives; assigning transition drive letters to the hard drives according to the number of hard drives and the device information, wherein the transition drive letter includes a slot number corresponding to the slot information; and reassigning the system drive letter to the hard drives in sequence according to the order of the transition drive letters.

[0006] Optionally, the step of reassigning system drive letters to the hard drive in sequence according to the order of the transition drive letters includes: determining the first system drive letter based on the first transition drive letter, wherein the first transition drive letter is the first transition drive letter in sequence, and the first system drive letter is the first system drive letter assigned to the hard drive in sequence when reassigning system drive letters; and reassigning system drive letters to the hard drive in sequence according to the order of the first system drive letter and the transition drive letters.

[0007] Optionally, the device information further includes partition information, and the step of assigning a transitional drive letter to the hard drive based on the number of hard drives and the device information includes: determining whether the hard drive has partitions based on the partition information; if the hard drive has partitions, then assigning the transitional drive letter to multiple partitions of the hard drive; if the hard drive does not have partitions, then assigning the transitional drive letter to the hard drive.

[0008] Optionally, the transition drive letter includes a partition transition drive letter and a hard disk transition drive letter. The partition transition drive letter corresponds to a partition of the hard disk. The partition transition drive letter includes the slot number and the partition number. The partition number corresponds to the partition information.

[0009] Optionally, obtaining the number of hard drives and device information includes: obtaining the installation location of the hard drives; obtaining the number of hard drives and device information corresponding to the external slots in the installation location.

[0010] Optionally, the drive letter calibration method further includes: determining whether a trigger signal is acquired; if the trigger signal is acquired, then acquiring the number of hard drives and the device information.

[0011] Optionally, obtaining the number of hard drives and the device information corresponding to the external slots in the installation location includes: obtaining the device directory corresponding to the external slot, the device directory including subdirectories, the subdirectories corresponding to the hard drives; obtaining the number of hard drives based on the number of different device names in the device directory, wherein the device name is the part of the subdirectory name corresponding to the hard drive; obtaining the partition information of different hard drives based on the content and number of partition names in the subdirectories with the same device names in the device directory, wherein the partition name is the part of the subdirectory name corresponding to the partition; and obtaining the slot information in the name of the subdirectory.

[0012] Secondly, embodiments of this application also provide a drive letter calibration system for implementing the drive letter calibration method as described in any of the above claims, comprising: an acquisition module for acquiring the number of hard drives and device information; a first allocation module for allocating transitional drive letters to the hard drives according to the number of hard drives and the device information; and a second allocation module for reassigning system drive letters to the hard drives in sequence according to the order of the transitional drive letters.

[0013] Thirdly, embodiments of this application also provide an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program stored in the memory, wherein when the computer program is executed, the processor is configured to execute the disk calibration method as described in any of the preceding claims.

[0014] Fourthly, embodiments of this application also provide a storage medium comprising a computer program that, when run on an electronic device, causes the electronic device to perform the drive letter calibration method as described in any of the preceding claims.

[0015] The drive letter calibration method, system, electronic device, and storage medium provided in this application can assign transitional drive letters to each hard drive, and then reassign system drive letters to each hard drive according to the order of the transitional drive letters, thereby solving the problem of drive letter drift. The reassigned system drive letters have the same format as the original system drive letters. When operators need to find files on a specific hard drive, or when the system needs to retrieve files on a specific hard drive, there is no need to consider the drive letter drift problem and modify the original directory for searching files; the specified files can be retrieved within the original directory. This improves the convenience of searching and retrieving files on the hard drive. Attached Figure Description

[0016] Figure 1 This is a flowchart of the disk calibration method in the embodiments of this application.

[0017] Figure 2 This is another flowchart of the disk calibration method in the embodiments of this application.

[0018] Figure 3 This is another flowchart of the disk calibration method in the embodiments of this application.

[0019] Figure 4 This is another flowchart of the disk calibration method in the embodiments of this application.

[0020] Figure 5 This is a flowchart illustrating the disk calibration method in an embodiment of this application.

[0021] Figure 6 This is a schematic diagram of the disk calibration system in an embodiment of this application.

[0022] Figure 7 This is a schematic diagram of an electronic device in an embodiment of this application.

[0023] Explanation of main component symbols

[0024] Drive letter calibration system 100

[0025] Electronic equipment 200

[0026] First Acquisition Module 10

[0027] Second acquisition module 20

[0028] First allocation module 30

[0029] Second allocation module 40

[0030] Processor 50

[0031] Memory 60

[0032] Computer Program 61 Detailed Implementation

[0033] The technical solutions in the implementation of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described implementation is only a part of the implementation of this application, and not all of the implementations.

[0034] Please see Figure 1 , Figure 1 This is a flowchart illustrating a drive letter calibration method provided in one embodiment of this application. It can be understood that the drive letter calibration method is used to calibrate the system drive letter corresponding to the hard drive in a server, in order to solve the drive letter drift problem that occurs when the hard drive is hot-swapped in the slot or when the system malfunctions.

[0035] It's understandable that a server can have multiple hard drives. After the server system is running, it can assign multiple system drive letters to these drives according to preset rules. Operators can use the system drive letter to find the corresponding directory on the hard drive and read specific files from it. The server can also access files on a specified hard drive using the system drive letter when running programs.

[0036] For example, the server could be a Linux system, which assigns system drive letters based on the order in which the hard drives are scanned. System drive letters can be sda, sdb1, sdb2, ..., sdz, etc., where the order of the letters (a, b, etc.) corresponds to the order in which the system recognizes the multiple hard drives, and the numbers (1, 2, etc.) correspond to the preset partition numbers on each hard drive. The server can assign multiple system drive letters to multiple hard drives based on the alphabetical and numerical order of the system drive letters.

[0037] As we can understand, the drive letter drifting problem arises when a server fails to assign system drive letters to multiple hard drives as pre-defined. For example, it might reassign a drive that already has a system drive letter to another, causing system drive letter confusion. In cases of drive letter drifting, both operators and the Linux system struggle to access files on specific hard drives based on their original directories.

[0038] It's understandable that a Linux system can determine the hard drive's installation location—that is, which slot the hard drive is plugged into—based on pre-stored programs or open-source tools during runtime. The Linux system can then assign a system drive letter to the hard drive based on the order in which the hard drive is plugged into the server's slots.

[0039] For example, a Linux system can obtain the slot information of a hard drive. This slot information can be slot1, slot2, ..., slotn, where n is a constant. The numerical part 'n' in the slot information represents the nth slot in the server. This numerical part corresponds to the order in which the Linux system recognizes multiple hard drives. The Linux system can assign drive letters to multiple hard drives sequentially based on the order of these numerical parts in their slot information; for example, assigning drive letter 'sda' to the hard drive corresponding to slot1, drive letter 'sdb' to the hard drive corresponding to slot2, and so on.

[0040] It is understood that before the drive letter calibration method provided in the embodiments of this application is run, the Linux system has already completed the initial allocation of system drive letters.

[0041] In this embodiment, the disk calibration method can be run on processor 50 ( Figure 7 As shown in the diagram, the disk calibration method may include the following steps:

[0042] Step S11: Determine whether a trigger signal has been acquired. If a trigger signal has been acquired, proceed to step S12; otherwise, return to step S11 to re-determine whether a trigger signal has been acquired.

[0043] It is understood that after determining that a trigger signal has been acquired, the processor 50 will run other steps of the disk letter calibration method. The output terminal of the trigger signal is not limited in the embodiments of this application.

[0044] In the first implementation, the trigger signal can be automatically generated by the processor 50. For example, the trigger signal can be automatically generated at a time preset by the operator. Alternatively, the trigger signal can be set to be automatically generated when the server is powered on. Another example is that the trigger signal can be automatically generated after the processor 50 determines that a hard drive is missing from a slot or a new hard drive has been added to a slot, i.e., a hot-swap has occurred in a slot.

[0045] It is understandable that the processor 50 can monitor whether hot-swapping of hard drives has occurred in the slots based on preset programs or open-source tools. Since hot-swapping of hard drives is a major cause of drive letter drift, it is necessary to calibrate the system drive letters through other steps in the drive letter calibration method after a hot-swapping of a hard drive occurs to resolve the drive letter drift problem.

[0046] In the second implementation, the trigger signal can be output by the operator to the processor 50 through a user terminal (not shown in the figure). The user terminal can be communicatively connected to the processor 50. The user terminal can be an electronic device 200 with human-computer interaction, data processing, and communication functions, and can be, but is not limited to, personal computers, smartphones, tablets, smartwatches, etc.

[0047] It is understood that the communication connection can be a wireless communication connection implemented through a wireless network, or a wired communication connection implemented through a power line, data cable, etc. The embodiments of this application do not limit this.

[0048] In the third implementation, the trigger signal can be output from a detection device (not shown in the figure) to the processor 50. The detection device is communicatively connected to the processor 50. The detection device is used to detect whether a hard drive has been inserted or removed from the slot. The detection device can be a sensor with object motion detection function, and the detection device can be, but is not limited to, an infrared sensor, etc.

[0049] It is understandable that after the detection device detects movement of the hard drive in the slot, it outputs a trigger signal to the processor 50. When the server is working, hot-swapping of hard drives can easily cause system drive letter drift. Therefore, at this time, the processor 50 can run other steps of the drive letter calibration method to calibrate the system drive letter.

[0050] Step S12: Obtain the number and device information of at least some of the hard drives.

[0051] It is understandable that device information can include slot information and partition information. Slot information corresponds to the slot where the hard drive is plugged in. Partition information corresponds to whether the hard drive has partitions, the number of partitions, and their sequence numbers.

[0052] It is understandable that operators can partition a hard drive according to file classification needs, thereby creating multiple independent storage spaces within a single hard drive. When partitioning the hard drive, the operator has already set the storage capacity of each partition, the number of partitions, and the partition number. That is, before the drive letter calibration method provided in this application embodiment is run, the partitioning has already been completed, and the number and sequence of partitions are known information.

[0053] It is understandable that the installation location of a hard drive on a server can include both a physical drive bay and an external drive bay. A physical drive bay can be a bay on the server's motherboard, while an external drive bay can be a bay attached to an external device mounted on the motherboard. The hard drives can include a first hard drive and a second hard drive; the first hard drive is inserted into the physical drive bay, and the second hard drive is inserted into the external drive bay.

[0054] It's understandable that a server motherboard can have one or more slots. Hard drives plugged into these slots can be used to store Linux system programs. The server motherboard can also accommodate external devices with slots, such as Host Bus Adapters (HBAs) and their accessories. Hard drives plugged into these external device slots can be used to store files, programs, etc., needed by the operator.

[0055] It is understandable that when both the main drive bay and the external drive bay have hard drives connected, when the server powers on, the processor 50 first assigns a system drive letter to the first hard drive in the main drive bay, then obtains information from the external device, and continues to assign system drive letters to the second hard drive in the external drive bay based on the information from the external device. The information from the external device can include the number of second hard drives and device information in the external drive bay. At this time, the system drive letter of the first hard drive in the main drive bay does not have a drive letter drift problem due to system failure or hard drive hot-swapping, while the system drive letter of the second hard drive in the external drive bay does have a drive letter drift problem due to system failure or hard drive hot-swapping. System failures can include faults caused by information fed back to the processor 50 from the external device, faults caused by the processor reading errors from the information fed back to the external device, etc. Therefore, at least some of the hard drives mentioned in step S12 can be second hard drives.

[0056] In this embodiment, the first hard drive can be a hard drive storing the server's system operating software, for example, a hard drive storing Linux system operating software. The second hard drive can be used to store files, programs, etc., required by the operators.

[0057] It is understood that the embodiments of this application do not limit the number of the first hard disk and the second hard disk.

[0058] It is understandable that in the above scenario, the first hard drive does not have a drive letter drifting problem due to system failure or hot-swapping, while the second hard drive may have a drive letter drifting problem due to system failure or hot-swapping.

[0059] Please see Figure 2 In the above scenario, the method for obtaining the number of at least some hard drives and device information may include the following steps S21 and S22:

[0060] Step S21: Obtain the installation locations of multiple hard drives.

[0061] It is understandable that the installation location of each hard drive can be obtained using a pre-set program or open-source tool. For example, the slot information of each hard drive can be obtained using a pre-set program or open-source tool. The number and serial number of the main drive slots and the number and serial number of the external drive slots in the server are known before the drive letter calibration method is run. That is, the slot information corresponding to the main drive slots can be known, and the slot information corresponding to the external drive slots can also be known. Therefore, when the processor 50 obtains the slot information, it can simultaneously determine whether the hard drive corresponding to that slot is located in a main drive slot or an external drive slot.

[0062] Step S22: Obtain the number of second hard drives and device information.

[0063] It can be understood that in the scenario where the first hard drive is plugged into the main slot and the second hard drive is plugged into the external slot, the second hard drive is at least a portion of the hard drive mentioned in step S12.

[0064] It is understandable that when the Linux system is running, the processor 50 can obtain the number of hard drives on the external slots and the device information of each hard drive corresponding to the external slot through pre-stored programs or open-source tools.

[0065] For example, on a server running a Linux system and connected to an external host bus adapter and its accessories, the processor 50 can use the preset command "lsscsi -ktL" or "udevadm info -q path" to query the number of hard drives and device information plugged into the slots of the host bus adapter and its accessories in the / sys / class / block directory, that is, the number of second hard drives and their device information.

[0066] In this embodiment, the processor 50 can obtain the device directory corresponding to the second hard drive through a pre-stored program or open-source tools. The device directory includes one or more subdirectories. When multiple subdirectories exist, the subdirectories correspond to multiple second hard drives or multiple partitions of the second hard drives. The name of the subdirectory may include the device name, partition name, and slot information. The device name corresponds to the hard drive, and the partition name corresponds to the partition in the hard drive.

[0067] It's understandable that subdirectory names can include the current system drive letter. The format and content of device names can be the same as the English part of the system drive letter, and the format and content of partition names can be the same as the numeric part of the system drive letter. For example, system drive letters can be sda, sdb1, sdb2, ..., sdz, etc., where the order of the English letters a, b, etc., corresponds to the order in which the system recognizes multiple hard drives, and the numbers 1, 2, etc., correspond to the preset partition numbers on each partition; in this case, the device names are sda, sdb, ..., sdz, etc., and the partition names are 1, 2, etc.

[0068] In this embodiment, the processor 50 can obtain the number of hard disks based on the number of different device names in the device catalog. For example, the device names can be sda, sdb, ... sdz, etc. The processor counts the different English letters that appear in the last character of the device name, and the count result is the number of hard disks.

[0069] In this embodiment, the processor 50 can obtain the partition information corresponding to each second hard disk based on the number of subdirectories in the device directory that have the same name as each device, and the contents of the partition names in the multiple subdirectories with the same device name. For example, if there are 3 subdirectories with the device name sdb, and the partition names in the three subdirectories are 1, 2, and 3 respectively, it can be determined that the second hard disk corresponding to the device name sdb has 3 partitions, with partition numbers 1, 2, and 3 respectively.

[0070] In this embodiment, the naming of subdirectories may include system drive letter and slot information.

[0071] It is understood that the names of multiple subdirectories can appear simultaneously and completely in the device directory. The embodiments of this application do not limit the order in which the steps of obtaining the number of hard disks, obtaining partition information and obtaining slot information are executed.

[0072] It's understandable that the first hard drive doesn't experience drive letter drifting due to system failure or hot-swapping, while the second hard drive might. Therefore, we can resolve the system drive letter drifting issue by only obtaining the number and device information of the second hard drive, without considering the device information of the first hard drive. Reducing the amount of device information required improves the efficiency of the drive letter calibration method.

[0073] Step S13: Assign a transitional drive letter to the second hard drive based on the number of second hard drives and device information.

[0074] It can be understood that the hard drive that has obtained device information is the second hard drive mentioned in step S22.

[0075] It is understood that a transitional drive letter can be a drive letter with a format different from the system drive letter. In this embodiment, the transitional drive letter may include a slot number. The slot number corresponds to the slot information in the device information. For example, the format of the transitional drive letter can be sdslotα, where α is the slot number, and the slot number α is a constant used to indicate that the hard drive is plugged into the αth slot among multiple external slots.

[0076] Please see Figure 3 In some embodiments, the method for assigning a transitional drive letter to the second hard disk may include the following steps S31 to S33:

[0077] Step S31: Determine whether the second hard drive has partitions based on the device information of the second hard drive. If the second hard drive has partitions, proceed to step S32; if the second hard drive does not have partitions, proceed to step S33.

[0078] It is understandable that, based on the partition information in the device information of the second hard drive obtained in step S22, it can be determined whether there are partitions in the second hard drive.

[0079] It is understandable that there can be one or more second hard drives. When there are multiple second hard drives, the presence or absence of partitions can be determined separately for each second hard drive.

[0080] Step S32: Assign transition drive letters to multiple partitions on the second hard drive based on the partition information.

[0081] It is understandable that transition drive letters can include partition transition drive letters and hard drive transition drive letters. Partition transition drive letters correspond to the partitions on the hard drive, and partition transition drive letters include slot numbers and partition numbers.

[0082] It's understandable that partition information can include the number and sequence number of partitions on a hard drive. The partition number corresponds to the sequence number of each partition on the hard drive. For example, the format of a transitional partition drive letter can be sdslotαpartβ, where α is the slot number and β is the partition number. Both slot number α and partition number β are constants. The slot number α indicates that the hard drive is plugged into the αth slot among multiple external slots. The partition number β indicates that this partition is the βth of multiple partitions on the hard drive.

[0083] Step S33: Assign a transitional drive letter to the second hard drive.

[0084] It is understood that in step S33, a temporary disk drive letter can be assigned to the second hard drive that does not have a partition. The temporary disk drive letter may include a slot number. The slot number corresponds to the slot information in the device information.

[0085] In one implementation, the format of the hard drive transition drive letter can be sdslotα, where α is the slot number and a constant, used to indicate that the hard drive is plugged into the αth slot among multiple external slots. In another implementation, the format of the hard drive transition drive letter can be the same as that of the partition transition drive letter, and the format of the hard drive transition drive letter can be sdslotαpart0, where α is the slot number and a constant, and part0 indicates that the hard drive does not have any partitions. The embodiments of this application do not limit this.

[0086] It is understandable that when there are multiple second hard drives, steps S31 to S33 can be run once for each of the multiple second hard drives to assign an accurate corresponding transition drive letter to each of the multiple second hard drives.

[0087] Step S14: Based on the order of the transition drive letters, reassign system drive letters to the second hard drive in sequence.

[0088] It's understandable that a transitional drive letter can include a slot number and a partition number, both of which are constants that can be sorted from smallest to largest numerical value. When reassigning a system drive letter, the system drive letter can be reassigned based on the sorted slot and partition numbers in the already assigned transitional drive letters.

[0089] In one implementation, the processor 50 assigns transitional drive letters to the second hard drive according to the ascending order of the numerical portion of the slot information corresponding to the second hard drive and the ascending order of the partition numbers in the partition information. Therefore, the order in which the transitional drive letters are assigned is the sorting order of the transitional drive letters. The processor 50 can record the order in which the transitional drive letters are assigned. When reallocating system drive letters to the second hard drive, the processor 50 can assign system drive letters to the second hard drive and its partitions one by one according to the order in which the transitional drive letters were assigned.

[0090] In another implementation, the processor 50 allocates transitional drive letters according to the original system drive letters of the second hard drive in ascending order. When drive letter drifting occurs, the order in which the processor 50 allocates transitional drive letters differs from the ascending order of slot number and partition number in the transitional drive letters. Before step S14 is executed, the processor 50 can first obtain the sorting of the transitional drive letters based on the ascending order of slot number and partition number of the already allocated transitional drive letters, and then reallocate the system drive letter to the second hard drive according to the obtained sorting.

[0091] It's understandable that since the first hard drive doesn't experience drive letter drifting due to system failures or hot-swapping, while the second hard drive might, the system drive letter can be reassigned only to the second hard drive. Reassigning system drive letters only to a subset of hard drives improves the efficiency of the drive letter calibration method.

[0092] Please see Figure 4 In some embodiments, the method for reassigning a system drive letter to the second hard disk may include the following steps S41 to S43:

[0093] Step S41: Obtain the first and second transition drive letters.

[0094] It can be understood that the first transition drive letter is the first transition drive letter among the transition drive letters generated in step S13, sorted by slot number and / or partition number.

[0095] When multiple second hard drives exist, there are multiple transition drive letters. First, based on the slot number, we need to obtain the transition drive letter corresponding to the second hard drive plugged into the first slot among the multiple external slots. Then, based on the partition information, we need to determine whether there are partitions in the second hard drive. If there are partitions, we need to sort the partition numbers among the multiple transition drive letters corresponding to the second hard drive and obtain the transition drive letter with the smallest partition number as the first transition drive letter. If there are no partitions, then the unique transition drive letter corresponding to the second hard drive is the first transition drive letter.

[0096] When there is only one second hard drive, it is necessary to first determine whether there are partitions on the second hard drive based on the partition information. If there are partitions, the first transition drive with the smallest partition number is selected as the first transition drive based on the sorting of the partition numbers among the multiple transition drive letters corresponding to the second hard drive. If there are no partitions, the only transition drive letter corresponding to the second hard drive is the first transition drive letter.

[0097] Step S42: Determine the first system drive letter based on the first transition drive letter.

[0098] It's understandable that the first system drive letter is the one that takes the first position in the system drive sequence during system drive letter reallocation. Since the first transition drive letter is known, it can be used to determine whether the first and second hard drives have partitions and the specific slot number of the external drive bays where they reside. Therefore, based on the first transition drive letter, it's possible to determine whether the first system drive letter contains a numerical portion corresponding to the partition number, and also to determine the alphabetical position of the letter in the first system drive letter.

[0099] For example, if there are two hard drives and the first hard drive has partitions, the first transition drive letter could be `sdslot3part1`, where `slot3` indicates that the second hard drive is connected to the third slot on the server, i.e., the first external slot; and `part1` indicates the first partition among the multiple partitions on the second hard drive. The first system drive letter corresponding to the first transition drive letter is `sdc1`, where `c` corresponds to `slot3` in the transition drive letter list (the third letter in alphabetical order); and `1` corresponds to `part1` in the transition drive letter list.

[0100] For example, if there is one first hard drive and the first second hard drive has no partitions, the first transitional drive letter can be sdslot2, where slot2 indicates that the second hard drive is plugged into the second slot of the server, i.e., the first external slot. The first system drive letter corresponding to the first transitional drive letter is sdb, where 'b' corresponds to slot2 in the transitional drive letter and is the second letter in alphabetical order.

[0101] For example, if there is one first hard drive and the first second hard drive has no partitions, the first transitional drive letter can be sdslot2part0, where slot2 indicates that the second hard drive is plugged into the second slot of the server, i.e., the first external slot; part0 indicates that the second hard drive has no partitions. The first system drive letter corresponding to the first transitional drive letter is sdb, where 'b' corresponds to slot2 in the transitional drive letter and is the second letter in alphabetical order.

[0102] Step S43: Based on the order of the first system drive letter and the transition drive letter, reallocate the system drive letter to the second hard drive in sequence.

[0103] It is understandable that the number of transition drive letters determines the number of system drive letters to be reassigned; the content of the transition drive letters determines whether the corresponding second hard drive has partitions; and the order of the slot numbers and partition numbers in the transition drive letters determines the order in which the system drive letters are reassigned. Therefore, after the first system drive letter is determined, system drive letters can be reassigned to the second hard drive and its partitions sequentially, starting from the first system drive letter.

[0104] It can be understood that the order of transition drive letters corresponds to the order in which they were allocated. Transition drive letters are prioritized based on slot number from smallest to largest, and those with the same slot number are then sorted by partition number from smallest to largest. The order of the reassigned system drive letters corresponds to the order of the transition drive letters, with the system drive letters prioritized based on alphabetical order, and those with the same letter part being sorted by the partition number from smallest to largest.

[0105] Please see Figure 5 For example, if there are multiple transitional drive letters, namely sdslot3part1, sdslot3part2, sdslot3part3, sdslot4, and sdslot5, the first system drive letter is sdslot3part1. When reallocating system drive letters, first, in ascending order of partition number, assign system drive letters sdc1, sdc2, and sdc3 to the three partitions of the second hard drive corresponding to the first system drive letter. Here, 'c' corresponds to slot3 in the transitional drive letter list (the third letter in alphabetical order); '1' corresponds to part1, '2' to part2, and '3' to part3. Similarly, assign system drive letters sdd and sde to the other two second hard drives in sequence. Here, 'd' corresponds to slot4 in the transitional drive letter list (the fourth letter in alphabetical order); and 'e' corresponds to slot5 in the transitional drive letter list (the fifth letter in alphabetical order).

[0106] In some scenarios, when multiple hard drives are connected to multiple drive bays, there may be empty drive bays between them. In this case, the slot numbers in the transition drive letters may be non-consecutive. During the process of reallocating transition drive letters, the letters used for the English letter part of the assigned system drive letter can be determined based on the ascending order of the partition numbers among the multiple transition drive letters, rather than selecting letters that are the same as the slot number values ​​in the sorting.

[0107] For example, if there are multiple transitional drive letters, and these transitional drive letters are sdslot3part1, sdslot3part2, sdslot5part1, sdslot5part2, and sdslot7 respectively according to their slot numbers, then the first system drive letter is sdslot3part1. The second hard drives are located in the third, fifth, and seventh slots respectively, and there are empty slots between the slots where multiple second hard drives are connected. When reallocating the system drive letters, the three partitions of the second hard drive corresponding to the first system drive letter are first assigned system drive letters sdc1 and sdc2 in ascending order of partition number. Here, 'c' corresponds to slot3 in the transitional drive letters (the third letter in alphabetical order); '1' corresponds to part1 in the transitional drive letters; and '2' corresponds to part2 in the transitional drive letters. Next, assign drive letters sdd1 and sdd2 to the second hard drives corresponding to sdslot5part1 and sdslot5part2 in sequence. The 'd' in sdd1 corresponds to slot5 in the transition drive list. '5' is the number following 3 in the sequence 3, 5, 7, and 'd' is the 3+1th letter in the alphabetical order, i.e., the 4th letter. Similarly, assign the system drive letter sde to the second hard drive corresponding to sdslot7 in sequence. The 'e' in sdd7 corresponds to slot7 in the transition drive list. '7' is the number two positions following 3 in the sequence 3, 5, 7, and 'e' is the 3+2th letter in the alphabetical order, i.e., the 5th letter.

[0108] It is understandable that when there are multiple transitional drive letters with different slot numbers, even if the multiple slot numbers are not consecutive, the corresponding system drive letters are still multiple system drive letters with consecutive English letters.

[0109] The drive letter calibration method provided in this application resolves the drive letter drift problem by determining information such as the hard drive's slot location, the presence and number of partitions, and their sequence numbers. First, transitional drive letters are assigned to each hard drive. Then, system drive letters are reassigned based on the order of these transitional drive letters. The reassigned system drive letters have the same format as the original system drive letters. When operators need to find files on a specific hard drive, or when the system needs to retrieve files from a specific hard drive, there is no need to consider drive letter drift and modify the original search directory; the specified files can be retrieved within the original directory. This improves the convenience of finding and retrieving files on the hard drive.

[0110] Please refer to Figure 6 , Figure 6 This is a schematic diagram of a disk calibration system 100 disclosed in an embodiment of this application.

[0111] The disk calibration system 100 provided in this application embodiment may include: a first acquisition module 10, a second acquisition module 20, a first allocation module 30, and a second allocation module 40.

[0112] The first acquisition module 10 is used to acquire the trigger signal.

[0113] It is understood that the output of the trigger signal can be a processor 50, a user terminal, and / or a detection device, but the embodiments of this application do not limit this.

[0114] The second acquisition module 20 is used to acquire the number of hard drives and device information.

[0115] It is understandable that, since the first hard drive does not involve hot-swapping, while the second hard drive does, the second acquisition module 20 can only acquire the number and device information of the second hard drive. The device information may include slot information and partition information.

[0116] The first allocation module 30 is used to allocate transitional drive letters to hard drives based on the number of hard drives and device information.

[0117] It is understandable that a transition drive letter can include a slot number and a partition number. The slot number can correspond to the slot information, and the partition number can correspond to the sequence number of the hard drive partition in the partition information.

[0118] The second allocation module 40 is used to reassign system drive letters to hard drives in sequence according to the sorting of transition drive letters.

[0119] It is understandable that transitional drive letters are sorted from smallest to largest based on slot number and partition number. When reallocating the system drive letter, the system drive letter can be reassigned in order based on the sorted hard drives and their partitions. The method for reallocating the system drive letter is detailed in the above embodiment and will not be repeated here.

[0120] It is understood that the division of the various modules in the disk calibration system 100 described above is only for illustrative purposes. In other embodiments, the disk calibration system 100 can be divided into different modules as needed to complete all or part of the functions of the disk calibration system 100 described above.

[0121] The specific implementation of each module in the embodiments of this application can also be referred to accordingly. Figures 1 to 5 The corresponding description of the method embodiments shown.

[0122] exist Figure 6In the described drive letter calibration system 100, transitional drive letters are assigned to each hard drive, and then system drive letters are reassigned to each hard drive according to the order of the transitional drive letters to solve the problem of drive letter drift. The reassigned system drive letters have the same format as the original system drive letters. When operators need to find files on a specific hard drive, or when the system needs to retrieve files on a specific hard drive, there is no need to consider the drive letter drift problem and modify the original directory for searching files; the specified files can be retrieved within the original directory. This improves the convenience of finding and retrieving files on the hard drive. For details, please refer to the specific embodiments of the drive letter calibration method described above, which will not be elaborated here.

[0123] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device 200 provided in an embodiment of this application.

[0124] This application provides an electronic device 200, which may include the disk calibration system 100 described above. For details of the disk calibration system 100, please refer to [link to relevant documentation]. Figure 6 The detailed description of the illustrated embodiments will not be repeated here.

[0125] like Figure 7 The electronic device 200 may include a processor 50 and a memory 60. The processor 50 and the memory 60 can be connected via a communication bus and communicate with each other.

[0126] Processor 50 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the above scheme program.

[0127] Memory 60 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory 60 may exist independently and be connected to processor 50 via a bus. Memory 60 may also be integrated with processor 50.

[0128] The memory 60 stores and executes a computer program 61, which is controlled by the processor 50. The processor 50 executes the computer program 61 stored in the memory 60. The computer program 61 stored in the memory 60 is executable. Figures 1 to 5 Some or all of the steps of the disk calibration method described in the document.

[0129] For example, electronic device 200 can be a server, processor 50 can be the central processing unit in the server, and memory 60 can be the first hard disk and memory modules in the server. The first hard disk stores programs for running the Linux system, and also stores computer programs 61 for performing drive letter calibration methods.

[0130] Figure 7 The electronic device 200 shown can assign transitional drive letters to each hard drive, and then reassign system drive letters to each hard drive according to the order of the transitional drive letters, thus solving the problem of drive letter drift. The reassigned system drive letters have the same format as the original system drive letters. When operators need to find files on a specific hard drive, or when the system needs to retrieve files on a specific hard drive, there is no need to consider the drive letter drift issue and modify the original directory for searching the files; the specified files can be retrieved within the original directory. This improves the convenience of searching and retrieving files on the hard drive.

[0131] Based on the same concept, embodiments of this application also provide a storage medium. The readable storage medium stores a computer program 61, which, when run on the electronic device 200, enables the electronic device 200 to execute the disk calibration method provided in the foregoing embodiments.

[0132] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments described above should be considered exemplary and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within this application.

Claims

1. A drive letter calibration method for calibrating the system drive letter corresponding to a hard drive, characterized in that, The disk calibration method includes: The number of hard drives and device information are obtained, wherein the device information includes the slot information and partition information of the hard drives, and the partition information of the hard drives is obtained according to the number of subdirectories in the device directory that have the same name as each device, and the contents of the partition names in the multiple subdirectories with the same name as the device. Based on the partition information, determine whether the hard drive has partitions; If the hard disk has the partition, then a transitional drive letter is assigned to the multiple partitions of the hard disk, wherein the transitional drive letter is a drive letter that differs from the system drive letter in format, and the transitional drive letter includes the slot number corresponding to the slot information; If the hard drive does not have the partition, then the transitional drive letter is assigned to the hard drive; The first system drive letter is determined based on the first transition drive letter, wherein the first transition drive letter is the first transition drive letter in sequence, and the first system drive letter is the first system drive letter assigned to the hard disk in sequence when the system drive letter is reallocated; Based on the order of the first system drive letter and the intermediate drive letters, the system drive letters are reassigned to the hard drives in sequence.

2. The disk calibration method as described in claim 1, characterized in that, The transition drive letter includes a partition transition drive letter, which corresponds to a partition on the hard drive. The partition transition drive letter includes the slot number and the partition number, and the partition number corresponds to the partition information.

3. The disk calibration method as described in claim 1, characterized in that, The process of obtaining the number of hard drives and device information includes: Obtain the installation location of the hard drive; Obtain the number of hard drives corresponding to the external slots in the installation location and the device information.

4. The disk calibration method as described in claim 1, characterized in that, The disk calibration method further includes: Determine whether to acquire the trigger signal; If the trigger signal is obtained, the number of hard drives and the device information are obtained.

5. The disk calibration method as described in claim 3, characterized in that, The step of obtaining the number of hard drives corresponding to the external slots in the installation location and the device information includes: Obtain the device directory corresponding to the external slot, the device directory includes the subdirectory, and the subdirectory corresponds to the hard disk; The number of hard disks is obtained based on the number of different device names in the device catalog, wherein the device name is the part of the subdirectory name that corresponds to the hard disk. Based on the content and number of partition names in the subdirectories with the same device name in the device directory, obtain the partition information of different hard drives, wherein the partition name is the part of the subdirectory name corresponding to the partition; Obtain the slot information from the name of the subdirectory.

6. A disk calibration system, characterized in that, A disk calibration method for implementing any one of claims 1 to 5 includes: The acquisition module is used to obtain the number of hard drives and device information; The first allocation module is used to allocate transitional drive letters to the hard drives based on the number of hard drives and the device information; The second allocation module is used to reassign the system drive letter to the hard drive in sequence according to the sorting of the transition drive letters.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor is configured to execute the computer program stored in the memory, wherein when the computer program is executed, the processor is configured to perform the drive letter calibration method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium includes a computer program that, when run on an electronic device, causes the electronic device to perform the drive letter calibration method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Control method and device of hard disks and server

    CN107402721A

  • Disk binding method and device in Linux system and storage medium

    CN110442307A