Disk partitioning methods, data storage methods, electronic devices and storage media

By dividing the SMR disk into CMR and SMR partitions and storing the location information of the backup area in the superblock, the problem of SMR disk metadata loss is solved, and the reliability of data reading and writing is improved.

CN115509444BActive Publication Date: 2026-11-10ZHEJIANG DAHUA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211043495.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2026-11-10
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

SMR disks have a high probability of metadata loss during data storage, resulting in low data read/write reliability.

Method used

The SMR disk is divided into a regular magnetic recording (CMR) partition and an SMR partition. The superblock is located in the CMR partition. The SMR partition is further divided into a backup area and a regular area. The location information of the backup area is stored in the superblock. The CMR partition is used to store metadata, and the backup area is used to back up metadata.

Benefits of technology

By randomly reading and writing metadata in the CMR partition and backing up metadata in the backup area, the probability of metadata loss in the SMR disk is reduced, and the reliability of data reading and writing is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115509444B_ABST
    Figure CN115509444B_ABST
Patent Text Reader

Abstract

This application discloses a disk partitioning method, a data storage method, an electronic device, and a storage medium. The disk partitioning method is applied to Shingled Magnetic Recording (SMR) disks and includes: dividing the SMR disk into Conventional Magnetic Recording (CMR) partitions and SMR partitions, with the SMR disk's Super Block located within the CMR partitions; dividing the SMR partitions into backup areas and regular areas, with the backup area corresponding to area location information stored in the Super Block; wherein, the regular area is used to store data to be stored, the CMR partition is used to store metadata describing the data to be stored, and the backup area is used to back up the metadata in the CMR partitions, with the backup location and backup time of the backup metadata in the backup area stored in the Super Block. This solution can reduce the probability of metadata loss in SMR disks and improve the reliability of data read and write operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a disk partitioning method, a data storage method, an electronic device, and a storage medium. Background Technology

[0002] With the advent of the data era, data collection requires storage. Shingled Magnetic Recording (SMR) disks offer the advantage of balancing storage capacity and cost, and have been widely used in data processing, especially in data storage applications. However, SMR disks suffer from the inability to perform random read / write operations. When data from different data sources is stored on an SMR disk, corresponding metadata describing the data's attributes needs to be stored to facilitate data access. If the metadata is lost, data access errors will occur on the SMR disk. Current technology lacks a disk partitioning method to reduce the probability of metadata loss on SMR disks, thereby improving the reliability of data read / write operations. Summary of the Invention

[0003] The main technical problem addressed by this application is to provide a disk partitioning method, a data storage method, an electronic device, and a storage medium that can reduce the probability of metadata loss in SMR disks and improve the reliability of data reading and writing.

[0004] To address the aforementioned technical problems, this application provides a disk partitioning method applied to Shingled Magnetic Recording (SMR) disks, comprising: dividing the SMR disk into a Conventional Magnetic Recording (CMR) partition and an SMR partition, wherein the Super Block of the SMR disk is located within the CMR partition; dividing the SMR partition into a backup area and a regular area, wherein the backup area corresponds to area location information, and the area location information is stored in the Super Block; wherein the regular area is used to store data to be stored, the CMR partition is used to store metadata describing the data to be stored, the backup area is used to back up the metadata in the CMR partition, and the backup location and backup time of the metadata in the backup area are stored in the Super Block.

[0005] To address the aforementioned technical problems, a second aspect of this application provides a data storage method applied to an SMR disk, comprising: storing data to be stored in a regular area of ​​the SMR disk based on region location information stored in the superblock of the SMR disk; storing metadata describing the data to be stored in a CMR partition of the SMR disk; wherein the SMR disk includes the CMR partition and the SMR partition, the SMR includes the regular area and the backup area, and the region location information of the backup area in the SMR partition is stored in the superblock of the SMR disk; backing up the metadata in the CMR partition to the backup area of ​​the SMR disk based on the region location information, and storing the backup location and backup time of the backup metadata in the backup area in the superblock of the SMR disk.

[0006] To address the aforementioned technical problems, a third aspect of this application provides an electronic device comprising: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the first or second aspect.

[0007] To solve the above-mentioned technical problems, the fourth aspect of this application provides a computer storage medium storing program data thereon, wherein the program data, when executed by a processor, implements the method described in the first or second aspect above.

[0008] The above scheme partitions the SMR disk into regular magnetic recording (CMR) partitions and SMR partitions. The superblock of the SMR disk is located within the CMR partition. However, due to its storage method, the SMR disk cannot perform random read / write operations, while the CMR partition allows for random read / write. Since the superblock, as the beginning of the partition, is also located within the CMR partition, the data in the superblock can also be randomly accessed. The SMR partition is further divided into a backup area and a regular area. The backup area has corresponding area location information stored in the superblock, which is located within the CMR partition. Therefore, the location of the backup area can be retrieved from the superblock at any time. The regular area is used to store data to be stored and employs... Shingled Magnetic Recording (SMR) storage increases data storage capacity. The CMR partition stores metadata describing the data to be stored, enabling random read / write operations within the CMR partition. This allows for retrieval of data stored in the regular area based on the metadata. A backup area backs up the metadata in the CMR partition, with the backup location and time stored in the superblock. This ensures that even if the metadata in the CMR partition is corrupted, the metadata in the backup area can still be determined using the area location information and backup location in the superblock, reducing the probability of metadata loss in the SMR disk. Therefore, data can be stored on the SMR disk, and data stored in the regular area can be retrieved based on the metadata, improving the reliability of data read / write operations. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:

[0010] Figure 1 This is a flowchart illustrating one implementation method of the disk partitioning method of this application;

[0011] Figure 2 This is a schematic diagram of the structure corresponding to disk storage methods;

