Disclosure of Invention
In order to solve the technical problems that the unused fragmented small-capacity storage cannot be reused, the partition capacity of an operating system is limited, and the space capacity of the partition of the operating system can be increased only by changing a large-capacity hard disk, the invention provides the following technical scheme:
A method for dynamic capacity expansion of operating system partitions, comprising:
s1, searching available storage equipment units in an operating system;
S2, selecting a plurality of storage device units to be combined in storage capacity from the retrieved available storage device units, and endowing combination identification information for each storage device unit to be combined;
S3, according to the combination identification information of the selected storage device units, the selected storage device units to be combined are identified one by one, and the identified storage device units are combined to obtain combined mass storage;
s4, the combined large capacity is stored in an operating system partition.
Further, in step S3, a plurality of storage device units to be combined are selected for identification, where the identification method is to encrypt the combined identification information of each storage device unit, and write the encrypted combined identification information into the location of the storage block 0 of the corresponding storage device unit.
Further, the combined identification information includes a time of joining the mass storage, a location in the mass storage, a host device UUID, a size of a capacity of the current storage device unit joining the mass storage.
Further, the combined identification information of each storage device unit is encrypted, wherein the encryption method is to use the hardware information of the host unit as an encryption KEY, and the combined identification information is used as the content to be encrypted for encryption.
Further, in step S3, the identified storage device units are combined, wherein the combination method uses stored linear combinations.
Further, in step S4, the combined mass storage is superimposed on the operating system partition, and the superimposing method adds the mass storage formed by combining directly in a linear combination manner to the operating system partition.
Further, in step S4, the method of stacking the combined large-capacity storage to the operating system partition, the stacking method adopts a joint file system, the operating system partition is used as a read-only basic data partition, the operating system partition is used as a lower layer, the combined large-capacity storage is used as a readable and writable layer, the large-capacity storage is used as an upper layer, and all files on the operating system partition are mapped to the large-capacity storage one by one.
Compared with the prior art, the invention has the following beneficial effects:
The invention selects a plurality of storage equipment units to be subjected to storage capacity combination operation, performs identification and combination, obtains combined mass storage, and stacks the combined mass storage to an operating system partition. And N small-capacity storage equipment units are subjected to storage space capacity accumulation, and finally a large-capacity storage is synthesized, so that the secondary utilization of the idle fragmented small-capacity storage is realized.
And associating the synthesized large-capacity storage to the operating system partition, dynamically expanding the operating system partition under the condition of not replacing a large-capacity hard disk under the limited capacity of the operating system partition, and increasing the space capacity of the operating system partition.
Detailed Description
The technical solutions of the present invention will be clearly described below with reference to the accompanying drawings, and it is obvious that the described embodiments are not all embodiments of the present invention, and all other embodiments obtained by a person skilled in the art without making any inventive effort are within the scope of protection of the present invention.
Noun interpretation:
Mass storage, namely, one mass storage formed by combining N storage hard disks or U disks. For example, (a 1GU disk) + (an 8G hard disk) into (a 9G mass storage);
The storage device unit is called as a storage device unit, and N storage hard disks or U-disks combined into one large-capacity storage are n=1, 2, 3.
Example 1
As shown in FIG. 1, the present invention provides a method for dynamic capacity expansion of an operating system partition, comprising:
s1, searching available storage equipment units in an operating system;
and searching all the accessed storage device units in the operating system.
S2, selecting a storage device unit to be stored in a large capacity;
Summarizing all available storage device units in the operating system retrieved in the step S1, and then selecting a plurality of storage device units to be subjected to storage capacity combination operation;
The combination identification information is assigned to each selected storage device unit, and the combination identification information of each storage device unit is used as an identification added to a mass storage, which is one mass storage formed by combining N storage device units.
S3, carrying out identification combination on a plurality of storage device units according to the combination identification information of each storage device unit to form a large-capacity storage;
S31, performing identification operation on the storage equipment units selected in the step S2 one by one;
The identification method is that the combined identification information of each storage device unit is encrypted, and the encrypted combined identification information is written into the position of the storage block 0 of the corresponding storage device unit.
The security of the identification information is improved, and the unique device usability of the storage device unit is considered. The combination identification information of each storage device unit is encrypted, and the encryption method is adopted, wherein the hardware information of the host unit is used as an encryption KEY, the combination identification information is used as the content to be encrypted, the final encrypted content is obtained through encryption, and meanwhile, the final encrypted content is written into the position of the storage block 0 of the storage device unit. The encryption KEY mainly takes the unalterable hardware information of the host device, such as a host serial number, a CPU serial number and the like.
By encrypting the combined identification information of the storage device units, the safety of the combined identification information of each storage device unit can be protected, and the later modification behavior is prevented from trying to tamper the combined identification information of the storage device units, so that the combined identification information of the storage device units is invalid and cannot be normally used, and user data loss is caused.
The combined identification information includes the time of joining the mass storage, the location in the mass storage, the host device UUID, the size of the capacity of the current storage device unit joining the mass storage, etc.
The combination identification information comprises 'time of joining the mass storage', and the combination identification information is convenient for later investigation by considering the different time of combining different storage device units.
The combination identification information includes "a location in a mass storage" to ensure correctness of a combination sequence of storage device units, and to assign incremental unique serial numbers (simply referred to as storage device unit serial numbers) to different storage device units, and later adjust an access sequence or an access hardware location of the storage device units anyway, so long as the storage device unit serial numbers are obtained, correct combination and ordered combination can be performed by using the storage device unit serial numbers, and a final correct combination is obtained.
The combined identification information includes a 'host device UUID', which is used for considering whether the current storage device unit is effective for the current host device or not in the combining process, so as to avoid damage and loss of user data caused by different host devices connected to other combined storage device units of the host device, wherein the UUID (Universally Unique Identifier, universal unique identification code) is a 128-bit identifier, and is commonly used for identifying hardware, an operating system or a virtualized instance in the host device, so that the uniqueness in the global scope is ensured.
The combined identification information includes "the capacity of the current storage device unit added into the mass storage", which is aimed at a single storage device unit, and a user may want to not only reserve the data before the user, but also perform mass storage and combination on a part of the free storage space, and at this time, the use size of the mass storage space of the storage device unit needs to be identified, so as to promote the versatility of the storage device unit. If the later user wants to use the storage with the multiple uses for the mass storage, only the mass size information of the current storage device unit added into the mass storage needs to be updated.
S32, combining the storage equipment units subjected to the identification operation in the step S31 into a large-capacity storage;
the combination method mainly adopts stored linear combination. The stored linear combination means that after the single storage device unit space is used fully, the next storage device unit space is used, so that the effective utilization of the single unit space is improved, and meanwhile, if damage of a certain storage device unit occurs later, the loss of user data is reduced.
S4, storing the combined large capacity in an operating system partition;
The stacking method adopts the same storage device unit combination method as in the step S3, and adds the combined mass storage to the operating system partition directly in a linear combination mode.
According to the method, the storage space utilization rate of the operating system partition can be improved as much as possible, but in the using process of the later operating system, if the problem occurs that the operating system cannot be used normally, the operating system needs to be reinstalled and installed.
Through the operation, the dynamic capacity expansion operation of the operating system partition can be completed.
Example 2
On the basis of embodiment 1, unlike the embodiment, in this embodiment, the superposition method adopts a joint file system, the operating system partition is used as a read-only basic data partition (called a lower layer), the combined mass storage is used as a readable and writable layer, and all files on the operating system partition are mapped into the mass storage one by one (called an upper layer). After the mapping is completed, the operation of the lower layer files is realized by operating the upper layer files, including file reading, file adding, file modifying and file deleting.
Reading files, namely directly reading corresponding files in the upper layer if files with the same name exist in the same path directory in the upper layer, and reading files mapped to the upper layer by the lower layer if files with the same name do not exist in the same path directory in the upper layer;
the file is added and completed in the upper layer;
copying the lower layer file to the upper layer (called copy), and then modifying the upper layer file copy;
and deleting the files, namely deleting the files of the upper layer if the files of the same name exist in the same path directory in the upper layer, and hiding the corresponding files in the lower layer and making the files invisible to the user if the files of the same name exist in the same path directory in the lower layer.
The above operations are all completed in the mass storage, and the lower operating system partition data can be understood as shadow data, which are read-only data. When data is often damaged, if the data is suddenly abnormally interrupted and is not completely written or updated, the data is lost and damaged, and particularly the operating system partitions, the operating system cannot be used normally easily.
By adopting the combined file system, the partition of the operating system is used as a read-only partition, and all operations on the file system only occur in the upper-layer mass storage, so that the possibility of damaging the partition of the operating system can be reduced as much as possible, and the stability and reliability of the partition of the operating system are greatly improved.
In the method, if the problem occurs and the operation system cannot be normally used in the later operation system, the operation system can be restored to the state when being installed only by emptying the data in the combined mass storage, and the operation system cannot be reinstalled and installed any more.
Through the operation, the dynamic capacity expansion operation of the operating system partition can be completed.
The technical characteristics form the optimal embodiment of the invention, have stronger adaptability and optimal implementation effect, and can increase or decrease unnecessary technical characteristics according to actual needs so as to meet the needs of different situations.
Finally, it should be noted that the above description is only for illustrating the technical solution of the present invention, and not for limiting the scope of the present invention, and that the simple modification and equivalent substitution of the technical solution of the present invention can be made by those skilled in the art without departing from the spirit and scope of the technical solution of the present invention.