CN117591041A - Data writing method and device, mechanical hard disk and storage medium - Google Patents

Data writing method and device, mechanical hard disk and storage medium Download PDF

Info

Publication number
CN117591041A
CN117591041A CN202410077501.3A CN202410077501A CN117591041A CN 117591041 A CN117591041 A CN 117591041A CN 202410077501 A CN202410077501 A CN 202410077501A CN 117591041 A CN117591041 A CN 117591041A
Authority
CN
China
Prior art keywords
data block
data
writing
block group
mark
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410077501.3A
Other languages
Chinese (zh)
Inventor
谭春海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kelai Network Technology Co ltd
Original Assignee
Kelai Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kelai Network Technology Co ltd filed Critical Kelai Network Technology Co ltd
Priority to CN202410077501.3A priority Critical patent/CN117591041A/en
Publication of CN117591041A publication Critical patent/CN117591041A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The application relates to the technical field of data storage, and provides a data writing method, a device, a mechanical hard disk and a storage medium, wherein the method comprises the following steps: dividing the disk partition space into a plurality of data block groups; wherein, the number of the data block group is gradually increased from the outer ring to the inner ring of the magnetic disk; the capacity of each data block group is 1G-8G; when writing data into the disk, alternately writing data into the low-number data block group and the high-number data block group according to a preset writing rule. The method and the device divide the disk partition space into a plurality of small data block groups, so that when a writing space is allocated for a file, the next data block group can be switched more quickly; in addition, when a new space is allocated for the file, the low-number data block group and the high-number data block group are alternately allocated, and writing is gradually performed to the middle data block group, so that the performances of the low-number data block group and the high-number data block group are neutralized, and the overall data writing rate is balanced.

Description