[0012] Figure 3 This is a schematic diagram illustrating an application scenario of one implementation method of the disk partitioning method of this application;

[0013] Figure 4 This is a flowchart illustrating one embodiment of the data storage method of this application;

[0014] Figure 5 This is a flowchart illustrating another embodiment of the data storage method of this application;

[0015] Figure 6 yes Figure 5 A schematic diagram of an application scenario corresponding to step S502 in the middle embodiment;

[0016] Figure 7 yes Figure 5 A schematic diagram of an application scenario of an embodiment following step S503;

[0017] Figure 8 This is a schematic diagram of the structure of one embodiment of the electronic device of this application;

[0018] Figure 9 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0020] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.

[0021] The disk partitioning method and data storage method provided in this application are both applied to shingled magnetic recording (SMR) disks. The disk partitioning method is used to partition the SMR disk, and the data storage method is used to store data to be stored in the SMR disk. The SMR disk is partitioned based on the disk partitioning method provided in this application. The execution entity corresponding to the disk partitioning method and data storage method provided in this application is a processor or processing module capable of calling the SMR disk.

[0022] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the disk partitioning method of this application, which includes:

[0023] S101: Divide the SMR disk into a conventional magnetic recording (CMR) partition and an SMR partition, with the SMR disk's SuperBlock located in the CMR partition.

[0024] Specifically, please refer to Figure 2 , Figure 2 This is a schematic diagram of the structure corresponding to disk storage, where, Figure 2 The rectangles in the image correspond to tracks on the disk. The left side represents conventional magnetic recording, and the right side represents shingled magnetic recording. A portion of the SMR disk is divided into CMR partitions. CMR partitions are created using methods such as... Figure 2 The conventional magnetic recording method shown in the diagram uses SMR partitioning, which employs methods such as... Figure 2 The partitioning of the shingled magnetic recording method is shown in the figure.

[0025] Furthermore, SMR disks can store more data per unit volume compared to conventional magnetic recording disks. However, due to the limitations of shingled magnetic recording, they cannot be randomly read or written. Metadata describing the data to be stored needs to be able to be read and written at any time and randomly. Therefore, after partitioning into CMR partitions, CMR partitions can be randomly read and written. Moreover, the superblock, as the beginning of the hard drive partition, is also located in the CMR partition. In other words, the CMR partition must include the storage space at the beginning of the SMR disk, thus ensuring that the data in the superblock can also be read randomly.

[0026] In one application method, a portion of the storage area at the beginning of the SMR disk is formatted, the storage method of the formatted space is set to conventional magnetic recording, a CMR partition is generated, and the CMR partition includes the superblock of the SMR disk. The area after the CMR partition is used as the SMR partition.

[0027] In another application, the superblock and a portion of the SMR disk are formatted, and the storage mode of the formatted space is set to conventional magnetic recording to generate CMR partitions. This ensures that the storage mode corresponding to the superblock is conventional magnetic recording, and the superblock is a CMR partition. Other areas in the SMR disk outside the CMR partitions are used as SMR partitions.

[0028] In one application scenario, the total capacity of the SMR disk is obtained, and a portion of the storage area at the beginning of the SMR disk is formatted. The portion of the storage area is the product of the total capacity and a preset ratio, where the preset ratio is any value between 1% and 5%. The storage method of the formatted space is set to conventional magnetic recording, and a CMR partition is generated, which includes the superblock of the SMR disk. The area after the CMR partition is used as the SMR partition.

[0029] S102: Divide the SMR partition into a backup area and a regular area, and the backup area has corresponding area location information, which is stored in the superblock.

[0030] Specifically, the SMR partition is divided into two parts: a portion of the partition is designated as a backup area, and the remaining areas are designated as regular areas. When dividing the backup area, the location information of the corresponding area is determined and stored in the superblock. Since the superblock is located in the CMR partition, the location of the backup area can be read from the superblock at any time.

[0031] Furthermore, the regular area is used to store the data to be stored, the CMR partition is used to store metadata describing the data to be stored, and the backup area is used to back up the metadata in the CMR partition. The backup location and backup time of the backup metadata in the backup area are stored in the superblock. Therefore, the regular area adopts shingled magnetic recording storage, which can increase the data storage capacity per unit volume. Metadata in the CMR partition can be read and written randomly, which facilitates the retrieval of data stored in the regular area based on the metadata. The backup area is used to back up the metadata in the CMR partition, and the backup location and backup time of the backup metadata in the backup area are stored in the superblock. Thus, when the metadata in the CMR partition is corrupted, the metadata in the backup area can still be determined through the area location information and backup location in the superblock, reducing the probability of metadata loss in the SMR disk.

[0032] In one application method, the CMR partition is located at the beginning of the SMR disk. In the SMR partition, the area adjacent to the CMR partition is used as the backup area, and the area after the backup area is used as the regular area. The area location information of the backup area is generated and stored in the superblock.

[0033] In another application, at least a portion of the CMR partition is located at the beginning of the SMR disk. A storage area is selected in the SMR partition as a backup area, and the area location information of the backup area is generated. Other areas in the SMR partition that are different from the backup area are treated as regular areas.

[0034] The above scheme partitions the SMR disk into regular magnetic recording (CMR) partitions and SMR partitions. The superblock of the SMR disk is located within the CMR partition. However, due to its storage method, the SMR disk cannot perform random read / write operations, while the CMR partition allows for random read / write. Since the superblock, as the beginning of the partition, is also located within the CMR partition, the data in the superblock can also be randomly accessed. The SMR partition is further divided into a backup area and a regular area. The backup area has corresponding area location information stored in the superblock, which is located within the CMR partition. Therefore, the location of the backup area can be retrieved from the superblock at any time. The regular area is used to store data to be stored and employs... Shingled Magnetic Recording (SMR) storage increases data storage capacity. The CMR partition stores metadata describing the data to be stored, enabling random read / write operations within the CMR partition. This allows for retrieval of data stored in the regular area based on the metadata. A backup area backs up the metadata in the CMR partition, with the backup location and time stored in the superblock. This ensures that even if the metadata in the CMR partition is corrupted, the metadata in the backup area can still be determined using the area location information and backup location in the superblock, reducing the probability of metadata loss in the SMR disk. Therefore, data can be stored on the SMR disk, and data stored in the regular area can be retrieved based on the metadata, improving the reliability of data read / write operations.

