Disk self-management method, data writing method and data reading method
By dividing the data area on the disk and storing disk attribute information, data and data attribute information, the problem that existing disk management methods cannot recover disk data after the host system is damaged, and the recovery and indiscriminate mobility of disk data are achieved.
Patent Information
- Application Number
- CN202411909799.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
AI Technical Summary
The existing disk management method cannot recover disk data after the host system is corrupted, and the disk and computer metadata disk cannot be recovered after it is corrupted.
By responding to disk self-management requests, disk space information is obtained, disk space is divided into disk units according to preset unit capacity, and disk units are divided into at least three data areas according to preset data area division rules for storing disk attribute information, data and data attribute information.
It realizes the recoverability of disk data and the indiscriminate movement between disk machines, ensuring that data can still be recovered after the host system is damaged.
Smart Images

Figure CN119828972A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a disk self-management method, a data writing method and a data reading method. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
[0003] With the advent of the big data era, as the scale of enterprises expands and their own business grows, enterprises need to uniformly plan, manage and measure storage resources from different dimensions such as user business, data, and services; disks, as a kind of computer hardware, are used for data storage; they use magnetic media to record and save digital information.
[0004] However, the existing disk management methods basically use binding with the host and marking the disk through some metadata methods. After the host system is damaged, the disk is basically unusable. That is, if the existing disk management method is used, the disk and the computing disk metadata disk cannot be restored after damage, and the disk data bound to the machine is unrecoverable.
[0005] Based on this, the present application urgently needs to propose a disk self-management method, a data writing method and a data reading method that can solve the above technical problems. Summary of the invention
[0006] Multiple aspects of the present application provide a disk self-management method, a data writing method and a data reading method to ensure the recoverability of disk data and achieve indiscriminate movement between disk machines.
[0007] In one aspect of the present application, a disk self-management method is provided, the method comprising:
[0008] In response to a disk self-management request, obtaining space information of the disk;
[0009] Based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit;
[0010] According to the preset data area division rule, several disk units are divided to form at least three data areas.
[0011] Furthermore, based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit, including: based on the space information of the disk, obtaining the space capacity of the disk; based on the space capacity of the disk, determining the preset unit capacity; and dividing the disk based on the preset unit capacity to form a disk unit.
[0012] Furthermore, dividing a plurality of disk units according to a preset data area division rule to form at least three data areas includes: dividing a plurality of disk units according to a preset head area division rule to form a head area for storing attribute information of the disk, wherein the attribute information of the disk includes at least a disk identification, a disk capacity, a disk status and a cyclic redundancy check value of the head area; dividing a plurality of disk units according to a preset data storage area division rule to form a data storage area for storing data; dividing a plurality of disk units according to a preset meta-information area division rule to form a meta-information area for storing attribute information of data stored in the data storage area.
[0013] Furthermore, a plurality of disk units are divided according to a preset meta-information area division rule to form a meta-information area for storing attribute information of the data stored in the data storage area, including: obtaining the number of the disk units and the preset unit capacity; determining the number of bytes of the disk unit based on the preset unit capacity; determining a first capacity based on the number of bytes of the disk unit and the number of disk units; dividing a plurality of disk units based on the first capacity to form a meta-information area for storing attribute information of the data stored in the data storage area; wherein the capacity of the meta-information area is not less than the first capacity.
[0014] Furthermore, a plurality of disk units are divided according to a preset data storage area division rule to form a data storage area for storing data, including: determining the number of disk units included in the meta-information area; determining the number of disk units included in the head area; based on the number of disk units included in the meta-information area, the number of disk units included in the head area and the total number of disk units, a plurality of disk units are divided to form a data storage area; wherein the disk unit is included in at most one data area, and the number of disk units included in the head area, the number of disk units included in the meta-information area and the number of disk units included in the data storage area are not greater than the total number of disk units included in the disk.
[0015] Another aspect of the present application provides a data writing method, the method being used to write data to a target disk generated based on the disk self-management method as described above, the method comprising:
[0016] In response to a data write request, acquiring attribute information of a data storage area of the target disk and attribute information of the data;
[0017] Based on the attribute information of the data storage area, writing the data into the data storage area;
[0018] generating meta information based on the attribute information of the data;
[0019] According to a preset meta-information writing rule, the meta-information is written into the meta-information area of the target disk.
[0020] Furthermore, based on the attribute information of the data storage area, the data is written to the data storage area, including: when the disk capacity of the target disk is not full, obtaining the first target disk unit included in the data storage area in a preset order, the target disk unit being a disk unit marked as empty; starting with the target disk unit, writing the data to the data storage area.
[0021] Furthermore, based on the attribute information of the data, meta information is generated, including: based on the data, generating a data identifier of the data; obtaining a data status, a data writing time and a data volume of the data; and generating meta information based on the data identifier, the data status, the data writing time and the data volume.
[0022] Furthermore, according to a preset meta-information writing rule, the meta-information is written into the meta-information area of the target disk, including: determining that all disk units occupied by the data storage area to which the data is written are a disk sequence; obtaining the relative position of the last disk unit included in the disk sequence relative to the first disk unit of the data storage area; determining the meta-information writing position of the meta-information based on the relative position, and writing the meta-information into the meta-information writing position.
[0023] Another aspect of the present application provides a data reading method for reading data from a target disk, the data being written to the target disk based on the data writing method as described above, the method comprising: caching meta-information of the meta-information area in response to a data reading request; locking a disk unit based on the meta-information, and reading data from the disk unit.
[0024] Another aspect of the present application provides a disk self-management device, the device comprising:
[0025] A response unit, configured to obtain the space information of the disk in response to the disk self-management request;
[0026] A division unit, used for dividing the disk according to preset unit capacity based on the space information of the disk to form disk units;
[0027] The forming unit is used to divide a plurality of disk units according to a preset data area division rule to form at least three data areas.
[0028] In another aspect of the present application, a data writing device is provided, the device comprising:
[0029] A response unit, configured to obtain attribute information of the data storage area of the target disk and attribute information of the data in response to a data write request;
[0030] a writing unit, configured to write the data into the data storage area based on the attribute information of the data storage area;
[0031] A generating unit, configured to generate meta information based on the attribute information of the data;
[0032] The writing unit is further used to write the meta-information into the meta-information area of the target disk according to a preset meta-information writing rule.
[0033] In another aspect of the present application, a data reading device is provided, the device comprising:
[0034] a cache unit, for caching the meta-information of the meta-information area in response to a data read request;
[0035] A reading unit is used to lock the disk unit based on the meta information and read the data of the disk unit.
[0036] In another aspect of the present application, an electronic device is provided, the electronic device comprising:
[0037] at least one processor; and
[0038] a memory communicatively connected to the at least one processor; wherein,
[0039] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.
[0040] In another aspect of the present application, a computer-readable medium is provided, on which computer program instructions are stored. The computer program instructions can be executed by a processor to implement the method according to any one of claims 1 to 10.
[0041] In another aspect of the present application, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method as described above is implemented.
[0042] The present application proposes a disk self-management method, a data writing method, and a data reading method, wherein the disk self-management method includes: in response to a disk self-management request, obtaining the space information of the disk; based on the space information of the disk, dividing the disk according to a preset unit capacity to form a disk unit; dividing a number of disk units according to a preset data area division rule to form at least three data areas. The present application divides a number of disk units into at least three data areas for storing the attribute information of the disk, data, and attribute information of the data, respectively, to ensure that when the host system is damaged / failed, even if the disk is plugged into another host system and recognized, the data stored on the disk can be obtained, thereby realizing the non-differential reading and arbitrary portability of the disk data;
[0043] Furthermore, the data writing method proposed in the present application includes: in response to a data writing request, obtaining the attribute information of the data storage area of the target disk and the attribute information of the data; based on the attribute information of the data storage area, writing the data to the data storage area; based on the attribute information of the data, generating meta information; and writing the meta information to the meta information area of the target disk according to a preset meta information writing rule. By responding to a data writing request based on a plurality of pre-divided data areas, the data is written into the corresponding data area to achieve standardized data writing, thereby ensuring efficient and accurate reading of subsequent data;
[0044] Furthermore, the data reading method proposed in the present application includes: in response to a data reading request, caching the meta-information of the meta-information area; locking the disk unit based on the meta-information, and reading the data of the disk unit; so as to achieve efficient and accurate reading of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0047] Figure 1 A flowchart of a disk self-management method provided in one embodiment of the present application;
[0048] Figure 2 A schematic diagram of the structure of a target disk architecture provided in an embodiment of the present application;
[0049] Figure 3 A schematic diagram of a flow chart of a data writing method provided in another embodiment of the present application;
[0050] Figure 4 A flowchart of a data reading method provided by another embodiment of the present application;
[0051] Figure 5 A schematic diagram of the structure of a disk self-management device provided in yet another embodiment of the present application;
[0052] Figure 6 A schematic diagram of the structure of a data writing device provided in yet another embodiment of the present application;
[0053] Figure 7 A schematic diagram of the structure of a data reading device provided in another embodiment of the present application;
[0054] Figure 8 A schematic diagram of the structure of an electronic device suitable for implementing the solution in the embodiments of the present application;
[0055] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] In a typical configuration of the present application, the terminal and the equipment of the service network each include one or more processors (CPU), input / output interface, network interface and memory.
[0058] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0059] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer program instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0060] The present invention provides a method for self-management of a disk, the method comprising:
[0061] In response to a disk self-management request, obtaining space information of the disk;
[0062] Based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit;
[0063] According to the preset data area division rule, several disk units are divided to form at least three data areas.
[0064] In actual scenarios, the execution subject of the method can be a user device, or a device formed by integrating a user device and a network device through a network, or an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0065] Embodiment 1
[0066] Figure 1 The processing flow of a disk self-management method provided by an embodiment of the present application is shown, and the method at least includes the following processing steps:
[0067] Step S101, in response to a disk self-management request, obtaining space information of the disk;
[0068] Step S102: based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit;
[0069] Step S103: Divide a plurality of disk units according to a preset data area division rule to form at least three data areas.
[0070] In one of the embodiments, the disk self-management method is applied to an EC storage system (Erasure Coding), which divides data into multiple fragments, encodes the fragments in a certain way, generates redundant data fragments, and stores them on different devices. When some data is lost, the data can be reconstructed through fragments on other devices.
[0071] In one embodiment, based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit, which includes: based on the space information of the disk, obtaining the space capacity of the disk; based on the space capacity of the disk, determining the preset unit capacity; and dividing the disk based on the preset unit capacity to form a disk unit.
[0072] The disk space capacity of the present embodiment is 10T, and the preset unit capacity is 16M, that is, the disk with 10T capacity is divided into 655360 disk units according to the unit capacity of 16M.
[0073] In one embodiment, dividing a plurality of disk units according to a preset data area division rule to form at least three data areas includes: dividing a plurality of disk units according to a preset head area division rule to form a head area for storing disk attribute information, wherein the disk attribute information at least includes a disk identifier, a disk capacity, a disk status, and a cyclic redundancy check value of the head area; dividing a plurality of disk units according to a preset data storage area division rule to form a data storage area for storing data; dividing a plurality of disk units according to a preset meta-information area division rule to form a meta-information area for storing attribute information of data stored in the data storage area. Specifically, the structural diagram of the target disk is as follows: Figure 2 shown.
[0074] In one embodiment, a plurality of disk units are divided according to a preset meta-information area division rule to form a meta-information area for storing attribute information of data stored in the data storage area, including: obtaining the number of the disk units and the preset unit capacity; determining the number of bytes of the disk unit based on the preset unit capacity; determining a first capacity based on the number of bytes of the disk unit and the number of disk units; dividing a plurality of disk units based on the first capacity to form a meta-information area for storing attribute information of data stored in the data storage area; wherein the capacity of the meta-information area is not less than the first capacity.
[0075] The disk includes a head area, a meta-information area and a data storage area from front to back.
[0076] Specifically, several disk units are divided according to the preset meta-information area division rules to form a meta-information area including: taking a disk with a space capacity of 10T as an example, a 10T disk includes 655360 16M disk units, each 16M disk unit + reserved size is calculated as 64 bytes, and the metadata size is approximately 655360*64 / 1024 / 1024=40M, then the reserved size is 40M+512 bytes, that is, in this example, 6 16M disk units are defined as meta-information areas. It should be understood that the reason why this embodiment defines 6 16M as meta-information areas is that the space capacity of each disk unit is 16M, and defining the meta-information area as an integer multiple of 16M is just to facilitate disk calculation; in actual application scenarios, those skilled in the art can reasonably select the capacity space of the meta-information area according to actual conditions, and only need to ensure that the meta-information can be stored.
[0077] In one embodiment, a plurality of disk units are divided according to a preset data storage area division rule to form a data storage area for storing data, including: determining the number of disk units included in the meta-information area; determining the number of disk units included in the head area; based on the number of disk units included in the meta-information area, the number of disk units included in the head area and the total number of disk units, dividing a plurality of disk units to form a data storage area; wherein the disk unit is included in at most one data area, and the number of disk units included in the head area, the number of disk units included in the meta-information area and the number of disk units included in the data storage area are not greater than the total number of disk units included in the disk.
[0078] In this embodiment, the disk is divided into a head area, a meta-information area and a data storage area. When the disk is loaded for the first time, header information (i.e., attribute information of the disk) is generated for the disk and stored in the head area. When a disk write request is obtained, meta-information is generated for the corresponding data and stored in the meta-information area while the data is stored in the data storage area. By processing the disk and the data to be stored in the disk, the non-differentiated movement of the disk and the efficient and accurate reading of data are finally achieved.
[0079] Specifically, when a target disk (single disk for short) is damaged, the cluster can calculate and restore the single disk data through the EC storage system; if other metadata is lost, all data can be restored by scanning the disk; specifically, the relationship between multiple target disks is 1+2=3, that is, each target disk stores 1, 2, and 3 values respectively. If 2 is lost, the data of the target disk can be restored through 3-1=2.
[0080] Embodiment 2
[0081] Figure 3 The processing flow of a data writing method provided by an embodiment of the present application is shown, and the method includes at least the following processing steps:
[0082] Step S201, in response to a data write request, obtaining attribute information of the data storage area of the target disk and attribute information of the data;
[0083] Step S202: writing the data into the data storage area based on the attribute information of the data storage area;
[0084] Step S203: Generate meta information based on the attribute information of the data;
[0085] Step S204: write the meta-information into the meta-information area of the target disk according to a preset meta-information writing rule.
[0086] In one embodiment, the data is written to the data storage area based on the attribute information of the data storage area, including: when the disk capacity of the target disk is not full, obtaining the first target disk unit included in the data storage area in a preset order, the target disk unit being a disk unit marked as empty; and writing the data to the data storage area starting with the target disk unit.
[0087] Specifically, the upper layer of the EC storage system writes data with 16M as one disk unit, and divides 655360 disk units by bitmap marks. When the disk capacity of the target disk is not full, the data is written to the disk units in sequence.
[0088] In one embodiment, meta information is generated based on the attribute information of the data, including: generating a data identifier of the data based on the data; obtaining a data status, a data writing time and a data volume of the data; and generating meta information based on the data identifier, the data status, the data writing time and the data volume.
[0089] In one embodiment, based on the attribute information of the data, meta-information is generated, including: generating a data identifier of the data based on the data; acquiring the write relative position, data status, data write time, data volume and reserved space capacity of the data to construct the meta-information of the data.
[0090] In one embodiment, the meta-information is written into the meta-information area of the target disk according to a preset meta-information writing rule, including: determining that all disk units occupied by the data storage area to which the data is written are a disk sequence; obtaining the relative position of the last disk unit included in the disk sequence relative to the first disk unit of the data storage area; determining the meta-information writing position of the meta-information based on the relative position, and writing the meta-information into the meta-information writing position.
[0091] Specifically, assuming that the data is written to the 4th 16M position, the meta-information size of the mark data is fixed, and is written to the 4th meta-information bit after the head area relative to the target disk (it can also be understood as the 4th meta-information bit written to the meta-information area).
[0092] Embodiment 3
[0093] Figure 4 The processing flow of a data reading method provided by an embodiment of the present application is shown, and the method includes at least the following processing steps:
[0094] Step S301, in response to a data read request, caching the meta-information of the meta-information area;
[0095] Step S302: Lock the disk unit based on the meta-information, and read the data of the disk unit.
[0096] Specifically, when reading data, the target disk's metadata set is cached in memory, and specific data can be directly locked based on the metadata. The target disk's metadata set is cached in memory to cache data in memory for acceleration, thereby reducing disk reading. For example, if a file is called xxxx and you want to check the data location, you don't need to read the disk metadata, and the bytes stored in the memory can locate the specific location of the data.
[0097] In one implementation mode, when the target disk is restarted or moved to another node, the header information of the target disk is first read to verify the validity of the target disk.
[0098] Embodiment 4
[0099] Figure 5 A schematic diagram of the structure of a disk self-management device provided in an embodiment of the present application is shown, and the device at least includes:
[0100] A response unit, configured to obtain the space information of the disk in response to the disk self-management request;
[0101] A division unit, used for dividing the disk according to preset unit capacity based on the space information of the disk to form disk units;
[0102] The forming unit is used to divide a plurality of disk units according to a preset data area division rule to form at least three data areas.
[0103] Embodiment 5
[0104] Figure 6 A schematic diagram of the structure of a data writing device provided in an embodiment of the present application is shown, and the device at least includes:
[0105] A response unit, configured to obtain attribute information of the data storage area of the target disk and attribute information of the data in response to a data write request;
[0106] a writing unit, configured to write the data into the data storage area based on the attribute information of the data storage area;
[0107] A generating unit, configured to generate meta information based on the attribute information of the data;
[0108] The writing unit is further used to write the meta-information into the meta-information area of the target disk according to a preset meta-information writing rule.
[0109] Embodiment 6
[0110] Figure 7 A schematic diagram of the structure of a data reading device provided in an embodiment of the present application is shown, and the device at least includes:
[0111] a cache unit, for caching the meta-information of the meta-information area in response to a data read request;
[0112] A reading unit is used to lock the disk unit based on the meta information and read the data of the disk unit.
[0113] Embodiment 7
[0114] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present application, and the method corresponding to the electronic device may be the disk self-management method, data writing method, and data reading method in the aforementioned embodiment, and the principle of solving the problem is similar to that of the method. The electronic device provided in an embodiment of the present application includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.
[0115] The electronic device may be a user device, or a device formed by integrating a user device and a network device through a network, or may be an application running on the above device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, tablet computers, smart watches, and bracelets. The network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets, which can be used to implement some processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.
[0116] Figure 8 The structure of an electronic device suitable for implementing the method and / or technical solution in the embodiment of the present application is shown, and the device 500 includes a central processing unit (CPU, Central Processing Unit) 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM, Read Only Memory) 502 or the program loaded from the storage part 508 to the random access memory (RAM, Random Access Memory) 503. In RAM503, various programs and data required for system operation are also stored. CPU 501, ROM 502 and RAM 503 are connected to each other through a bus 504. An input / output (I / O, Input / Output) interface 505 is also connected to the bus 504.
[0117] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, etc., and a speaker, etc.; a storage section 508 including one or more computer-readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet.
[0118] In particular, the methods and / or embodiments in the embodiments of the present application may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 501, the above functions defined in the method of the present application are executed.
[0119] Embodiment 8
[0120] Another embodiment of the present application further provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the methods and / or technical solutions of any one or more embodiments of the present application described above.
[0121] Specifically, the present embodiment can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0122] Computer readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than a computer readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device.
[0123] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0124] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0125] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0126] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0127] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or page components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0128] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0129] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0130] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
[0132] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in a device claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
Claims
1. A disk self-management method, characterized in that: The method comprises: In response to a disk self-management request, obtaining space information of the disk; Based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit; According to the preset data area division rule, several disk units are divided to form at least three data areas.
2. The disk self-management method according to claim 1, characterized in that: Based on the space information of the disk, the disk is divided according to a preset unit capacity to form a disk unit including: Based on the space information of the disk, obtaining the space capacity of the disk; Determining the preset unit capacity based on the space capacity of the disk; The disk is divided based on a preset unit capacity to form disk units.
3. The disk self-management method according to claim 2, characterized in that: According to the preset data area division rules, several disk units are divided to form at least three data areas including: Dividing a plurality of disk units according to a preset head area division rule to form a head area for storing attribute information of the disk, wherein the attribute information of the disk at least includes a disk identification, a disk capacity, a disk status and a cyclic redundancy check value of the head area; Dividing a plurality of disk units according to a preset data storage area division rule to form a data storage area for storing data; A plurality of disk units are divided according to a preset meta-information area division rule to form a meta-information area for storing attribute information of the data stored in the data storage area.
4. The disk self-management method according to claim 3, characterized in that: According to a preset meta-information area division rule, a plurality of disk units are divided to form a meta-information area for storing attribute information of the data stored in the data storage area, including: Obtaining the number of the disk units and the preset unit capacity; Determining the number of bytes of the disk unit based on the preset unit capacity; determining a first capacity based on the number of bytes of the disk unit and the number of the disk units; Dividing a plurality of disk units based on the first capacity to form a meta-information area for storing attribute information of the data stored in the data storage area; The capacity of the meta-information area is not less than the first capacity.
5. The disk self-management method according to claim 4, characterized in that: According to the preset data storage area division rules, several disk units are divided to form a data storage area for storing data, including: Determining the number of disk units included in the meta information area; Determining the number of magnetic disk units included in the magnetic head area; Based on the number of disk units included in the meta-information area, the number of disk units included in the head area and the total number of disk units, a plurality of disk units are divided to form a data storage area; The disk unit is included in at most one data area, and the number of disk units included in the head area, the number of disk units included in the meta-information area and the number of disk units included in the data storage area are not greater than the total number of disk units included in the disk.
6. A data writing method, characterized in that: The method is used to write data to a target disk generated based on the disk self-management method according to any one of claims 1 to 5, and the method comprises: In response to a data write request, acquiring attribute information of a data storage area of the target disk and attribute information of the data; Based on the attribute information of the data storage area, writing the data into the data storage area; generating meta information based on the attribute information of the data; According to a preset meta-information writing rule, the meta-information is written into the meta-information area of the target disk.
7. The data writing method according to claim 6, characterized in that: Based on the attribute information of the data storage area, writing the data into the data storage area includes: When the disk capacity of the target disk is not full, obtaining the first target disk unit included in the data storage area in a preset order, the target disk unit being a disk unit marked as empty; Starting with the target disk unit, the data is written to the data storage area.
8. The data writing method according to claim 7, characterized in that: Based on the attribute information of the data, meta information is generated, including: Based on the data, generate a data identifier of the data; Acquire the data status, data writing time and data volume of the data; Meta information is generated based on the data identifier, the data status, the data writing time and the data amount.
9. The data writing method according to claim 8, characterized in that: Writing the meta-information into the meta-information area of the target disk according to a preset meta-information writing rule includes: Determine that all disk units occupied by the data storage area to which the data is written are disk sequences; Obtaining a relative position of the last disk unit included in the disk sequence relative to the first disk unit in the data storage area; A meta-information writing position of the meta-information is determined based on the relative position, and the meta-information is written into the meta-information writing position.
10. A data reading method, characterized in that: The method is used to read data from a target disk, the data being written to the target disk based on the data writing method according to any one of claims 6 to 9, the method comprising: In response to a data read request, caching the meta-information of the meta-information area; The disk unit is locked based on the meta information, and data of the disk unit is read.
11. A disk self-management device, characterized in that: The device comprises: A response unit, configured to obtain the space information of the disk in response to the disk self-management request; A division unit, used for dividing the disk according to preset unit capacity based on the space information of the disk to form disk units; The forming unit is used to divide a plurality of disk units according to a preset data area division rule to form at least three data areas.
12. A data writing device, characterized in that: The device comprises: A response unit, configured to obtain attribute information of the data storage area of the target disk and attribute information of the data in response to a data write request; a writing unit, configured to write the data into the data storage area based on the attribute information of the data storage area; A generating unit, configured to generate meta information based on the attribute information of the data; The writing unit is further used to write the meta-information into the meta-information area of the target disk according to a preset meta-information writing rule.
13. A data reading device, characterized in that: The device comprises: a cache unit, for caching the meta-information of the meta-information area in response to a data read request; A reading unit is used to lock the disk unit based on the meta information and read the data of the disk unit.
14. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; Its characteristics are: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
15. A computer readable medium having computer program instructions stored thereon, wherein: The computer program instructions are executable by a processor to implement the method according to any one of claims 1 to 10.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.