Data writing method and device, mechanical hard disk and storage medium
Technical Field
The present disclosure relates to the field of data storage technologies, and in particular, to a data writing method and apparatus, a mechanical hard disk, and a storage medium.
Background
The existing file system manages disk space by dividing a disk partition into a plurality of data block groups, wherein the capacity of each data block group is very large, and is basically between 10G and 1T, as shown in figure 1, each data block group manages a plurality of blocks, each block corresponds to one disk address, when the disk partition is formatted, the relation between the file system and the data block group and the blocks is good, the low-number data block group manages the low-number block, and when the file system allocates new space for a file, the file system allocates the low-number data block group to the high-number data block group, namely, writing of the disk space is from the low-number block to the high-number block. Since the addressing mode of the mechanical hard disk is gradually reduced from the outer ring to the inner ring, when the existing file system writes data to the mechanical hard disk, the writing performance is lower and lower, the highest performance and the lowest performance are different by more than 1 time, and when a large number of continuous writing operations are performed, the performance can be met just at the beginning, but when the data is written to the rear, the IO performance of the magnetic disk is reduced, and the service requirement can not be met.
Disclosure of Invention
In view of this, the embodiments of the present application provide a data writing method, apparatus, mechanical hard disk, and storage medium, which can effectively solve the problem of unbalanced writing performance of data in a disk partition.
In a first aspect, an embodiment of the present application provides a data writing method, including:
dividing the disk partition space into a plurality of data block groups; the numbers of the data block groups are gradually increased from the outer ring to the inner ring of the magnetic disk;
when writing data into the disk, alternately writing data into the low-number data block group and the high-number data block group according to a preset writing rule.
In some embodiments, after the dividing the disk partition space into the plurality of data block groups, the method further comprises:
generating a mark file; the marking file is used for recording the service condition of each data block group; wherein the capacity size of each data block group is 1G-8G.
In some embodiments, the usage of the set of data blocks is marked according to a first mark and a second mark;
if the space of the data block group is full of data, a first mark is used;
if the space of the data block group is not written with data or is not fully written with data, the use mark is a second mark.
In some embodiments, the alternately writing the data to the low-numbered data block group and the high-numbered data block group according to the preset writing rule includes:
and according to a rule of writing data from the data block groups at two ends of the disk partition space to the middle data block group step by step, alternately writing data into the first preset number of low-number data block groups and the second preset number of high-number data block groups.
In some embodiments, the alternately writing data to the first preset number of low-numbered data block groups and the second preset number of high-numbered data block groups according to a stepwise writing rule from the two end data block groups to the middle data block group of the disk partition space includes:
taking the first preset number of low-number data block groups and the second preset number of high-number data block groups as a writing group;
when writing data into each writing group, writing the data into the low-number data block group, and then writing the data into the high-number data block group;
before each data block group writes data, checking the use mark of the current data block group, and if the use mark is 1, writing the data into the next data block group.
In some embodiments, after the current data writing is completed, the currently used data block group is marked in a third way;
and when the data is written again, searching the data block group with the third mark, and writing the data to be written from the current data block group with the third mark.
In some embodiments, the partitioning the disk partition space into a plurality of data block groups comprises:
acquiring the total storage capacity of the disk partition space;
judging the capacity grade of the disk partition space according to the total storage capacity and a preset capacity grade dividing rule;
and determining the capacity size of each data block group according to the capacity grade.
In some embodiments, further comprising: and after writing data into each data block group, modifying the mark file according to the use condition.
In a second aspect, an embodiment of the present application provides a data writing apparatus, including:
the dividing module is used for dividing the disk partition space into a plurality of data block groups; the numbers of the data block groups are gradually increased from the outer ring to the inner ring of the magnetic disk;
and the writing module is used for alternately writing data into the low-number data block group and the high-number data block group according to a preset writing rule when writing data into the magnetic disk.
In a third aspect, embodiments of the present application provide a mechanical hard disk, where the mechanical hard disk includes a processor and a memory, where the memory stores a computer program, and the processor is configured to execute the computer program to implement the data writing method described above.
In a fourth aspect, embodiments of the present application provide a readable storage medium storing a computer program that, when executed on a processor, implements the data writing method described above.
The embodiment of the application has the following beneficial effects: the method and the device divide the disk partition space into a plurality of small data block groups, so that when a writing space is allocated for a file, the next data block group can be switched more quickly; further, when a new space is allocated to the file, the low-number data block group and the high-number data block group are alternately allocated, and writing is gradually performed to the middle data block group, so that the performances of the low-number data block group and the high-number data block group are neutralized, the whole data writing rate is balanced, and the problem that the writing data rate is slower and slower does not occur.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a prior art disk partition;
FIG. 2 is a schematic diagram of a first flow chart of a data writing method according to an embodiment of the present application;
FIG. 3 is a second flow chart of a data writing method according to an embodiment of the present application;
fig. 4 shows a schematic structural diagram of a data writing device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments.
The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
In the following, the terms "comprises", "comprising", "having" and their cognate terms may be used in various embodiments of the present application are intended only to refer to a particular feature, number, step, operation, element, component, or combination of the foregoing, and should not be interpreted as first excluding the existence of or increasing the likelihood of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing. Furthermore, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and should not be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of this application belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having a meaning that is identical to the meaning of the context in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in connection with the various embodiments.
Some embodiments of the present application are described in detail below with reference to the accompanying drawings. The embodiments described below and features of the embodiments may be combined with each other without conflict.
Because the IO performance of the disk in the prior art is slower and slower in the later period, and normal service requirements are affected, the application provides a data writing method, a device, a mechanical hard disk and a storage medium. The data writing method can balance the writing speed of the magnetic disk, so that the writing of the mechanical hard disk can continuously keep the high-efficiency effect.
The data writing method will be described with reference to some specific embodiments.
Fig. 2 shows a schematic flow chart of a data writing method according to an embodiment of the present application. The data writing method comprises the following steps:
step S100, dividing the disk partition space into a plurality of data block groups.
Specifically, in the present application, the disk partition space is divided into a plurality of smaller data block groups, the capacity of each data block group is 1G-8G, and the number of the data block group is gradually increased from the disk outer ring to the inner ring direction, that is, the low number data block group is on the disk outer ring, the high number data block group is on the disk inner ring, that is, from the disk outer ring to the disk inner ring, the number of the data block group is higher and higher, it should be noted that the low number data block group and the high number data block group are not specifically limited, which number data block groups are low number data block groups, which number data block group are high number data block groups, and the low number data block group and the high number data block group are a relative concept, such as 1-100 data block groups in total, but if 1-60 number data block groups have already been written into data, and 70-100 data block groups have also been written into data, then 61-69, among the remaining data block groups, 61 is the low number data block group and 69 is the high number data block group.
In the present application, when the disk partition space is divided into a plurality of data block groups, the size of each data block group may be directly set through parameters, for example, each data block group may be set to 1G size, 2G size or 4G size independently of the total storage capacity of the disk partition space.
In addition, the size of each data block group may be allocated according to a certain rule, as shown in fig. 3, fig. 3 shows a manner of dividing the disk partition space into a plurality of data block groups, specifically:
step S110, obtaining the total storage capacity of the disk partition space.
And step S120, judging the capacity grade of the disk partition space according to the total storage capacity and a preset capacity grade dividing rule.
And step S130, determining the capacity size of each data block group according to the capacity grade.
Specifically, when dividing the disk partition space, the size of each data block group is determined according to the total storage capacity of the disk partition space, if the total capacity is larger, the space allocated by a single data block group can be larger, and if the total capacity is smaller, the space allocated by the single data block group is smaller. If the total capacity is smaller than or equal to 4T capacity grade 1, larger than 4T and smaller than or equal to 6T capacity grade 2, larger than 6T and smaller than 8T capacity grade 3, larger than 8T capacity grade 4; if the capacity level of the total capacity is 1 level, the size of the single data block group is allocated to 1G, if the capacity level of the total capacity is 2 level, the size of the single data block group is allocated to 2G, if the capacity level of the total capacity is 3 level, the size of the single data block group is allocated to 4G, and if the capacity level of the total capacity is 4 level, the size of the single data block group is allocated to 8G, it should be noted that the above-mentioned division of the capacity levels and the allocation space size of the single data block group are only for facilitating the understanding of the above-mentioned steps S110 to S130, and the specific capacity level division and the allocation space size of the single data block group corresponding to each capacity level are determined according to the actual situation, and are not particularly limited herein.
For another example, when dividing the disk partition space, taking an xfs file system as an example, the xfs formatting tool supports the number of configuration data block groups, we package the xfs formatting tool into a script, realize the division of the disk partition space through the script, and generate the markup file. The script firstly obtains the total size of the disk partition, then divides the total size of the disk partition by the size of the data block group to obtain the number of the block groups, and the calculated number of the block groups is used as the formatting parameter of an xfs formatting tool. The size of the data block group is configured in a range of 1-8G, and the configuration can be automatically configured according to the size of the disk partition, for example, the size of the data block group is smaller than 4T and 1G, the size of the data block group is smaller than 6T and 2G, the size of the data block group is larger than 4T and smaller than 6T, the size of the data block group is smaller than 100T and 4G, and the size of the data block group is larger than 100T and 8G.
Further, after the dividing the disk partition space into the plurality of data block groups, the method further includes:
generating a mark file; and the mark file is used for recording the use condition of each data block group. Specifically, the use condition of the data block group is marked according to a first mark and a second mark; if the space of the data block group is full of data, using a mark as a first mark; if the space of the data block group is not written with data or is not fully written with data, the use mark is a second mark. The first mark and the second mark can be marked in a binary mode, namely if the space of the data block group is full of data, the mark is 1; if the space of the data block group is not written with data or is not fully written with data, the use mark is 0; the first mark and the second mark may be marked in other ways, so long as the use condition of the data block group can be distinguished, and the method is not particularly limited herein.
It will be appreciated that when dividing the disk partition space, a flag file is generated just, and no data is written in each data block group at this time, so when dividing the disk partition space, an initial flag file is generated at this time, and each byte in the initial flag file is 0. After writing data, if the space of a certain data block group is allocated, the use mark of the data block group is a first mark, if the data of the data block group is deleted and a part or all of the space is recovered, the use mark of the data block group is modified to a second mark, and if the space of a certain data block group is not allocated, i.e. the data is not fully written, the use mark of the data block group is a second mark, and the use mark of each modification is written into a mark file.
And step 200, when writing data into the magnetic disk, alternately writing data into the low-number data block group and the high-number data block group according to a preset writing rule.
Specifically, when writing data into the disk, that is, when allocating a new space for a file, the low-number data block groups and the high-number data block groups are alternately allocated, that is, the file is written into a first preset number of low-number data block groups, then written into a second preset number of high-number data block groups, and data is gradually written into the middle data block groups.
The data block group can be used as a writing group according to the first preset number of low-number data block groups and the second preset number of high-number data block groups; when each writing group writes data, the data is written into the low-number data block group firstly, and then the high-number data block group is written; after the previous writing group is full of data, the data is then written into the next writing group, for example, 1-100 data block groups, the first preset number is 3, the second preset number is 2, the first writing group is the low number data block groups of 1, 2 and 3 and the high number data block groups of 100 and 99, the second writing group is the low number data block groups of 4, 5 and 6 and the high number data block groups of 98 and 97, and so on until all the data block groups are written, namely, when the data is written into the disk, the data is written into the low number data block groups of 1, 2 and 3, then the high number data block groups of 100, 99 are written into the low number data block groups of 4, 5 and 6, then the high number data block groups of 98 and 97 are written into the high number data block groups of 98 and 97, and so on.
Further, before each data block group writes data, checking the use mark of the current data block group, and if the use mark is the first mark, writing the data into the next data block group.
Further, after the current data writing is completed, the currently used data block group is marked for the third time; when the data is written again, searching the data block group with the third mark, and writing the data to be written from the current data block group with the third mark. That is, each time a data block group is allocated, the data block group currently being used is recorded, and a third mark is performed, and next time a space is allocated for the file, allocation is started from the data block group marked with the third mark. If the written file is allocated to the data block group No. 5 at this time and the file is already written to the disk, the data block group No. 5 is marked with a third mark at this time, which indicates that the data block group is currently used, and when the data block group is allocated to the file again next time, the space is allocated directly from the data block group No. 5.
Further, when allocating space for a file, if a data block group with already allocated space, i.e. a data block group full of data, is encountered, the next data block group can be found directly according to the use mark, and if all data block groups are cycled and no available data block group is found, a space allocation failure error is returned, i.e. the current file cannot be written into the disk.
It should be noted that, when writing data into the data fast-set alternately, the difference between the first preset number of the low-number data block groups and the second preset number of the high-number data block groups cannot be too large, the difference between the first preset number and the second preset number should be kept between 0 and 3, and preferably, both the first preset number and the second preset number are smaller than or equal to 5. That is, 1 low 1 high, 2 low 2 high, 3 low 1 high, 3 low 3 high, etc. are used to write data alternately to the data fast group, and are not exemplified herein.
Further, before writing data to disk, it is necessary to suspend the disk partition in a directory in the broom system before the data can be read and written under the disk partition. When the disk partition is mounted, the validity of the mark file corresponding to the disk partition is checked, if the mark file is legal, the mark information is loaded into the memory, and if the mark file is illegal, whether each data block group has residual blocks or not, namely whether residual space exists or not is checked, and the mark file is regenerated. The validity detection rules of the markup file are: the file size is equal to the number of chunks and each byte size range is 0 or 1.
By adopting the mode of alternately writing data into the low-number data block group and the high-number data block group, the average writing performance of the detected disk partition in each shorter sampling time range (5-10 s) is basically the same, the average writing performance is only reduced by about 25% compared with the fastest outer ring in the prior art, and the effects of balancing the writing performance of a mechanical hard disk and keeping high efficiency are realized.
The method divides the disk partition space into a plurality of small data block groups, and the size of each data block group is 1G-8G, so that when a writing space is allocated for a file, the next data block group can be switched more quickly; further, when a new space is allocated to the file, in the prior art, space allocation is sequentially performed to the high-number data block group from the low-number data block group, and the low-number data block group and the high-number data block group are alternately allocated and gradually written into the middle data block group, so that the performances of the low-number data block group and the high-number data block group are neutralized, the whole data writing rate is balanced, and the problem that the writing data rate is slower and slower is avoided.
Fig. 4 shows a schematic structural diagram of a data writing device according to an embodiment of the present application. Illustratively, the data writing apparatus includes:
a dividing module 100, configured to divide a disk partition space into a plurality of data block groups; the numbers of the data block groups are gradually increased from the outer ring to the inner ring of the magnetic disk; the capacity of each data block group is 1G-8G.
The writing module 200 is configured to alternately write data into the low-numbered data block group and the high-numbered data block group according to a preset writing rule when writing data into the disk.
It will be appreciated that the apparatus of this embodiment corresponds to the data writing method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so the description will not be repeated here.
The application also provides a mechanical hard disk, which exemplarily comprises a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program, so that the terminal equipment executes the data writing method or the functions of each module in the data writing device.
The processor may be an integrated circuit chip with signal processing capabilities. The processor may be a general purpose processor including at least one of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU) and a network processor (Network Processor, NP), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application.
The Memory may be, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc. The memory is used for storing a computer program, and the processor can correspondingly execute the computer program after receiving the execution instruction.
The present application also provides a readable storage medium for storing the computer program for use in the above terminal device.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, of the flow diagrams and block diagrams in the figures, which illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules or units in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application.