[0035] In some implementation scenarios, the CMR partition is located at the beginning of the SMR disk, and the SMR partition is located after the CMR partition. Dividing the SMR disk into conventional magnetic recording CMR partitions and SMR partitions includes: formatting the preset storage space at the beginning of the SMR disk, and converting the formatted preset storage space into a CMR partition; wherein the preset storage space corresponds to a preset proportion of the total capacity of the SMR disk; determining the end position of the CMR partition, and using the area after the end position of the SMR disk as the SMR partition.

[0036] Specifically, please refer to Figure 3 , Figure 3 This is a schematic diagram of an application scenario of one embodiment of the disk partitioning method of this application. The preset storage space at the initial position of the SMR disk is used as the storage area of ​​the CMR partition. The capacity of the preset storage space is the product of the total capacity of the SMR disk and a preset ratio. The preset storage space at the initial position is formatted to clear the original storage mode. The storage mode of the formatted preset storage space is set to the conventional magnetic recording storage mode to obtain the CMR partition. The tail position of the CMR partition is marked, and the area after the tail position in the SMR disk is used as the SMR partition.

[0037] Furthermore, the CMR partition is located at the initial position of the SMR disk, thus ensuring that the superblock of the SMR disk is located in the CMR partition. Setting the SMR partition after the CMR partition isolates the CMR partition from the SMR partition, and their positions are simple and easy to distinguish. This allows the SMR partition to store more data per unit volume, while the CMR partition can randomly read and write data for storing metadata, thus improving the rationality of SMR disk partitioning.

[0038] In one specific application scenario, 1% of the total capacity of the SMR disk is formatted, and the storage method of the formatted preset storage space is set to conventional magnetic recording storage mode to obtain a CMR partition for storing metadata. In other specific application scenarios, other proportions of capacity can also be selected for formatting, and this application does not impose specific restrictions on this.

[0039] In some implementation scenarios, the SMR partition is divided into a backup area and a regular area, including: selecting any area in the SMR partition as the backup area and using the area outside the backup area as the regular area; generating the area location information corresponding to the start and end points of the backup area and storing the area location information in the superblock.

[0040] Specifically, please refer to [the relevant document] again. Figure 3 Within an SMR partition, any region can be selected as a backup region. All other regions are considered regular regions. The backup region can be located at the beginning, middle, or end of the SMR partition. When located at the beginning of the SMR partition, the backup region is adjacent to the CMR partition. The start and end points of the backup region each have corresponding region location information, which is stored in the superblock for easy access to the backup region's location and the backed-up metadata. By randomly selecting a backup region for the backup metadata, the backup metadata can be stored anywhere within the SMR partition, providing a basis for backing up the metadata in the CMR partition, thus increasing the flexibility of backup region settings.

[0041] Furthermore, the backup area is used to back up metadata, while the regular area is used to store the data to be stored. The two do not affect each other, and the backup process will not affect the data to be stored being stored in the regular area.

[0042] Please see Figure 4 , Figure 4 This is a flowchart illustrating one embodiment of the data storage method of this application, which includes:

[0043] S401: Based on the region location information stored in the superblock of the SMR disk, the data to be stored is stored in the regular area of ​​the SMR disk, and the metadata describing the data to be stored is stored in the CMR partition of the SMR disk.

[0044] Specifically, the SMR disk partitioned based on the disk partitioning method in the above embodiments includes CMR partitions and SMR partitions. The SMR includes a regular area and a backup area. The location information of the backup area in the SMR partition is stored in the superblock of the SMR disk.

[0045] Understandably, after obtaining the data to be stored, the system retrieves the location information of the backup area from the superblock of the SMR disk, determines the regular area and backup area within the SMR partition, stores the data to be stored in the regular area, and stores the metadata describing the data to be stored in the CMR partition of the SMR disk. This metadata includes attribute information of the data to be stored, and this attribute information includes, but is not limited to, the data type, data size, data storage location, and data acquisition time of the data to be stored.

[0046] Furthermore, CMR partitions can perform random read and write operations. The superblock, which is the beginning of the hard drive partition, is also located in the CMR partition. Therefore, the data in the superblock can also be read and written randomly. The region location information can be randomly read from the superblock to determine the regular region and the backup region. The metadata stored in the CMR partition can be randomly read to enable reading and writing of the data stored in the regular region, thus improving the freedom of data reading and writing.

[0047] In one application mode, the data to be stored is obtained, the data type of the data to be stored is determined, the data to be stored is stored in a region in the regular area that matches the data type based on the data type of the data to be stored, the metadata describing the data to be stored is determined, and the metadata is stored in a region in the CMR partition that matches the data type based on the data type of the data to be stored.

[0048] In another application method, the data to be stored is obtained, the data acquisition time of the data to be stored is determined, a storage order is generated based on the data acquisition time of the data to be stored, the data to be stored is stored in the regular area in the order, the metadata describing the data to be stored is determined, and the metadata is stored in the CMR partition in the order based on the data acquisition time of the data to be stored.

[0049] S402: Based on the region location information, back up the metadata in the CMR partition to the backup region of the SMR disk, and store the backup location and backup time of the backup metadata in the backup region into the superblock of the SMR disk.

