This application claims the priority benefit of Chinese Patent Application Serial Number 202010536531.8, filed on Jun. 12, 2020, the full disclosure of which is incorporated herein by reference.
The invention relates to a storage device and a low-level formatting method therefor, and more particularly to a flash memory device and a low-level formatting method therefor.
A solid state disk (SSD) is a hard disk made of an array of solid electronic storage chips. The number of program-erase (P/E) cycles of the SSD refers to the number of erasing and writing times of the storage medium (that is, NAND flash) in the SSD, while the terabytes written (TBW) refers to the number of terabytes written in the lifetime of the SSD. Both of the two parameters are indicators for measuring the lifetime of the SSD.
In addition, before the SSD is shipped, the low-level format mode of
Furthermore, if the SSD has been used for a long time, the number of P/E cycles and the TBW of the SSD are accumulated to the considerable values; after the low-level formatting method is performed on the SSD again due to some factors (that is, in the test process of the RDT firmware in
In view of the above, how to inherit the previous information of the number of P/E cycles and the TBW of the SSD to make the user can obtain the true number of P/E cycles and the true TBW of the SSD and avoid data loss after the low-level formatting method is performed again, becomes a problem to be solved.
The present disclosure provides a low-level formatting method for a storage device, the storage device has a plurality of storage blocks, and the low-level formatting method comprises: searching whether an RDT result or firmware storage information is stored in the plurality of storage blocks of the storage device, wherein at least one of the RDT result and the firmware storage information comprise a program-erase cycle (P/E cycle) record and a terabyte written (TBW) record of the storage device; determining whether a number of P/E cycles and a TBW of the storage device are recorded in the P/E cycle record and the TBW record if at least one of the RDT result and the firmware storage information is stored in the plurality of storage blocks of the storage device; setting values of P/E cycles and the TBW of the storage device to zero and then writing the values of the P/E cycles and the TBW of the storage device into one of the plurality of storage blocks of the storage device if the RDT result and the firmware storage information are not stored in the plurality of storage blocks of the storage device; writing values of the recorded number of P/E cycles and the recorded TBW of the storage device into one of the plurality of storage blocks of the storage device if the P/E cycles and the TBW of the storage device are recorded in the P/E cycle record and the TBW record.
The present disclosure also provides a storage device. The storage device comprises a processor and a plurality of storage blocks, wherein the processor executes the low-level formatting method.
According to an embodiment of the present disclosure, the low-level formatting method for the storage device further comprises: setting the values of the P/E cycles and the TBW of the storage device to zero and then writing the values of the P/E cycles and the TBW of the storage device into one of the plurality of storage blocks of the storage device if the P/E cycles and the TBW of the storage device are not recorded in the P/E cycle record and the TBW record.
According to an embodiment of the present disclosure, the low-level formatting method for the storage device further comprises: confirming the validity of the P/E cycle record and the TBW record.
According to an embodiment of the present disclosure, the low-level formatting method for the storage device further comprises: reading one of the plurality of storage blocks of the storage device; obtaining the P/E cycle record and the TBW record from the one of the plurality of storage blocks of the storage device; and integrating the obtained P/E cycle record and the obtained TBW record into the RDT result.
According to an embodiment of the present disclosure, the P/E cycle record and the TBW record of the storage device at different time points are stored in the plurality of storage blocks of the storage device, and the low-level formatting method further comprises: reading one of the plurality of storage blocks of the storage device; obtaining the P/E cycle record and the TBW record of the storage device at the latest time point; and writing the obtained P/E cycle record and the obtained TBW record back to a predetermined storage block of the plurality of storage blocks of the storage device to generate the firmware storage information.
According to an embodiment of the present disclosure, the storage device is a flash memory device.
According to an embodiment of the present disclosure, in the process of obtaining and writing the P/E cycle record and the TBW record, the low-level formatting method further comprises: integrating test results of the plurality of storage blocks, the P/E cycle record, and the TBW record into the RDT result.
According to an embodiment of the present disclosure, in the process of obtaining and writing the P/E cycle record and the TBW record at the latest time point of the storage device, the low-level formatting method for the storage device further comprises: executing a read operation; executing a write operation; and executing a garbage collection operation.
Other advantages of the present disclosure are explained in more detail with the following description and drawings.
It should be understood, however, that this summary may not contain all aspects and embodiments of the present disclosure, that this summary is not meant to be limiting or restrictive in any manner, and that the invention as disclosed herein will be understood by one of ordinary skill in the art to encompass obvious improvements and modifications thereto.
The features of the exemplary embodiments believed to be novel and the elements and/or the steps characteristic of the exemplary embodiments are set forth with particularity in the appended claims. The Figures are for illustration purposes only and are not drawn to scale. The exemplary embodiments, both as to organization and method of operation, may best be understood by reference to the detailed description which follows taken in conjunction with the accompanying drawings in which:
The present disclosure will now be described more fully hereinafter with reference to the accompanying drawings, in which exemplary embodiments of the invention are shown. This present disclosure may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this present disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but function. It will be understood that the terms “comprises,” “comprising,” “includes” and/or “including,” when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Use of ordinal terms such as “first”, “second”, “third”, etc., in the claims to modify a claim element does not by itself connote any priority, precedence, or order of one claim element over another or the temporal order in which acts of a method are performed, but are used merely as labels to distinguish one claim element having a certain name from another element having the same name (but for use of the ordinal term) to distinguish the claim elements.
It will also be understood that when an element is referred to as being “connected” or “coupled” to another element, it can be directly connected or coupled to the other element or intervening elements may be present. In contrast, when an element is referred to as being “directly connected” or “directly coupled” to another element, there are no intervening elements present. Other words used to describe the relationship between elements should be interpreted in a like fashion (e.g., “between” versus “directly between,” “adjacent” versus “directly adjacent.” etc.)
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustration of the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
In the following embodiment, the same reference numerals are used to refer to the same or similar elements throughout the invention.
In step S72, if the RDT result and the firmware storage information are not stored in the storage blocks of the NAND flash of the SSD, it means that the SSD has just been manufactured, the RDT for the SSD has not been performed, and the SSD has not been used. At this time, the process proceeds to step S76, the default values of the P/E Cycles and the TBW of the SSD (each default value is 0) are written into the storage block of the storage device, and then the process ends. It must be noted that after the end of the process in
In step S72, if the RDT result or the firmware storage information already is stored in the storage blocks of the NAND flash, the process proceeds to step S73 to confirm validity of the P/E cycle record and the TBW record. The validity here refers to whether the P/E cycle record and the TBW record can be recognized by the whole system firmware; if not, it means that the version of the whole system firmware is too old and needs to be updated to the version capable of supporting the P/E cycle record and the TBW record. Then, the process proceeds to step S74 to determine whether a number of P/E cycles and a TBW of the storage device are recorded in the P/E cycle record and the TBW record. If the number of P/E cycles and the TBW of the storage device are recorded, the process proceeds to step S75, and the recorded number of P/E cycles and the recorded TBW are written into the storage block of the storage device. If the number of P/E cycles and the TBW of the storage device are not recorded, it means that the SSD has no usage record. Thus, the process proceeds to step S76 to write the default values of the P/E cycles and the TBW of the storage device (each default value is 0) into the storage block of the storage device.
By the low-level formatting method described in the embodiment of the present disclosure, no matter how many times the RDT or the low-level formatting method is performed, the SSD can retain its latest information of the number of P/E cycles and the TBW after the SSD is used. Therefore, the user can know the true lifetime of the SSD, and can back up data and replace the storage device early before the end of the SSD lifetime, to avoid irreversible data loss.
The flowchart executed in
In summary, only some steps (S82 and S83) are added to the conventional process of
Accordingly, the low-level formatting method of the embodiment of the present disclosure can indeed faithfully reflect the number of P/E cycles, the TBW and other information during the entire lifetime of the SSD. In addition to avoiding misjudging the lifetime of the SSD and irreversible data loss, the low-level formatting method of the embodiment of the present disclosure can also be applied to the RMA disk, so that when the returned disk is repaired, the true usage of the SSD can be inquired as a basis for providing product warranty.
In addition, the present disclosure also discloses a storage device. The storage device includes a processor and a plurality of storage blocks, and the processor executes the low-level formatting method.
Some or all of the aforementioned embodiments of the method of the present disclosure may be implemented in a computer program such as an operating system for a computer, a driver for a dedicated hardware of a computer, or a software application program. Other types of programs may also be suitable, as previously explained. Since the implementation of the various embodiments of the present invention into a computer program can be achieved by the skilled person using his routine skills, such an implementation will not be discussed for reasons of brevity. The computer program implementing some or more embodiments of the method of the present disclosure may be stored on a suitable computer-readable data carrier such as a DVD, CD-ROM, USB stick, a hard disk, which may be located in a network server accessible via a network such as the Internet, or any other suitable carrier.
Although the above-described elements are included in the drawings of the present disclosure, it should be noted that additional elements may be included to achieve better performance without departing from the spirit of the invention. Although each flowchart of the present disclosure is executed in a specified order, those skilled in the art can modify the order of these steps under the premise of achieving the same effect without violating the spirit of the invention. Therefore, the present disclosure is not limited to using only the sequence described above. In addition, those skilled in the art may also integrate several steps into one step, or perform more steps serially or in parallel, and the present disclosure is not limited thereto.
While the present disclosure has been described by way of example and in terms of the preferred embodiments, it should be understood that the present disclosure is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation to encompass all such modifications and similar arrangements.
Number | Date | Country | Kind |
---|---|---|---|
202010536531.8 | Jun 2020 | CN | national |