Claims (11)

1. A data writing method, comprising:
dividing the disk partition space into a plurality of data block groups; the numbers of the data block groups are gradually increased from the outer ring to the inner ring of the magnetic disk;
when writing data into the disk, alternately writing data into the low-number data block group and the high-number data block group according to a preset writing rule.
2. The data writing method as claimed in claim 1, wherein after dividing the disk partition space into a plurality of data block groups, further comprising:
generating a mark file; the marking file is used for recording the service condition of each data block group; wherein the capacity size of each data block group is 1G-8G.
3. The data writing method according to claim 2, wherein the use condition of the data block group is marked according to a first mark and a second mark;
if the space of the data block group is full of data, a first mark is used;
if the space of the data block group is not written with data or is not fully written with data, the use mark is a second mark.
4. The data writing method according to claim 3, wherein alternately writing data to the low-numbered data block group and the high-numbered data block group according to a preset writing rule comprises:
and according to a rule of writing data from the data block groups at two ends of the disk partition space to the middle data block group step by step, alternately writing data into the first preset number of low-number data block groups and the second preset number of high-number data block groups.
5. The method of claim 4, wherein alternately writing data to the first predetermined number of low-numbered data block groups and the second predetermined number of high-numbered data block groups according to a stepwise writing rule from the two-end data block groups to the middle data block group in the partitioned space of the disk comprises:
taking the first preset number of low-number data block groups and the second preset number of high-number data block groups as a writing group;
when writing data into each writing group, writing the data into the low-number data block group, and then writing the data into the high-number data block group;
before each data block group writes data, checking the use mark of the current data block group, and if the use mark is 1, writing the data into the next data block group.
6. The method according to claim 5, wherein after the current data writing is completed, the currently used data block group is marked third;
and when the data is written again, searching the data block group with the third mark, and writing the data to be written from the current data block group with the third mark.
7. The data writing method of claim 1, wherein the dividing the disk partition space into a plurality of data block groups comprises:
acquiring the total storage capacity of the disk partition space;
judging the capacity grade of the disk partition space according to the total storage capacity and a preset capacity grade dividing rule;
and determining the capacity size of each data block group according to the capacity grade.
8. The data writing method according to any one of claims 2 to 7, characterized by further comprising:
and after writing data into each data block group, modifying the mark file according to the use condition.
9. A data writing apparatus, comprising:
the dividing module is used for dividing the disk partition space into a plurality of data block groups; the numbers of the data block groups are gradually increased from the outer ring to the inner ring of the magnetic disk;
and the writing module is used for alternately writing data into the low-number data block group and the high-number data block group according to a preset writing rule when writing data into the magnetic disk.
10. A mechanical hard disk, characterized in that it comprises a processor and a memory, the memory storing a computer program, the processor being adapted to execute the computer program to implement the data writing method according to any of claims 1-8.
11. A readable storage medium, characterized in that it stores a computer program which, when executed on a processor, implements the data writing method according to any of claims 1-8.
CN202410077501.3A 2024-01-19 2024-01-19 Data writing method and device, mechanical hard disk and storage medium Pending CN117591041A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410077501.3A CN117591041A (en) 2024-01-19 2024-01-19 Data writing method and device, mechanical hard disk and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410077501.3A CN117591041A (en) 2024-01-19 2024-01-19 Data writing method and device, mechanical hard disk and storage medium

