Disclosure of Invention
In one aspect, the present invention provides a method for standby power protection of a memory device, wherein the method comprises the following steps:
partitioning the standby power SSD into a non-writable partition and a writable partition;
executing a Trim instruction on a writable partition of the backup SSD when the storage device system is powered on for the first time;
in response to the power failure of the storage equipment system, starting a standby battery to supply power to the storage equipment system, and writing data in the memory into the writable partition;
stopping the power supply of the backup battery in response to completion of writing of the data into the writable partition;
and responding to the power-on of the storage equipment system again, writing the data in the writable partition of the power-on SSD into the HDD, and executing the Trim instruction on the writable partition of the power-on SSD again.
An embodiment of the method of power backup protection of a storage device according to the present invention, wherein partitioning the power backup SSD into the non-writable partition and the writable partition further comprises:
configuring a non-writable partition of a standby SSD as an operating system area;
the writable partition of the power backup SSD is further partitioned into a data area, a spare area, and a reserved area.
According to an embodiment of the method for protecting the storage device from power backup, in which the storage device system is powered on for the first time, executing the Trim instruction on the writable partition of the power backup SSD further includes: and executing the Trim instruction on the data area, the standby area and the reserved area of the power backup SSD.
In an embodiment of the method for power backup protection of a storage device according to the present invention, enabling a backup battery to supply power to the storage device system in response to a power failure of the storage device system, and writing data in the memory to the writable partition further comprises: and sequentially writing the data in the memory into the data area in a large IO mode, and sequentially writing the corresponding logs into the standby area.
In an embodiment of the method for power backup protection of a storage device according to the present invention, enabling a backup battery to supply power to the storage device system in response to a power failure of the storage device system, and writing data in the memory to the writable partition further comprises:
starting a Cache of the backup SSD;
writing the data in the memory into the Cache;
and moving the data in the Cache into the writable partition based on the Flush Cache instruction.
According to an embodiment of the method for power-on protection of the storage device, in response to the storage device system being powered on again, writing data in the writable partition of the power-on SSD to the HDD, and executing the Trim command on the writable partition of the power-on SSD again further includes: and writing the data in the data area and the spare area of the power supply SSD into the HDD, and executing a Trim instruction on the data area, the spare area and the reserved area of the power supply SSD.
In another aspect, the present invention further provides a device for backup protection of a storage device, where the device includes:
at least one processor; and
a memory storing processor-executable program instructions that, when executed by the processor, perform the steps of:
partitioning the standby power SSD into a non-writable partition and a writable partition;
executing a Trim instruction on a writable partition of the backup SSD when the storage device system is powered on for the first time; in response to a power loss to the storage device system, enabling a backup battery to power the storage device system,
writing the data in the memory into the writable partition;
stopping the power supply of the backup battery in response to completion of writing of the data into the writable partition;
and responding to the power-on of the storage equipment system again, writing the data in the writable partition of the power-on SSD into the HDD, and executing the Trim instruction on the writable partition of the power-on SSD again.
An embodiment of the apparatus for power backup protection of a storage device according to the present invention, wherein partitioning the power backup SSD into the non-writable partition and the writable partition further comprises:
configuring a non-writable partition of a standby SSD as an operating system area;
the writable partition of the power backup SSD is further partitioned into a data area, a spare area, and a reserved area.
According to an embodiment of the apparatus for protecting a power backup of a storage device of the present invention, the first powering on of the storage device system, and the executing of the Trim command on the writable partition of the power backup SSD further includes: and executing the Trim instruction on the data area, the standby area and the reserved area of the power backup SSD.
An embodiment of the apparatus for power backup protection of a storage device according to the present invention, wherein enabling a backup battery to supply power to the storage device system in response to a power failure of the storage device system, and writing data in the memory to the writable partition further comprises: and sequentially writing the data in the memory into the data area in a large IO mode, and sequentially writing the corresponding logs into the standby area.
An embodiment of the apparatus for power backup protection of a storage device according to the present invention, wherein enabling a backup battery to supply power to the storage device system in response to a power failure of the storage device system, and writing data in the memory to the writable partition further comprises:
starting a Cache of the backup SSD;
writing the data in the memory into the Cache;
and moving the data in the Cache into the writable partition based on the Flush Cache instruction.
An embodiment of the apparatus for power backup protection of a storage device according to the present invention, wherein in response to the storage device system being powered on again, writing data in the writable partition of the power backup SSD to the HDD, and executing the Trim command on the writable partition of the power backup SSD again further includes: and writing the data in the data area and the spare area of the power supply SSD into the HDD, and executing a Trim instruction on the data area, the spare area and the reserved area of the power supply SSD.
By adopting the technical scheme, the invention at least has the following beneficial effects: partitioning the standby power SSD into a non-writable partition and a writable partition; executing a Trim instruction on a writable partition of the power-on SSD, so that the writable partition is marked as a continuous blank space, namely, an OP (Over-Provisioning) of the SSD is increased under the condition of not influencing data backup, the continuity of writing data is improved, and the stability of the writing speed of the small-capacity SSD is greatly improved; the method has extremely important value in the scene with strict writing speed requirement on standby power. According to the test, the scheme of the invention can integrally improve the standby electric writing performance by at least 30-40%; by improving the writing speed of the standby power supply, the time consumed in the standby power supply protection process is shortened, and the reliability of the standby power supply protection is improved.
The present invention provides aspects of embodiments, which should not be used to limit the scope of the present invention. Other embodiments are contemplated in accordance with the techniques described herein, as will be apparent to one of ordinary skill in the art upon study of the following figures and detailed description, and are intended to be included within the scope of the present application.
Embodiments of the invention are explained and described in more detail below with reference to the drawings, but they should not be construed as limiting the invention.
Detailed Description
While the present invention may be embodied in various forms, there is shown in the drawings and will hereinafter be described some exemplary and non-limiting embodiments, with the understanding that the present disclosure is to be considered an exemplification of the invention and is not intended to limit the invention to the specific embodiments illustrated.
Fig. 1 shows a schematic block diagram of an embodiment of a method of backup protection of a storage device according to the present invention. In the embodiment shown in the figure, the method comprises at least the following steps:
s1: partitioning the standby power SSD into a non-writable partition and a writable partition;
s2: executing a Trim instruction on a writable partition of the backup SSD when the storage device system is powered on for the first time;
s3: in response to the power failure of the storage equipment system, starting a standby battery to supply power to the storage equipment system, and writing data in the memory into the writable partition;
s4: stopping the power supply of the backup battery in response to completion of writing of the data into the writable partition;
s5: and responding to the power-on of the storage equipment system again, writing the data in the writable partition of the power-on SSD into the HDD, and executing the Trim instruction on the writable partition of the power-on SSD again.
In order to improve the reliability and stability of the power backup protection of the storage device, in the embodiment of the present invention, first, in step S1, the power backup SSD is partitioned into the non-writable partition and the writable partition to distinguish the non-writable area and the writable area of the power backup SSD, so that certain measures are taken for the writable partition in the subsequent steps to ensure the reliability and stability of the power backup protection.
Trim is also called Disable Delete Notification. When an original HDD (Hard disk drive) writes data, a system (usually Windows) notifies the Hard disk to erase previous data and then write new data into a disk. When deleting data, the system only marks the data, which indicates that no data exists, and the data is actually deleted until the data is actually written. And after the Windows identifies the SSD and confirms that the SSD supports Trim, the data is deleted without notifying a deletion instruction to the hard disk, and only the Volume Bitmap is used for remembering that the data is deleted. The Volume Bitmap is just a disk snapshot, and the establishing speed is much faster than that of directly reading and writing the hard disk to mark the deleted area. Thus, this step saves a lot of time. When data is written again, because the data saved by the NAND flash memory is in a pure digital form, new data can be written into the deleted block in the snapshot directly according to the condition of the Volume Bitmap, and the original data does not need to be erased in a time-consuming manner.
Therefore, in the case that the storage device system is powered on for the first time, step S2 executes the Trim instruction on the writable partition of the power-standby SSD, and marks the writable partition as a continuous blank space, thereby ensuring that the storage device system completes the data writing operation with the highest efficiency in the first power-standby protection process. Subsequently, once the power of the storage device system is lost due to various reasons, such as a system failure, a mains supply interruption, etc., step S3 will immediately enable the battery backup BBU to supply power to the storage device system, and write the data in the memory into the writable partition of the SSD. After all data is written into the writable partition, the battery backup stops supplying power at step S4. Finally, when the storage device system is powered on again after, for example, troubleshooting or restoration of the commercial power supply, step S5 writes the data in the writable partition of the power backup SSD into the HDD, and executes the Trim command on the writable partition of the power backup SSD again to mark the writable partition as a continuous empty space again, so as to prepare for next power backup protection.
Further embodiments of the present invention will be described below, it being noted that the numbering of the steps mentioned therein is used only for the convenience of unambiguously indicating the step without any particular indication, and does not limit the order of the steps described.
In a further embodiment of the method for power backup protection of a storage device of the present invention, the step S1 of partitioning the power backup SSD into the non-writable partition and the writable partition further comprises: configuring a non-writable partition of a standby SSD as an operating system area; the writable partition of the power backup SSD is further partitioned into a data area, a spare area, and a reserved area. In these embodiments, the non-writable partition and the writable partition of the power-on SSD are further allocated according to the use of the storage space, wherein the non-writable partition is configured as an operating system area os (operating system) in which a necessary operating system is stored, and the part of the content is not modifiable, and therefore, the area cannot be written during the power-on protection. The writable partition of the power-backup SSD is further partitioned into a DATA area (DATA), a spare area and a reserved area, wherein the DATA area is used for temporarily storing DATA, the spare area is used for temporarily storing log and other related information, and the reserved area is kept idle all the time to ensure that the SSD has enough writing speed.
In some embodiments of the method for protecting a power backup of a storage device of the present invention, the step S2 is to power up the storage device system for the first time, and the executing the Trim command on the writable partition of the power backup SSD further includes: and executing the Trim instruction on the data area, the standby area and the reserved area of the power backup SSD. That is, in these embodiments, the Trim command is executed on the data area, the spare area, and the reserved area of the power-backup SSD, so that the data area, the spare area, and the reserved area are all marked as continuous empty spaces, an OP (Over-Provisioning) of the SSD is increased as much as possible, continuity of writing data is improved, and stability of the writing speed of the small-capacity SSD is greatly improved. In some embodiments, the partial partition may even occupy up to about 75% of the entire power-backup SSD, which is sufficient to ensure the continuity of the write data and the stability of the write speed of the power-backup SSD.
In several embodiments of the method for power backup protection of a storage device of the present invention, the step S3, in response to a power failure of the storage device system, enabling the backup battery to supply power to the storage device system, and writing data in the memory into the writable partition further includes: and sequentially writing the data in the memory into the data area in a large IO mode, and sequentially writing the corresponding logs into the standby area. When the storage device system is powered down and data protection is carried out by using the power-standby SSD, the operations to be carried out at least comprise the steps of sequentially writing the data in the memory into the data area of the power-standby SSD in a large IO mode, preferably sequentially writing the data into the data area of the power-standby SSD in a large IO mode larger than 1MB/s, and because the data area is marked as a continuous blank space through the Trim in advance and the two modes of sequential writing and random writing have a large difference in writing speed, the writing speed can be increased as much as possible in the sequential writing mode. And the correspondingly generated logs are sequentially written into a standby area of the standby power SSD, so that the related standby power protection information is recorded while the standby power protection effect is ensured.
In some embodiments of the method for power backup protection of a storage device of the present invention, the step S3, in response to a power failure of the storage device system, enabling a backup battery to supply power to the storage device system, and writing data in the memory to the writable partition further comprises:
s31: starting a Cache of the backup SSD;
s32: writing the data in the memory into the Cache;
s33: and moving the data in the Cache into the writable partition based on the Flush Cache instruction.
Since the Cache of the solid state disk is more advantageous in the read-write speed than the writable partition of the solid state disk, in some embodiments, when the data in the memory is written into the power-backup SSD, the step S31 may first enable (enable) the Cache of the power-backup SSD, and then the step S32 writes the data in the memory into the Cache at a higher rate. However, the Cache may lose data when the power is down, so that step S33 moves the data in the Cache to the writable partition based on the Flush Cache instruction, or moves the data in the Cache of the power-on SSD to the writable partition based on the Flush Cache instruction. By the method, the writing speed during the standby power protection can be further improved, the stability of data protection during the standby power protection can be guaranteed, and the reliability of the standby power protection of the storage device is further enhanced.
In some embodiments of the method for power-on protection of a storage device of the present invention, the step S5, in response to the storage device system being powered on again, writes the data in the writable partition of the power-on SSD to the HDD, and executes the Trim command on the writable partition of the power-on SSD again further includes: and writing the data in the data area and the spare area of the power supply SSD into the HDD, and executing a Trim instruction on the data area, the spare area and the reserved area of the power supply SSD. That is to say, when the storage device system is powered on again after, for example, a failure is eliminated or the mains supply is restored, the data area of the power backup SSD and the contents of the data, the log, and the like temporarily stored in the power backup SSD during power backup protection are further written into the HDD, and the data recovery process after the power backup protection is completed. In addition, because some operations are executed in the data area, the spare area and the reserved area more or less in the power backup protection process, and corresponding traces are left, the Trim instruction is executed again on the data area, the spare area and the reserved area of the power backup SSD, so that the data area, the spare area and the reserved area are marked as continuous blank spaces again, and preparation is made for next power backup protection.
In another aspect, the present invention further provides a device for backup protection of a storage device, where the device includes: at least one processor; and a memory storing processor-executable program instructions that, when executed by the processor, perform the steps of:
s1: partitioning the standby power SSD into a non-writable partition and a writable partition;
s2: executing a Trim instruction on a writable partition of the backup SSD when the storage device system is powered on for the first time;
s3: in response to the power failure of the storage equipment system, starting a standby battery to supply power to the storage equipment system, and writing data in the memory into the writable partition;
s4: stopping the power supply of the backup battery in response to completion of writing of the data into the writable partition;
s5: and responding to the power-on of the storage equipment system again, writing the data in the writable partition of the power-on SSD into the HDD, and executing the Trim instruction on the writable partition of the power-on SSD again.
In a further embodiment of the apparatus for power backup protection of a storage device of the present invention, the step S1 of partitioning the power backup SSD into the non-writable partition and the writable partition further comprises: configuring a non-writable partition of a standby SSD as an operating system area; the writable partition of the power backup SSD is further partitioned into a data area, a spare area, and a reserved area.
In some embodiments of the apparatus for protecting a power backup of a storage device of the present invention, the step S2 is to power up the storage device system for the first time, and the executing the Trim command on the writable partition of the power backup SSD further includes: and executing the Trim instruction on the data area, the standby area and the reserved area of the power backup SSD.
In several embodiments of the apparatus for power backup protection of a storage device of the present invention, the step S3, in response to a power failure of the storage device system, enabling the backup battery to supply power to the storage device system, and writing data in the memory into the writable partition further includes: and sequentially writing the data in the memory into the data area in a large IO mode, and sequentially writing the corresponding logs into the standby area.
In some embodiments of the apparatus for power backup protection of a storage device of the present invention, the step S3, in response to a power failure of the storage device system, enabling a backup battery to supply power to the storage device system, and writing data in the memory to the writable partition further comprises:
s31: starting a Cache of the backup SSD;
s32: writing the data in the memory into the Cache;
s33: and moving the data in the Cache into the writable partition based on the Flush Cache instruction.
In some embodiments of the apparatus for power-on protection of a storage device of the present invention, the step S5, in response to the system of the storage device being powered on again, writes the data in the writable partition of the power-on SSD to the HDD, and executes the Trim command on the writable partition of the power-on SSD again further includes: and writing the data in the data area and the spare area of the power supply SSD into the HDD, and executing a Trim instruction on the data area, the spare area and the reserved area of the power supply SSD.
The devices and apparatuses disclosed in the embodiments of the present invention may be various electronic terminal apparatuses, such as a mobile phone, a Personal Digital Assistant (PDA), a tablet computer (PAD), a smart television, and the like, or may be a large terminal apparatus, such as a server, and therefore the scope of protection disclosed in the embodiments of the present invention should not be limited to a specific type of device and apparatus. The client disclosed in the embodiment of the present invention may be applied to any one of the above electronic terminal devices in the form of electronic hardware, computer software, or a combination of both.
The computer-readable storage media (e.g., memory) described herein may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
By adopting the technical scheme, the invention at least has the following beneficial effects: partitioning the standby power SSD into a non-writable partition and a writable partition; executing a Trim instruction on a writable partition of the power-on SSD, so that the writable partition is marked as a continuous blank space, namely, an OP (Over-Provisioning) of the SSD is increased under the condition of not influencing data backup, the continuity of writing data is improved, and the stability of the writing speed of the small-capacity SSD is greatly improved; the method has extremely important value in the scene with strict writing speed requirement on standby power. According to the test, the scheme of the invention can integrally improve the standby electric writing performance by at least 30-40%; by improving the writing speed of the standby power supply, the time consumed in the standby power supply protection process is shortened, and the reliability of the standby power supply protection is improved.
It is to be understood that the features listed above for the different embodiments may be combined with each other to form further embodiments within the scope of the invention, where technically feasible. Furthermore, the specific examples and embodiments described herein are non-limiting, and various modifications of the structure, steps and sequence set forth above may be made without departing from the scope of the invention.
In this application, the use of the conjunction of the contrary intention is intended to include the conjunction. The use of definite or indefinite articles is not intended to indicate cardinality. In particular, references to "the" object or "an" and "an" object are intended to mean one of many such objects possible. However, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated. Furthermore, the conjunction "or" may be used to convey simultaneous features, rather than mutually exclusive schemes. In other words, the conjunction "or" should be understood to include "and/or". The term "comprising" is inclusive and has the same scope as "comprising".
The above-described embodiments, particularly any "preferred" embodiments, are possible examples of implementations, and are presented merely for a clear understanding of the principles of the invention. Many variations and modifications may be made to the above-described embodiments without departing substantially from the spirit and principles of the technology described herein. All such modifications are intended to be included within the scope of this disclosure.