1. Field of Invention
The present invention relates to a storage technology, and more particularly to a system of creating a logical volume and a method thereof.
2. Related Art
In order to ensure the safety of user data with high efficiency and order, various storage technologies have been proposed till now, such as redundant array of disks (RAID) and logical volume manager (LVM). The LVM has the characteristic of creating a device snapshot, and the snapshot may instantly back up the data in the logical volume of the LVM at a specific time point and has little influence on the efficiency of image data service. Currently, the LVM of the conventional art proposes a snapshot dependent technology, i.e., an old snapshot exists depending on a newly created snapshot, and the data of a volume group amended by a user is only backed up in the snapshot that is created latest, thereby efficiently avoiding the waste of the space of a storage medium and significantly lightening the load of reading and writing the storage medium, such as a disk.
However, in the snapshot dependent technology, since an old snapshot always exists depending on a newly created snapshot, the deletion of a snapshot is limited to some extent. In other words, only the oldest snapshot is allowed to be deleted; otherwise, all the snapshots created before the deleted snapshot will be damaged.
As shown in
The method of the conventional art still has many problems as follows. 1. The process logic is quite complicated, and especially when there are a lot of requests for reading and writing data, it will take long time to create snapshots. 2. Each snapshot occupies an independent disk space, and therefore, when one logical volume stores a plurality of snapshots, only the last snapshot may back up data, and the others do not allow data to be written on the disk. Therefore, although disk spaces have been allocated for these snapshots as created, the disk spaces are full used, thereby wasting the space. 3. In the current LVM architecture, the snapshot must be created by a user manually at a specific time point, and when the data is to be restored, the time points that can be selected by the user are limited and not suitable for consecutive and efficient user data protection. 4. Since the copy-on-write information of the snapshot occupies a lot of memory, the total number of the snapshots that can be created in a system is limited by the LVM architecture of the conventional art, so as to ensure the stability and availability of the system. 5. In the LVM architecture of the conventional art, it is difficult to ensure that the snapshot data in the same logical volume may be continuously stored on a logical storage device, thereby making it troublesome to back up snapshot data based on a block device layer.
In order to solve the aforementioned problems and defects in the conventional art, the present invention is directed to provide a system of creating a logical volume and a method thereof, so as to solve the problems in the conventional art such as the creation steps are complicated, the space for a disk is wasted, and the number of the snapshots to be created is limited.
The system of creating a logical volume provided by the present invention includes an allocation module, a timestamp creating module, a timestamp storage module, and a pointer module. Herein, the allocation module allocates an available logical volume space and a timestamp storage area in a logical volume according to a space allocation algorithm. The timestamp creating module backs up original data of the logical volume, so that a first timestamp is created when data is input to or output from the logical volume for the first time and according to one or more time points of amending the original data of the logical volume, sequentially perform copy-on-write operation on the amended data in the logical volume at corresponding time points, so as to create timestamps corresponding to the amendment time points. The timestamp storage module continuously stores the first timestamp and the timestamps of the corresponding amendment time points in the timestamp storage area. The pointer module creates a storage medium offset address pointer for recording writing positions of the copy-on-write operation at the corresponding amendment time points, so as to serve as index information of addresses of the timestamps. The pointer points to an initial address of the timestamp storage area before the first timestamp is created, and sequentially moves backward with the creation of the timestamps of the amendment time points.
The method of creating a logical volume provided by the present invention includes: allocating an available logical volume space and a timestamp storage area in the logical volume according to a space allocation algorithm; backing up original data of the logical volume when data is input to or output from the logical volume for the first time, so as to create a first timestamp; according to one or more time points of amending the original data of the logical volume, sequentially performing copy-on-write operation on the amended data of the logical volume at the amendment time points, so as to create timestamps corresponding to the amendment time points; continuously storing the first timestamp and the timestamps of the corresponding amendment time points in the timestamp storage area; creating a storage medium offset address pointer for recording writing positions of the copy-on-write operation at the corresponding amendment time points; and storing the pointer in a storage medium, so as to serve as index information of addresses of the timestamps. The pointer points to the initial address of the timestamp storage area before the first timestamp is created, and sequentially moves backward with the creation of the timestamps of the amendment time points.
In an embodiment of the present invention, a logic storage space is additionally allocated when the logical volume is created, so as to continuously store the backup data of amendments at the specific time points in the logical volume, i.e., the timestamps. The index information of the address of each timestamp is created according to the storage medium offset address pointer for recording the writing position of the current copy-on-write operation, thereby obtaining the backup of the amended data in the logical volume at the corresponding time points using the pointer. Therefore, the present invention significantly simplifies the steps of creating the timestamps and avoids the process of reading the storage medium and allocating spaces when the storage medium receives many input/output requests, thereby efficiently solving the problem that the process of creating a snapshot is time-consuming when many requests of reading and writing data are sent.
Furthermore, since the creation of the timestamps consumes less, a timestamp may be added separately for each copy-on-write operation upon user's requirements, i.e., create a separate snapshot for each writing request. Therefore, the user is allowed to fully protect the data at any time point. Since the corresponding copy-on-write data is recorded at each time of writing operation, in the present invention, redundant copy-on-write data is transferred between the memory and the storage medium, thereby controlling the total space in the memory occupied by the copy-on-write data and solving the problem that the total number of the snapshots to be created is limited.
Finally, in the present invention, the timestamps of the same logical volume are all in a storage area, so as to simplify the process logic of backing up and restoring data, so that not only maintenance becomes convenient, but also such a mechanism of continuously storing backup data reduces the waste of the storage medium space to some extent.
Further scope of applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description.
The present invention will become more fully understood from the detailed description given herein below for illustration only, and thus are not limitative of the present invention, and wherein:
The features and practices of preferred embodiments of the present invention will be illustrated below in detail with reference to the drawings.
Referring to
The timestamp creating module 14 is used to create data backup of the logical volume at a certain time point, which is referred to as a timestamp. For example, the original data of the logical volume is backed up when data is input to or output from the logical volume for the first time, so as to create a first timestamp, and for example, according to the time points of amending the original data of the logical volume, copy-on-write is sequentially performed on the data in the logical volume data which is amended at this time point, so as to create a timestamp corresponding to the amendment time point. The timestamp visually shows the data in the logical volume at a specific time point. The timestamp storage module 18 continuously stores the first timestamp and the timestamps of the corresponding amendment time points in the timestamp storage area. For example, when the original data in the logical volume is amended by the user, amended chunk data of the logical volume is sequentially backed up in the timestamp storage area, that is, the copy-on-write operation merely is performed to back up the amended chunk data in the timestamp storage area. At this point, all the timestamps in the same logical volume are continuously stored in the timestamp storage area.
The pointer module 16 creates a storage medium offset address pointer for recording one or more writing positions of the copy-on-write operation at the corresponding amendment time points, so as to serve as index information of address of each timestamp. The pointer points to an initial address of the allocation space of the timestamp storage area before the first timestamp is created, and sequentially moves backward with the amendment time points and the creation of the timestamps for backing up data. Therefore, each time when the timestamp is created, the pointer module 16 stores the copy-on-write pointer in the storage medium as the index information of address of each timestamp, and furthermore, the data following the address is the backup of the amended data in the logical volume after this time point.
Referring to
As shown in
Step 208 is about the space allocation when creating the logical volume, i.e., the logical volume or the snapshot is allocated with an available space and a timestamp storage area with a requested size according to the usage situation of the current physical blocks and the space allocation algorithm (Step 208). Compared with the step of creating the logical volume in the conventional art shown in
When creating the timestamp, the storage medium offset address pointer is created accordingly, so as to record the writing position[s] of the copy-on-write operations corresponding to the amendment time points of the timestamps (Step 310). The pointer points to the initial address of the allocation space of the timestamp storage area before the first timestamp is created, and sequentially moves backward with the amendment time points and the creation of the timestamps for backing up data (Step 312). Therefore, each time when the timestamp is created, the copy-on-write pointer is stored in the storage medium as the index information of the timestamp address (Step 314), and furthermore, the data following the address is the backup of the amended data in the logical volume after this time point.
Since the timestamp created previously always exists depending on the timestamp created later, only the oldest timestamp in the logical volume is allowed to be deleted. The operation flow is as follows. The address pointer of the oldest timestamp stored in the storage medium is cleaned up, and the initial address of the timestamp storage area is amended to be the timestamp adjacent to the oldest timestamp, i.e., the address of the second oldest timestamp.
Therefore, the present invention significantly simplifies the steps of creating the timestamps and avoids the process of reading the storage medium and allocating spaces when the storage medium receives many input/output requests, thereby efficiently solving the problem that the process of creating a snapshot is time-consuming when many requests of reading and writing data are sent.
Furthermore, in the present invention, since the creation of the timestamps consumes less, a timestamp may be added separately for each copy-on-write operation upon user's requirements, i.e., create a separate snapshot for each writing request. Therefore, the user is allowed to fully protect the data at any time point. Since the corresponding copy-on-write data is recorded at each time of writing operation, in the present invention, redundant copy-on-write data is transferred between the memory and the storage medium, thereby controlling the total space in the memory occupied by the copy-on-write data and solving the problem that the total number of the snapshots to be created is limited.
The invention being thus described, it will be obvious that the same may be varied in many ways. Such variations are not to be regarded as a departure from the spirit and scope of the invention, and all such modifications as would be obvious to one skilled in the art are intended to be included within the scope of the following claims.