Publications (1)

Publication Number Publication Date
CN117591041A true CN117591041A (en) 2024-02-23

Family

ID=89920555

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410077501.3A Pending CN117591041A (en) 2024-01-19 2024-01-19 Data writing method and device, mechanical hard disk and storage medium

Country Status (1)

Country Link
CN (1) CN117591041A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1168182A (en) * 1995-11-10 1997-12-17 索尼公司 Information processing apparatus and method
CN1228190A (en) * 1997-04-07 1999-09-08 索尼株式会社 Editing system and editing method
CN102270105A (en) * 2011-08-08 2011-12-07 东软集团股份有限公司 Independent disc array as well as method and system for processing network acquired data
CN109960463A (en) * 2017-12-26 2019-07-02 中兴通讯股份有限公司 A kind of disk management method, device and storage medium
CN115562584A (en) * 2022-10-14 2023-01-03 济南浪潮数据技术有限公司 Disk space allocation method, device and medium of storage system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1168182A (en) * 1995-11-10 1997-12-17 索尼公司 Information processing apparatus and method
CN1228190A (en) * 1997-04-07 1999-09-08 索尼株式会社 Editing system and editing method
CN102270105A (en) * 2011-08-08 2011-12-07 东软集团股份有限公司 Independent disc array as well as method and system for processing network acquired data
CN109960463A (en) * 2017-12-26 2019-07-02 中兴通讯股份有限公司 A kind of disk management method, device and storage medium
CN115562584A (en) * 2022-10-14 2023-01-03 济南浪潮数据技术有限公司 Disk space allocation method, device and medium of storage system