[0050] Specifically, based on the regional location information, the regular area and backup area in the SMR partition are determined. The metadata in the CMR partition is backed up to the backup area of ​​the SMR disk. The backup location and latest backup time of the metadata in the backup area are determined. The backup location and backup time are stored in the superblock of the SMR disk. This reduces the probability of data access errors in the SMR disk caused by errors in the metadata stored in the CMR partition. Based on the backup location and backup time stored in the superblock, the location of the backed-up metadata in the backup area and the backup time of the metadata can be determined. Thus, metadata can be obtained from the backup area to read and write data stored in the regular area, improving the reliability of data read and write.

[0051] In one application method, based on the data type of the data to be stored, the metadata corresponding to the data to be stored is stored in the backup area in the area that matches the data type, the backup location and backup time of the metadata in the backup area are generated, and the backup location and backup time are stored in the superblock of the SMR disk.

[0052] In another application, the storage order is generated based on the data acquisition time of the data to be stored. The metadata corresponding to the data to be stored is stored sequentially in the backup area. The backup location and backup time of the metadata in the backup area are generated and stored in the superblock of the SMR disk.

[0053] In the above scheme, the SMR disk includes a CMR partition and an SMR partition. The SMR partition includes a regular area and a backup area. The location information of the backup area within the SMR partition is stored in the superblock of the SMR disk. Based on the location information, data to be stored is stored in the regular area, and metadata describing the data to be stored is stored in the CMR partition. The CMR partition is capable of random read and write operations. The superblock, as the beginning of the disk partitions, is also located within the CMR partition, so the data in the superblock is also capable of random read and write operations. The location information of the regular area and the backup area can be randomly read from the superblock. The metadata stored in the CMR partition can be randomly read to achieve the storage of the data. Data in the regular area is read and written, increasing the freedom of data read and write. Metadata in the CMR partition is backed up to the backup area of ​​the SMR disk. The backup location and latest backup time of the metadata in the backup area are determined. The backup location and backup time are stored in the superblock of the SMR disk, reducing the probability of data access errors in the SMR disk due to errors in the metadata stored in the CMR partition. Based on the backup location and backup time stored in the superblock, the location and backup time of the backed-up metadata in the backup area can be determined. Thus, metadata can be obtained from the backup area to read and write data stored in the regular area, improving the reliability of data read and write.

[0054] Please see Figure 5 , Figure 5 This is a flowchart illustrating another embodiment of the data storage method of this application, the method including:

[0055] S501: Based on the region location information stored in the superblock of the SMR disk, the data to be stored is stored in the regular area of ​​the SMR disk, and the metadata describing the data to be stored is stored in the CMR partition of the SMR disk.

[0056] Specifically, the SMR disk partitioned based on the disk partitioning method in the above embodiments includes CMR partitions and SMR partitions. The SMR includes a regular area and a backup area. The location information of the backup area in the SMR partition is stored in the superblock of the SMR disk.

[0057] Furthermore, after obtaining the data to be stored, the region location information corresponding to the backup region is obtained from the superblock of the SMR disk. This determines the regular region and backup region within the SMR partition. The data to be stored is then stored in the regular region, and the metadata describing the data to be stored is stored in the CMR partition of the SMR disk. The metadata includes attribute information of the data to be stored, and this attribute information includes, but is not limited to, the data type, data size, data storage location, and data acquisition time of the data to be stored.

[0058] In one application scenario, storing metadata describing the data to be stored to the CMR partition of the SMR disk includes: storing the metadata corresponding to the data to be stored to a first sub-region that matches the data type, based on the data type of the data to be stored; wherein, the data type corresponds to a first number, and at least a portion of the CMR partition is divided into a first number of first sub-regions, each data type corresponding to its own first sub-region and the first sub-regions being isolated from each other.

[0059] Specifically, the data type of the data to be stored is determined. When the data type corresponding to the data to be stored is a new data type, a matching first sub-region is generated in the CMR partition for the new data type. When there is a first number of data types, at least a portion of the CMR partition is divided into a first number of first sub-regions. Each first sub-region matches the corresponding data type, and the first sub-regions are isolated from each other.

[0060] Furthermore, the metadata corresponding to the data to be stored is stored in the first sub-area that matches the data type, thereby saving the metadata of different data types separately, reducing the probability of all metadata crashing due to errors in the metadata of any one data type, and thus improving data security.

[0061] In a specific application scenario, the data types to be stored include images and videos. In this case, at least a portion of the CMR partition is divided into a first sub-region corresponding to the images and a first sub-region corresponding to the videos. When the data to be stored is an image, the metadata corresponding to the image is stored in the first sub-region corresponding to the image. When the data to be stored is a video, the metadata corresponding to the video is stored in the first sub-region corresponding to the video.

[0062] S502: The monitoring process monitors the length of newly added metadata in the CMR partition until the length of the newly added metadata exceeds the length threshold. The newly added metadata corresponding to the length threshold is taken as the metadata to be backed up, and a backup identifier is generated at the end of the metadata to be backed up in the CMR partition.

[0063] Specifically, a monitoring process is started to monitor the length of newly added metadata in the CMR partition and determine whether the newly added metadata exceeds the length threshold. If it does not exceed the threshold, the monitoring process is used to continuously monitor the newly added metadata until the newly added metadata exceeds the length threshold. If the newly added metadata exceeds the length threshold, the newly added metadata corresponding to the length threshold is taken as metadata to be backed up.

[0064] Further, please refer to Figure 6 , Figure 6 yes Figure 5 The illustration shows an application scenario of one implementation method corresponding to step S502. Assuming that the backed-up metadata in the CMR partition is represented by a data segment filled with diagonal lines, and the metadata corresponding to the length threshold is represented by a data segment filled with dark colors, a backup identifier is generated at the end of the metadata to be backed up in the CMR partition. That is, when backing up the metadata in the CMR partition to the backup area, the length threshold is used as the data length of the metadata. A backup identifier is generated at the end of the metadata to be backed up corresponding to the length threshold in the CMR partition. This backup identifier provides a reference for subsequently comparing the data length of the metadata in the CMR partition with the data length of the metadata in the backup area. This avoids a situation where the data length of all metadata in the CMR partition is inconsistent with the data length in the backup area when new metadata is continuously written to the CMR partition and the data length of the new metadata does not exceed the length threshold.

[0065] S503: Based on the region location information, back up the metadata in the CMR partition to the backup area of ​​the SMR disk, and store the backup location and backup time of the backup metadata in the backup area in the superblock of the SMR disk.

[0066] Specifically, based on the regional location information, the regular area and backup area in the SMR partition are determined, the metadata in the CMR partition is backed up to the backup area of ​​the SMR disk, the backup location and latest backup time of the metadata in the backup area are determined, and the backup location and backup time are stored in the superblock of the SMR disk.

[0067] In one application mode, based on the region location information and backup location in the superblock, the metadata to be backed up is backed up to the region after the current backup location; in response to the successful backup of the metadata to be backed up in the backup region, the backup location and backup time in the superblock are updated.

[0068] Specifically, please refer to [the relevant document] again. Figure 6 Based on the location information of the regions stored in the superblock, the backup regions in the SMR partition can be determined. Based on the backup location, the occupied regions within the backup regions can be determined. Figure 6 At the end of the data segment filled with slashes in the backup area, the metadata to be backed up is moved to the area after the current backup location. Figure 6 In the CMR partition, the data segments filled with dark colors are backed up to the data segments filled with slashes in the backup area. When the metadata to be backed up is successfully backed up in the backup area, the backup location and backup time in the superblock are updated to obtain the latest updated backup location and backup time. The backup time is updated after each successful backup. This can effectively record the backup time and modification time of the metadata, reducing the probability of the security and reliability of the metadata being affected by backup failure or inconsistent backup time.

[0069] Optionally, based on the region location information and backup location in the superblock, before backing up the metadata to be backed up to the region after the current backup location, the method further includes: comparing the data length of the metadata before the metadata to be backed up in the CMR partition with the data length of all metadata in the backup region to obtain a first comparison result; in response to the first comparison result being that the lengths are different, clearing the backup region and re-backing up the metadata before the metadata to be backed up in the CMR partition to the backup region.

[0070] Specifically, see again Figure 6 Before backing up the metadata to be backed up, the data length of the metadata preceding the metadata to be backed up in the CMR partition is compared with the data length of all metadata in the backup area. Figure 6 The first comparison result is obtained by checking whether the data lengths of the data segments filled with slashes in the CMR partition and the backup area are the same.

[0071] Understandably, if the first comparison result indicates a length discrepancy, the backup area is cleared, and the metadata in the CMR partition is used as the standard. The metadata in the CMR partition prior to the metadata to be backed up is then backed up again to the backup area. In other words, the metadata in the CMR partition prior to the metadata to be backed up is then backed up. Figure 6 Data segments padded with slashes in the CMR partition are re-backed up to the backup area to improve the consistency of metadata between the CMR partition and the backup area. If the first comparison result shows that the lengths are the same, the process proceeds to back up the metadata to be backed up to the area after the current backup location based on the area location information and backup location in the superblock. This is to verify whether the data lengths of the previously backed-up metadata are the same in the CMR partition and the backup area before backing up new metadata, thus improving the reliability of the metadata.

[0072] Furthermore, in response to the successful backup of the metadata to be backed up in the backup area, before updating the backup location and backup time in the superblock, the process further includes: comparing the data length of all metadata before the backup identifier in the CMR partition with the data length of all metadata in the backup area to obtain a second comparison result; in response to the second comparison result indicating that the lengths are different, based on the backup location stored in the superblock, re-backing up the metadata to be backed up to the area after the current backup location in the backup area; in response to the second comparison result indicating that the lengths are the same, determining that the metadata to be backed up in the backup area has been successfully backed up.

[0073] Specifically, after the newly added metadata is backed up, the data lengths of all metadata before the backup identifier in the CMR partition and all metadata in the backup area are compared to determine whether the data lengths in the CMR partition and the backup area are the same after the newly added metadata is backed up to the backup area, thus obtaining the second comparison result.

[0074] Understandably, if the second comparison result shows the lengths are the same, it is determined that the metadata to be backed up has been successfully backed up in the backup area. If the second comparison result shows the lengths are different, it has already been determined that the data lengths of the backed-up metadata in the CMR partition and the backup area are the same before backing up the metadata to be backed up. Therefore, when the second comparison result shows the lengths are different, it is highly likely that there is a storage problem during the backup of the metadata to be backed up. In order to improve backup efficiency, when the second comparison result shows the lengths are different, the area that has been occupied in the backup area is determined based on the backup position stored in the superblock, and the metadata to be backed up is re-backed up to the area after the current backup position in the backup area, so as to reduce the probability of inconsistent data lengths caused by the metadata to be backed up.

[0075] Optionally, if the data lengths of all metadata before the backup identifier in the CMR partition and all metadata in the backup area are still different after a re-backup, the backup area is cleared, and the metadata before the backup identifier in the CMR partition is backed up to the backup area based on the metadata in the CMR partition, thereby improving the reliability and consistency of the metadata.

[0076] S504: Using a preset duration as a period, in response to each preset duration, determine the backup status of the backup area, where the backup status includes backup in progress and idle.

[0077] Specifically, a preset time period is set. When the preset time period has elapsed, it is determined whether the backup area is backing up the metadata to be backed up, and the backup status of the backup area is obtained. The backup status includes two states: backing up and idle.

[0078] S505: When the backup status is "Backup in progress", wait for the backup metadata to be backed up to complete until the backup status is "Idle". In response to the backup status corresponding to the backup area being "Idle", compare the data length of all metadata before the backup identifier in the CMR partition with the data length of all metadata in the backup area to obtain the third comparison result.

[0079] Specifically, when the backup status is "Backing up", it waits for the backup metadata to be backed up to complete. That is, the backup status changes to "Idle" after the backup metadata is successfully backed up to the backup area.

[0080] Furthermore, in response to the backup status corresponding to the backup area being idle, it is determined whether the data length of all metadata before the backup identifier in the CMR partition is the same as that of all metadata in the backup area, and a third comparison result is obtained. Thus, after a preset time interval, the data length of the metadata in the CMR partition and the backup area is verified.

[0081] S506: In response to the third comparison result being different in length, the area before the backup identifier in the CMR partition is taken as the first area to be determined, the area storing metadata in the backup area is taken as the second area to be determined, the area with longer data length in the first area to be determined and the area with shorter data length in the second area to be determined is taken as the first partition, the second partition is cleared, and all metadata in the first partition is backed up to the second partition.

[0082] Specifically, when the third comparison result shows a difference in length, the area before the backup identifier in the CMR partition is taken as the first area to be determined, and the area storing metadata in the backup area is taken as the second area to be determined. The data lengths of the metadata in the first and second areas to be determined are compared, and the area with the longer data length is taken as the first partition, and the area with the shorter data length is taken as the second partition. Using the first partition with the longer data length as the benchmark, the metadata in the second partition is cleared, and all the metadata in the first partition is backed up to the second partition again, reducing the probability of metadata loss and thus improving the reliability and consistency of metadata.

[0083] S507: In response to the third comparison result being the same length, proceed to the next cycle corresponding to the preset duration.

[0084] Specifically, when the third comparison result is the same length, the cycle corresponding to the next preset duration will begin, thereby realizing continuous monitoring of the CMR partition and backup area.

[0085] In one application scenario, based on regional location information, metadata from a CMR partition is backed up to a backup area of ​​an SMR disk. After storing the backup location and backup time of the backup metadata in the backup area into the superblock of the SMR disk, the process further includes: responding to the storage space in the regular area being full, dividing a second sub-area into the backup area; wherein the second sub-area is isolated from the third sub-area storing metadata in the backup area; storing the data to be stored into the second sub-area, storing the metadata describing the data to be stored in the second sub-area into the CMR partition, generating a location marker for the data to be stored in the backup area, and generating a storage space warning signal; responding to the storage space in the second sub-area being full, based on the timing of metadata storage in the third sub-area, deleting at least some metadata in the third sub-area to obtain a free sub-area, storing the data to be stored into the free sub-area, storing the metadata describing the data to be stored in the free sub-area into the CMR partition, and generating a location marker for the data to be stored in the backup area; wherein the storage space in the free sub-area is less than half that of the third sub-area; and responding to the storage space in the free sub-area being full, generating a storage space alarm signal.

[0086] Specifically, please refer to Figure 7 , Figure 7 yes Figure 5 The diagram illustrates an application scenario following step S503. When all storage space within the regular area is occupied and data to be stored is obtained, the backup area is divided as follows: Figure 7 As shown, there is a third sub-region for storing metadata and a second sub-region for storing data that has not yet been stored. The second sub-region is used to temporarily store data to be stored. The second and third sub-regions are isolated from each other to reduce the probability of affecting the metadata in the third sub-region when writing data to be stored in the second sub-region.

[0087] Furthermore, the newly acquired data to be stored is stored in the second sub-region, and the metadata describing the data to be stored in the second sub-region is stored in the CMR partition. A location marker for the data to be stored in the backup area is generated, and a storage space warning signal is generated to indicate that data other than the metadata stored in the backup area needs to be cleaned up in a timely manner in the regular area of ​​the SMR disk.

[0088] Furthermore, when the storage space warning information is not responded to, and the storage space in the second sub-region is fully occupied and the storage space in the regular region is also fully occupied, based on the timing of the metadata being stored in the third sub-region, at least some of the metadata in the third sub-region is deleted to obtain a free sub-region. The storage space of the free sub-region is less than half that of the third sub-region, so as to retain at least some of the metadata of the backups that are stored later.

[0089] In one application approach, based on the timing of metadata storage in the third sub-region, the metadata in the first half of the timing sequence in the third sub-region is deleted all at once to obtain a free sub-region, thereby improving the efficiency of obtaining a free sub-region.

[0090] In another application, after obtaining the data to be stored, the metadata that appears earlier in the time sequence in the third sub-region is deleted based on the data length of the data to be stored, and a free sub-region is obtained. This process continues until the storage space of the free sub-region reaches half of that of the third sub-region, so as to preserve the metadata in the backup region as much as possible.

[0091] Furthermore, once the data to be stored is obtained, it is stored in a free sub-region, and the metadata describing the data to be stored in the free sub-region is stored in the CMR partition. A location marker for the data to be stored in the backup region is generated. When the storage space in the free sub-region is full, writing to the data to be stored is prohibited and a storage space alarm signal is generated. The system waits for the storage space alarm signal to be responded to in order to retain at least part of the metadata in the backup region while meeting the storage requirements of the data to be stored as much as possible.

[0092] It should be noted that the third sub-region within the backup area and the free sub-region within the third sub-region each have a corresponding location identifier. This location identifier allows the determination of the remaining metadata within the backup area. When the backup area is used for temporary storage of data to be stored, the CMR partition and the backup area are compared in terms of data length based on the remaining metadata in the backup area. Alternatively, when the backup area is used for temporary storage of data to be stored, no new metadata is added to the backup area, and the comparison of data lengths between the CMR partition and the backup area is temporarily suspended until the storage space in the regular area is released and the regular data storage process is restored.

[0093] Understandably, after storing the data to be stored in the second sub-region, storing the metadata describing the data to be stored in the second sub-region in the CMR partition, generating a location marker for the data to be stored in the backup region, and generating a storage space warning signal, the process also includes: in response to the deletion of at least some of the data to be stored in the regular region, copying the data to be stored in the backup region to the regular region based on the location marker, updating the metadata in the CMR partition related to the data to be stored in the backup region, and updating the metadata related to the deleted data to be stored in the regular region; clearing the backup region, and backing up all the metadata in the CMR partition back to the backup region.

[0094] Specifically, when a storage space warning signal or storage space alarm signal is responded to, at least a portion of the data to be stored in the regular area of ​​the SMR disk is deleted, thereby freeing up at least a portion of the storage space in the regular area. Based on the location markers in the backup area, the data to be stored in the backup area is copied to the regular area to retain the data temporarily stored in the backup area. Metadata related to the data to be stored in the backup area and the metadata related to the deleted data to be stored in the regular area in the CMR partition are updated. In other words, the metadata related to the deleted data to be stored in the regular area is deleted, and the data storage location corresponding to the metadata related to the data to be stored in the backup area is corrected to maintain the accuracy of the metadata in the CMR partition.

[0095] Furthermore, the backup area is cleared, thereby backing up all metadata in the CMR partition back to the backup area to restore the normal data storage process.

[0096] In this embodiment, the data lengths of the metadata in the CMR partition and the backup area are compared before and after backing up the metadata to be backed up. The data lengths of the metadata in the CMR partition and the backup area are also compared at preset intervals, which improves the reliability of the metadata stability. When the regular area storage space is full, a portion of the backup area is used to temporarily store the data to be stored, so as to retain at least a portion of the metadata in the backup area while meeting the storage requirements of the data to be stored as much as possible, thereby improving the continuity and stability of data storage.

[0097] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 80 includes a memory 801 and a processor 802 coupled to each other. The memory 801 stores program data (not shown in the figure), and the processor 802 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.

[0098] Please see Figure 9 , Figure 9 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 90 stores program data 900. When the program data 900 is executed by a processor, it implements the method in any of the above embodiments. For a detailed description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.

[0099] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0100] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0101] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0102] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A disk partitioning method, characterized in that, The disk partitioning method, applied to Shingled Magnetic Recording (SMR) disks, includes: The SMR disk is divided into a conventional magnetic recording (CMR) partition and an SMR partition, and the SuperBlock of the SMR disk is located in the CMR partition. The SMR partition is divided into a backup area and a regular area, and the backup area has corresponding area location information, which is stored in the superblock. The regular area is used to store data to be stored, the CMR partition is used to store metadata describing the data to be stored, and the backup area is used to back up the metadata in the CMR partition. The backup location and backup time of the metadata in the backup area are stored in the superblock. The length of newly added metadata in the CMR partition is monitored by a monitoring process until the length of the newly added metadata exceeds a length threshold. The newly added metadata corresponding to the length threshold is taken as metadata to be backed up, and a backup identifier is generated at the end of the metadata to be backed up in the CMR partition. Based on the region location information and the backup location in the superblock, the metadata to be backed up is backed up to the region after the current backup location; In response to the successful backup of the metadata to be backed up in the backup area, update the backup location and backup time in the superblock; Before backing up the metadata to be backed up to a region after the current backup location based on the region location information in the superblock and the backup location, the method further includes: The first comparison result is obtained by comparing the data length of the metadata before the metadata to be backed up in the CMR partition with the data length of all metadata in the backup area; In response to the first comparison result indicating a difference in length, the backup area is cleared, and the metadata preceding the metadata to be backed up in the CMR partition is re-backed up to the backup area. In response to the first comparison result being that the lengths are the same, the process proceeds to the step of backing up the metadata to be backed up to the region after the current backup location based on the region location information in the superblock and the backup location; Before updating the backup location and backup time in the superblock in response to a successful backup of the metadata to be backed up in the backup area, the method further includes: A second comparison result is obtained by comparing the data lengths of all metadata before the backup identifier in the CMR partition with the data lengths of all metadata in the backup area. In response to the second comparison result indicating a difference in length, based on the backup location stored in the superblock, the metadata to be backed up is re-backed up to the area after the current backup location in the backup area; In response to the second comparison result indicating that the lengths are the same, it is determined that the metadata to be backed up has been successfully backed up in the backup area.

2. The disk partitioning method according to claim 1, characterized in that, The CMR partition is located at the beginning of the SMR disk, and the SMR partition is located after the CMR partition; The step of dividing the SMR disk into conventional magnetic recording (CMR) partitions and SMR partitions includes: The preset storage space at the beginning of the SMR disk is formatted, and the formatted preset storage space is converted into the CMR partition; wherein the preset storage space has a preset proportion of capacity relative to the total capacity of the SMR disk; Determine the tail position of the CMR partition, and take the area after the tail position in the SMR disk as the SMR partition.

3. The disk partitioning method according to claim 1, characterized in that, The step of dividing the SMR partition into a backup area and a regular area includes: Select any region in the SMR partition as the backup region, and use the region outside the backup region as the regular region. Generate the region location information corresponding to the region start point and region end point of the backup region, and store the region location information in the superblock.

4. A data storage method, characterized in that, Applied to SMR disks, wherein the SMR disks are partitioned based on the disk partitioning method according to any one of claims 1-3, the data storage method includes: Based on the region location information stored in the superblock of the SMR disk, the data to be stored is stored in the regular area of ​​the SMR disk, and the metadata describing the data to be stored is stored in the CMR partition of the SMR disk; wherein, the SMR disk includes the CMR partition and the SMR partition, the SMR includes the regular area and the backup area, and the region location information of the backup area in the SMR partition is stored in the superblock of the SMR disk; The length of newly added metadata in the CMR partition is monitored using a monitoring process until the length of the newly added metadata exceeds a length threshold. The newly added metadata corresponding to the length threshold is then used as metadata to be backed up, and a backup identifier is generated at the end of the metadata to be backed up in the CMR partition. Based on the region location information, the metadata in the CMR partition is backed up to the backup region of the SMR disk, and the backup location and backup time of the metadata in the backup region are stored in the superblock of the SMR disk; wherein, the step of backing up the metadata in the CMR partition to the backup region of the SMR disk based on the region location information, and storing the backup location and backup time of the metadata in the backup region in the superblock of the SMR disk, includes: based on the region location information and the backup location in the superblock, backing up the metadata to be backed up to the region after the current backup location; in response to the successful backup of the metadata to be backed up in the backup region, updating the backup location and backup time in the superblock; Before backing up the metadata to be backed up to a region after the current backup location based on the region location information in the superblock and the backup location, the method further includes: The first comparison result is obtained by comparing the data length of the metadata before the metadata to be backed up in the CMR partition with the data length of all metadata in the backup area; In response to the first comparison result indicating a difference in length, the backup area is cleared, and the metadata preceding the metadata to be backed up in the CMR partition is re-backed up to the backup area. In response to the first comparison result being that the lengths are the same, the process proceeds to the step of backing up the metadata to be backed up to the region after the current backup location based on the region location information in the superblock and the backup location; Before updating the backup location and backup time in the superblock in response to a successful backup of the metadata to be backed up in the backup area, the method further includes: A second comparison result is obtained by comparing the data lengths of all metadata before the backup identifier in the CMR partition with the data lengths of all metadata in the backup area. In response to the second comparison result indicating a difference in length, based on the backup location stored in the superblock, the metadata to be backed up is re-backed up to the area after the current backup location in the backup area; In response to the second comparison result indicating that the lengths are the same, it is determined that the metadata to be backed up has been successfully backed up in the backup area.

5. The data storage method according to claim 4, characterized in that, After backing up the metadata in the CMR partition to the backup area of ​​the SMR disk based on the region location information, and storing the backup location and backup time of the metadata in the backup area into the superblock of the SMR disk, the method further includes: Using a preset duration as a period, the backup status of the backup area is determined every time the preset duration elapses; wherein, the backup status includes backup in progress and idle. When the backup status is in the process of backup, wait for the backup of the metadata to be backed up to be completed until the backup status is idle. In response to the backup status corresponding to the backup area being idle, compare the data length of all metadata before the backup identifier in the CMR partition with the data length of all metadata in the backup area to obtain a third comparison result. In response to the third comparison result being different in length, the area before the backup identifier in the CMR partition is taken as the first area to be determined, the area storing metadata in the backup area is taken as the second area to be determined, the area with longer data length in the first area to be determined and the second area to be determined is taken as the first partition, the area with shorter data length is taken as the second partition, the second partition is cleared, and all metadata in the first partition is backed up to the second partition. In response to the third comparison result indicating that the lengths are the same, the cycle corresponding to the next preset duration begins.

6. The data storage method according to claim 4, characterized in that, The step of storing metadata describing the data to be stored to the CMR partition of the SMR disk includes: Based on the data type of the data to be stored, the metadata corresponding to the data to be stored is stored in a first sub-region that matches the data type; wherein, the data type corresponds to a first number, and at least a portion of the CMR partition is divided into the first number of first sub-regions, each data type corresponds to its own first sub-region and the first sub-regions are isolated from each other.

7. The data storage method according to claim 4, characterized in that, After backing up the metadata in the CMR partition to the backup area of ​​the SMR disk based on the region location information, and storing the backup location and backup time of the metadata in the backup area into the superblock of the SMR disk, the method further includes: In response to the storage space in the regular area being full, a second sub-region is partitioned in the backup area; wherein the second sub-region is isolated from the third sub-region in the backup area that stores the metadata; The data to be stored is stored in the second sub-region, the metadata describing the data to be stored in the second sub-region is stored in the CMR partition, a location marker of the data to be stored in the backup region is generated, and a storage space warning signal is generated. In response to the storage space in the second sub-region being full, based on the timing of the storage of the metadata to the third sub-region, at least a portion of the metadata in the third sub-region is deleted to obtain a free sub-region. The data to be stored is stored in the free sub-region, and the metadata describing the data to be stored in the free sub-region is stored in the CMR partition. A location marker for the data to be stored in the backup region is generated. The storage space of the free sub-region is less than half that of the third sub-region. In response to the fact that the storage space in the free sub-region is full, a storage space alarm signal is generated.

8. The data storage method according to claim 7, characterized in that, After storing the data to be stored in the second sub-region, storing the metadata describing the data to be stored in the second sub-region in the CMR partition, generating a location marker for the data to be stored in the backup region, and generating a storage space warning signal, the method further includes: In response to the deletion of at least some of the data to be stored in the regular area, the data to be stored in the backup area is copied to the regular area based on the location marker, and the metadata in the CMR partition related to the data to be stored in the backup area and the metadata related to the deleted data to be stored in the regular area are updated. Clear the backup area and back up all metadata in the CMR partition to the backup area again.

9. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-3 or 4-8.

10. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the method as described in any one of claims 1-3 or 4-8.

Citation Information

Patent Citations

  • Data storage method and system

    CN110502455A

  • Data deleting method and device, electronic equipment and storage medium

    CN111506250A

  • Data storage method, device and system

    CN114371815A