Similar Documents

Publication Publication Date Title
JP2003131954A (en) Dynamically variable-length error correction code
JP2009205254A (en) Computer, dumping program, and dumping method
CN110442473B (en) Nonvolatile data storage method and device, electronic equipment and medium
US20100211835A1 (en) Method for testing a memory device
US11385823B2 (en) Method, electronic device and computer program product for rebuilding disk array
CN103019707A (en) Call stack analyzing and processing method and device
CN108073507A (en) A kind of processing method and processing device of Kernel Panic field data
CN114047887A (en) Method, device and medium for improving success rate of data reading
CN107870739B (en) Disk file storage method and system
CN117591041A (en) Data writing method and device, mechanical hard disk and storage medium
US8984252B2 (en) Extent consolidation and storage group allocation
CN110990207B (en) BPS memory test method, system, terminal and storage medium based on Whitley platform
RU2520430C2 (en) Method and apparatus for loading data
CN113177045A (en) Data extraction method and device, computable storage equipment and data request equipment
CN112506918A (en) Data access method, terminal and computer readable storage medium
CN112331249A (en) Method and device for predicting service life of storage device, terminal equipment and storage medium
US20050246517A1 (en) Method for ensuring optimal memory configuration in a computer
CN115344214A (en) Data reading and writing method, device, server and computer readable storage medium
CN109710445B (en) Memory correction method and electronic equipment
CN111381771B (en) Method for storing data, storage controller and chip
CN113867925A (en) Memory management method, device, equipment and storage medium
CN109947571B (en) Memory release method and system
KR20170037851A (en) Method and device for operating a many-core-system
US20050044331A1 (en) Data management
CN107589917B (en) Distributed storage system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination