WO2015101083A1 - 一种存储数据的保护方法及装置 - Google Patents

一种存储数据的保护方法及装置 Download PDF

Info

Publication number
WO2015101083A1
WO2015101083A1 PCT/CN2014/088940 CN2014088940W WO2015101083A1 WO 2015101083 A1 WO2015101083 A1 WO 2015101083A1 CN 2014088940 W CN2014088940 W CN 2014088940W WO 2015101083 A1 WO2015101083 A1 WO 2015101083A1
Authority
WO
WIPO (PCT)
Prior art keywords
snapshot
file
read
row read
attribute
Prior art date
Application number
PCT/CN2014/088940
Other languages
English (en)
French (fr)
Inventor
庞洪福
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015101083A1 publication Critical patent/WO2015101083A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/128Details of file system snapshots on the file-level, e.g. snapshot creation, administration, deletion

Definitions

  • the present invention relates to the field of network connection storage, and in particular, to a method and an apparatus for protecting stored data.
  • a ROW read-only snapshot using ROW (Redirect-on-write) technology is implemented for FS (File System) to implement storage data protection.
  • Mainstream technology The ROW read-only snapshot of FS directly protects the pre-write data block of the FS, that is, the ROW read-only snapshot will occupy the available space allocated to the FS.
  • the technology for creating ROW read-only snapshots for FS is for the FS as a whole. When the FS is frequently modified, the ROW read-only snapshot will occupy a large amount of space in the FS.
  • a total free space of 100MB FS write a 17.94MB file 1, create a ROW read-only snapshot, and then overwrite the previous file 1, so repeated 4 times, ROW read-only snapshot cumulative exclusive space will reach 53.89 MB, while the available space of the original FS dropped to 28.1MB.
  • a method for storing data is needed to solve the defect that the ROW read-only snapshot occupies too much space in the source file system.
  • Method 1 Configuring FS ROW read-only snapshot reservation, but the ROW read-only snapshot space can exceed this reservation; Method 2, configuring FS automatically Capacity expansion; Method 3: Configure FS to automatically delete ROW read-only snapshots.
  • the ROW read-only snapshot occupies a large amount of FS free space, which makes the FS unavailable. It directly affects the important services of the FS located on the critical path.
  • the measures against the above problems cannot fundamentally solve the problem that the ROW read-only snapshot occupies a large amount of FS available space.
  • the invention provides a method and a device for protecting stored data, and the technical solution is as follows.
  • a method for protecting stored data comprising: receiving an attribute setting instruction requesting setting a file snapshot level attribute of a file in a file system; setting the file according to the attribute setting instruction a file snapshot level attribute; receiving a snapshot creation instruction, where the snapshot creation instruction carries a file snapshot level attribute parameter of the file to be protected; and creating a ROW read-only snapshot for the file system according to the snapshot creation instruction, the ROW read-only
  • the read-only snapshot level attribute of the snapshot is set according to the file snapshot level attribute parameter; when the specified file is modified, it is determined whether the file snapshot level attribute of the specified file and the read-only snapshot level attribute of the created ROW read-only snapshot are Matching, and performing pre-write protection on the specified file according to the created ROW read-only snapshot when matching.
  • creating a read-only snapshot for the file system according to the snapshot creation instruction including: creating the root by sharing a root with the file system ROW read-only snapshot; setting a read-only snapshot level attribute of the ROW read-only snapshot according to the file snapshot level attribute; setting a system snapshot level attribute of the file system according to the read-only snapshot level attribute.
  • the system snapshot level attribute includes a snapshot level-logical time point pair set, where The snapshot level represents a snapshot level of a file protected by the ROW read-only snapshot, the logical time point represents a logical point in time at which the ROW read-only snapshot is created; the read-only snapshot level attribute includes a snapshot level-logical point-in-time pair A collection of snapshot levels representing a snapshot level of a file to be protected, the logical point in time representing a logical point in time at which the ROW read-only snapshot was created.
  • the snapshot creation instruction further carries a snapshot name; after the creating a read-only snapshot for the file system according to the snapshot creation instruction, : Name the ROW read-only snapshot according to the snapshot name.
  • the method further includes: receiving The request to access the ROW read-only snapshot; the value of the output file snapshot level attribute is equal to the value of the snapshot level of the read-only snapshot level attribute of the ROW read-only snapshot.
  • the determining, when the specified file is modified, determining a file snapshot level attribute of the specified file Whether the read-only snapshot level attribute of the ROW read-only snapshot matches, and performs pre-write protection on the specified file according to the created ROW read-only snapshot when matching including: receiving the Determining the modified data of the file; modifying the data of the specified file according to the modified data, and saving the modified new data of the specified file to a new disk location; determining a read-only snapshot of the file system that has been created Whether there is a read-only snapshot whose value of the snapshot level of the read-only snapshot level attribute is equal to the value of the file snapshot level attribute of the specified file; if present, retains the old data before the specified file modification, and The root of the ROW read-only snapshot points to the old data of the specified file; otherwise, the old data before the specified file modification is deleted.
  • a second aspect provides a protection device for storing data, the device comprising: a receiving unit, configured to receive an attribute setting instruction, requesting to set a file snapshot level attribute of a file in a file system, and Receiving a snapshot creation instruction, where the snapshot creation instruction carries a file snapshot level attribute parameter of the file to be protected; and a setting unit, configured to set a file snapshot level attribute of the file according to the attribute setting instruction received by the receiving unit; a unit, configured to create a read-only snapshot for the file system according to the snapshot creation instruction received by the receiving unit, and set a read-only snapshot level attribute of the ROW read-only snapshot according to the file snapshot level attribute parameter; a file protection unit, And determining, when modifying the specified file, whether the file snapshot level attribute of the specified file matches the read-only snapshot level attribute of the created ROW read-only snapshot, and is read-only according to the created ROW when matching The snapshot protects the specified file before writing.
  • the snapshot creation unit includes: a creation module, configured to create the ROW read-only snapshot by sharing a root with the file system; a module, configured to: after the creating module creates the ROW read-only snapshot, set a read-only snapshot level attribute of the ROW read-only snapshot according to the file snapshot level attribute, and set according to the read-only snapshot level attribute The system snapshot level attribute of the file system.
  • the recording module is further configured to record the system snapshot level attribute to include a snapshot level-logical time a set of point pairs, wherein the snapshot level represents a snapshot level of a file protected by the ROW read-only snapshot, the logical time point represents a logical point in time at which the ROW read-only snapshot is created; the read-only snapshot level attribute is Recorded as a set comprising snapshot level - logical point-in-time pairs, wherein the snapshot level represents a snapshot level of a file to be protected, the logical time point representing a logical point in time at which the ROW read-only snapshot was created.
  • the receiving unit is further configured to receive a snapshot creation instruction that carries a snapshot name, where the creating module is further configured to perform the The snapshot name carried in the snapshot creation instruction received by the receiving unit names the ROW read-only snapshot.
  • the receiving unit is further configured to: after the snapshot creation unit creates the ROW read-only snapshot, Receiving a request for the user to access the ROW read-only snapshot; the device further includes: an output unit, configured to output a value of a file snapshot level attribute and a read-only read of the ROW read-only snapshot according to the request received by the receiving unit A file with equal values at the snapshot level in the snapshot level attribute.
  • the receiving unit is further used Receiving the modified data of the specified file in the file system; the device further comprising: a modifying module, configured to modify data of the specified file according to the modified data received by the receiving unit, and modify the modified specified file The new data is saved to a new disk location; the determining module is configured to determine, after the modifying module saves the modified new data of the specified file to a new disk location, a read-only snapshot of the created file system Whether there is a read-only snapshot in which the value of the snapshot level of the read-only snapshot level attribute is equal to the value of the file snapshot level attribute of the specified file; the root module is configured to determine, at the determining module, the attribute of the read-only snapshot level and When the file snapshot level attribute of the specified file matches the ROW read-only snapshot, the root of the ROW read-only snapshot is pointed to the old data of the specified file; When the read-
  • the technical solution provided by the embodiment of the present invention can set the file snapshot level attribute of the file by setting the file snapshot level attribute of the file, and can set different files to different snapshot levels, and when creating a ROW read-only snapshot for the system file. Specifies the snapshot level of the file to be protected by the ROW read-only snapshot.
  • the ROW read-only snapshot protects only the important files that need to be protected. This can effectively reduce the occupation of the FS space by the ROW read-only snapshot.
  • FIG. 1 is a flowchart of a method for protecting stored data according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for protecting stored data according to Embodiment 2 of the present invention
  • FIG. 3 is a schematic diagram of a snapshot level attribute of a file of fs1 according to Embodiment 2 of the present invention.
  • FIG. 4 is a schematic diagram of creating a ROW read-only snapshot of a specified snapshot level for fs1 according to Embodiment 2 of the present invention
  • FIG. 5 is a schematic diagram of modifying file1 not protected by a snapshot in Embodiment 2 of the present invention.
  • FIG. 6 is a schematic diagram of modifying file2 protected by a snapshot in Embodiment 2 of the present invention.
  • FIG. 7 is a flowchart of a method for protecting stored data according to Embodiment 3 of the present invention.
  • FIG. 8 is a schematic diagram of creating multiple read-only snapshots in Embodiment 3 of the present invention.
  • FIG. 9 is a schematic structural diagram of a device for protecting data stored according to Embodiment 4 of the present invention.
  • FIG. 10 is a schematic structural diagram of a device for protecting data stored according to Embodiment 5 of the present invention.
  • the inventor of the present invention found that in the research process of reducing the excessive space occupied by the read-only snapshot, it is found that not all files in the FS are worth protecting with the read-only snapshot, so if the read-only snapshot of the FS is controlled selectively
  • the important files in the FS can solve the problem that the read-only snapshot occupies a large amount of FS available space, and the FS service on the critical path is made available as much as possible.
  • the present invention adds an attribute to all files (including directories) of the FS: a file snapshot level attribute, which can also be set by the user; add one for the instruction to create an FS read-only snapshot.
  • File snapshot level attribute parameter The created FS read-only snapshot will only protect the file in the FS that has the file snapshot level attribute matching the file snapshot level attribute parameter, that is, the value of the file snapshot level attribute and the file snapshot.
  • the value of the level attribute parameter is the same; the system snapshot level attribute is added for FS; the read-only snapshot level attribute is added for the read-only snapshot.
  • This embodiment provides a method for protecting stored data.
  • the method process includes:
  • the pre-write protection refers to mapping or retaining data before the modification of the specified file.
  • the creating a read-only snapshot for the file system according to the snapshot creation instruction includes:
  • the system snapshot level attribute of the file system is set according to the read-only snapshot level attribute.
  • the root of the file system or read-only snapshot is a disk address, through which all directories and file data of the file system or ROW read-only snapshot can be accessed; since the file system or the read-only snapshot directory and file are Abstract into Objects (objects), all of these Objects make up the Objset (object set) of the file system or read-only snapshot, Objset is organized in the form of a tree, and the tree has an Objset Root address, through which the Objset Root can Access to all Objects of the file system / read-only snapshot, so the file system or read-only snapshot root is also called Objset Root.
  • Creating the ROW read-only snapshot by sharing the root with the file system means that when the ROW read-only snapshot is created, the root of the ROW read-only snapshot is pointed to the root of the file system.
  • the ROW read-only snapshot directly protects the pre-write data of the FS (that is, the data before the modification) because the file in the file system has not been modified. Therefore, the root of the ROW read-only snapshot is pointed at this time. The root of the file system.
  • system snapshot level attribute and the read-only snapshot level attribute include a set of [snap level-logical point of time] pairs, wherein the snapshot level represents a snapshot level of a file protected by the ROW read-only snapshot, logic The point in time represents the logical point in time at which the ROW read-only snapshot was created;
  • the read-only snapshot level attribute includes a set of [snap level-logical point-in-time] pairs, wherein the snapshot level represents a snapshot level of a file to be protected, and the logical time point represents a logical time at which the ROW read-only snapshot is created point.
  • the snapshot creation instruction further carries a snapshot name
  • the method further includes:
  • the method further includes:
  • the method for protecting stored data can be set to a different snapshot level by adding a file snapshot level attribute of the file, and setting a different file to a different snapshot level.
  • Snapshot specifies the snapshot level of the file to be protected by the ROW read-only snapshot, so that the ROW read-only snapshot only protects important files that need to be protected, and allows the user to participate in the control of the ROW read-only snapshot, which is determined by the user according to the application scenario.
  • This embodiment provides a method for protecting stored data.
  • the method is described by taking a ROW read-only snapshot as an example. Referring to Figure 2, the method flow includes:
  • file 1 (file1) and file2 in fs1 have file snapshot level attributes: sanpLevel.
  • sanpLevel The snapshot level of the file. The default is not set (none).
  • the setting of the file snapshot level attribute of file2 is completed. After the snapshot level attribute of the fs1 file, see Figure 3.
  • the file system fs1 has four properties related to the ROW read-only snapshot:
  • prevSnap Previous snapshot: a ROW read-only snapshot pointing to the FS;
  • nextSnap the next ROW read-only snapshot to the FS
  • snapLevels system snapshot level contains a [key-value] pair, that is, a [snapshot level-logical point-in-time] pair of collections, the key is the snapshot level of the file to be protected by the read-only snapshot, and the value is the logical point in time at which the read-only snapshot is created. The default is [none] when a ROW read-only snapshot is not created.
  • FS Root The root of all file data pointing to fs1.
  • the snapshot creation instruction can adopt the following format:
  • Snapshot create indicates that a snapshot is created
  • Fs1 indicates that a snapshot is created for the file system fs1.
  • Snap1 indicates that the name of the snapshot is snap1;
  • snapLevel 1: Indicates that only files with level 1 set in the file system are created, that is, only files with a file snapshot level attribute value of 1 are protected.
  • this step creates a ROW read-only snapshot named snap1 and makes the snapshot share the root of the file system.
  • the snap-level of fs1 sets a key-value pair: "1-10", which means that the file system fs1 creates a file with only the protected file snapshot level attribute value of 1 when the logical time point is 10 (that is, it creates a snapshot).
  • the snap-level of snap1 sets a key-value pair: "1-10", which means that the logical time point for creating the snap1 is 10, which only protects files with a file snapshot level attribute value of 1 before the logical time point 10.
  • the prevSnap of fs1 points to the snapshot snap1; the nextSnap of sanp1 points to fs1;
  • the root of the Snap Root snapshot of sanp1 directly shares the root of the file system fs1: FS Root.
  • the file that does not match the snapLevels of sanp1 is filtered out, and the file that matches the snapshot level of the ROW read-only snapshot is output, that is, the ROW read-only snapshot is only output.
  • the value of snapLevel is the same as the value of the snapshot level key of its snapLevels.
  • the snapLevel of the snap1 matches the snapLevel of the file1, and the value of the snapLevel is equal to the value of the key of the snapLevels. If they are equal, the two are matched, otherwise the two do not match. In this embodiment, the snapLevel value of file1 is none, and the key value of snapLevels of snap1 is 1, and the two do not match.
  • the schematic diagram of file1 that is not protected by the snapshot is modified.
  • the “X” in the figure indicates that the data is deleted.
  • the new data and file2 data, and the root of snap1 points to the data of file2.
  • the old data of file1 is deleted, and the available space of the file system fs1 is no longer occupied, thereby reducing the occupation of the free space of the source FS by the ROW read-only snapshot.
  • the execution body of this embodiment may be a storage management system.
  • the method for protecting stored data adds a file snapshot level attribute to a file in the file system, and the user sets the file snapshot level attribute to set different files into Different snapshot levels.
  • users can specify the snapshot level of the file to be protected when creating a ROW read-only snapshot of the system file.
  • the ROW read-only snapshot matching the level attribute determines whether the file is snapshot protected. If it exists, the old data before the file modification is retained. Otherwise, the old data before the file modification is deleted, so that the user participates in the control of the ROW read-only snapshot.
  • the user determines which files of the FS to create snapshots, controls the space used for the snapshots as much as possible, reduces the space occupied by the read-only snapshots, and makes the FS located in the critical path as available as possible, improving the competitiveness of the product. .
  • the method flow includes:
  • Receive a snapshot creation instruction that is input by the user and that has a snapLevel 2, and the snapshot creation instruction requires to create a snapshot with a snapshot level of 2 and a name of sanp2.
  • the system snapshot level attribute snapLevels of fs1 is recorded as: [1-10, 2-20], indicating that a snapshot level is created when the logical time point is 10.
  • a Row read-only snapshot of 1 creates a Row read-only snapshot with a snapshot level of 2 at a logical time point of 20; the read-only snapshot level attribute snaLevels of snap1 is recorded as: [1-10], indicating the read-only snapshot. Only the file with snapshot level 1 is protected, which protects the data before logical time point 10; the read-only snapshot level attribute of snap2 is recorded as: [2-20], indicating that only the protected snapshot level of the read-only snapshot is 2.
  • File that protects data before logical time point 20. Sanp1, sanp2 and fs1 share the root. However, the files file1 and file6 of the file system fs1 will not be protected by any ROW read-only snapshots because their file snapshot level is none.
  • the storage data protection method provided in this embodiment adds a file snapshot level attribute to a file in the file system, and the user sets the file snapshot level attribute to set different files to different snapshot levels, and the user can When creating a read-only snapshot of a system file, specify the snapshot level of the file to be protected. Therefore, when modifying the file system file, the ROW read-only snapshot protects only the file specified by the user, and the unspecified file will not be ROW-ready. Snapshot protection can effectively save space in the file system.
  • the embodiment provides a protection device for storing data, and the device includes:
  • the receiving unit 901 is configured to: an attribute setting instruction, where the attribute setting instruction requests setting a file snapshot level attribute of a file in the file system;
  • the setting unit 902 is configured to set a file snapshot level attribute of the file according to an attribute setting instruction received by the receiving unit 901;
  • the receiving unit 901 is further configured to receive a snapshot creation instruction, where the snapshot creation instruction carries a file snapshot level attribute parameter of the file to be protected;
  • the snapshot creation unit 903 is configured to create a ROW read-only snapshot of the specified snapshot level for the file system according to the snapshot creation instruction received by the receiving unit 901, and set the ROW read-only snapshot according to the file snapshot level attribute parameter. Read the snapshot level attribute;
  • the file protection unit 904 is configured to determine, when the specified file is modified, whether the file snapshot level attribute of the specified file matches the read-only snapshot level attribute of the created ROW read-only snapshot, and according to the The created ROW read-only snapshot protects the specified file before writing.
  • snapshot creation unit 903 includes:
  • Creating a module configured to create the ROW read-only snapshot by sharing a root with the file system
  • a setting module configured to: after the creating module creates the ROW read-only snapshot, set a read-only snapshot level attribute of the ROW read-only snapshot according to the file snapshot level attribute, and set according to the read-only snapshot level attribute The system snapshot level attribute of the file system.
  • the recording module is further configured to record the system snapshot level attribute as a set including a [snapshot level-logical time point] pair, wherein the snapshot level represents the created file protected by the ROW read-only snapshot Snapshot level of the snapshot level, the logical point in time represents the logical point in time at which the ROW read-only snapshot was created; the read-only snapshot level attribute is recorded as a set including a [snapshot level - logical point in time] pair, wherein the snapshot The level represents the snapshot level of the file to be protected, which represents the logical point in time at which the ROW read-only snapshot was created.
  • the receiving unit 901 is further configured to receive a snapshot creation instruction that carries a snapshot name
  • the creating module is further configured to name the ROW read-only snapshot according to the snapshot name carried in the snapshot creation instruction received by the receiving unit 901.
  • the receiving unit 901 is further configured to: after the snapshot creation unit creates the ROW read-only snapshot, receive a request to access the ROW read-only snapshot;
  • the device also includes:
  • An output unit configured to output a file snapshot level attribute having a value equal to a value of a snapshot level in a read-only snapshot level attribute of the ROW read-only snapshot.
  • the receiving unit 901 is further configured to receive modification data of the specified file in the file system
  • the device also includes:
  • a modifying module configured to modify data of the specified file according to the modified data received by the receiving unit 901, and save the modified new data of the specified file to a new disk location;
  • a judging module configured to determine, after the modifying module saves the modified new data of the specified file to a new disk location, whether there is a read-only snapshot level in the ROW read-only snapshot of the file system that has been created A ROW read-only snapshot of the value of the snapshot level of the attribute equal to the value of the file snapshot level attribute of the specified file;
  • a root module configured to point the root of the ROW read-only snapshot to the specified file when the determining module determines that the read-only snapshot level attribute matches the file snapshot level attribute of the specified file Old data;
  • the deleting module is configured to delete the old data before the modification of the specified file when the determining module determines that the ROW read-only snapshot that does not have the read-only snapshot level attribute matches the file snapshot level attribute of the specified file.
  • the data storage protection device sets the file snapshot level attribute of the file by setting the file snapshot level attribute of the file, and can set different files to different snapshot levels, and when creating a ROW read-only snapshot for the system file. Specifies the snapshot level of the file that the ROW read-only snapshot needs to protect, so that the ROW read-only snapshot protects only those important files that need to be protected. On this basis, the user can also participate in the control of the ROW read-only snapshot. The user decides which files of the FS to create snapshots according to the application scenario, controls the space used for the snapshot as much as possible, and reduces the FS occupied by the ROW read-only snapshot. Space makes the FS located on the critical path as available as possible, enhancing the competitiveness of the product.
  • the embodiment provides a protection device for storing data, and the device includes:
  • a receiver 1001 configured to receive an attribute setting instruction, where the attribute setting instruction requests setting a file snapshot level attribute of a file in the file system;
  • the processor 1002 is configured to set a file snapshot level attribute of the file according to an attribute setting instruction received by the receiver;
  • the receiver 1001 is further configured to receive a snapshot creation instruction, where the snapshot creation instruction carries a file snapshot level attribute parameter of a file to be protected;
  • the processor 1002 is further configured to create a ROW read-only snapshot for the file system according to the snapshot creation instruction received by the receiver 1001, and set a read-only snapshot of the ROW read-only snapshot according to the file snapshot level attribute parameter. a level attribute; and a method for determining whether a file snapshot level attribute of the specified file matches a read-only snapshot level attribute of the created ROW read-only snapshot when the specified file is modified, and is created according to the matching when the matching is performed
  • the ROW read-only snapshot performs pre-write protection on the specified file.
  • the processor 1002 is further configured to create the ROW read-only snapshot by sharing a root with the file system; and setting a read-only snapshot level attribute of the ROW read-only snapshot according to the file snapshot level attribute And setting a system snapshot level attribute of the file system according to the read-only snapshot level attribute.
  • the processor 1002 is further configured to record the system snapshot level attribute as a set including a [snap level-logical time point] pair, wherein the snapshot level represents the created ROW only Reading the snapshot level of the snapshot, the logical time point representing a logical point in time at which the ROW read-only snapshot is created; recording the read-only snapshot level attribute as a set including a [snap level-logical point in time] pair, wherein the snapshot level Indicates the snapshot level of the file to be protected, which represents the logical point in time at which the ROW read-only snapshot was created.
  • the receiver is further configured to receive a snapshot creation instruction that carries a snapshot name
  • the processor is further configured to name the ROW read-only snapshot according to a snapshot name carried in a snapshot creation instruction received by the receiver.
  • the receiver 1001 is further configured to: after the processor 1002 creates the ROW read-only snapshot, receive a request to access the ROW read-only snapshot;
  • the device also includes:
  • a transmitter configured to output, according to the request received by the receiver 1002, a file whose file snapshot level attribute has a value equal to a value of a snapshot level in a read-only snapshot level attribute of the ROW read-only snapshot.
  • the receiver 1001 is further configured to receive modification data for modifying a specified file in the file system
  • the processor 1002 is further configured to modify data of the specified file according to the modified data received by the receiver, and save the modified new data of the specified file to a new disk location; determine the created location In the ROW read-only snapshot of the file system, whether there is a ROW read-only snapshot whose value of the snapshot level of the read-only snapshot level attribute is equal to the value of the file snapshot level attribute of the specified file, and if so, the specified file is retained. The old data before the modification is changed, and the root of the ROW read-only snapshot is pointed to the old data of the specified file, and if not, the old data before the modification of the specified file is deleted.
  • the storage data protection device sets the file snapshot level attribute of the file by adding the file snapshot level attribute of the file, and can set different files to different snapshot levels, and create a ROW read-only for the system file.
  • Snapshot specifies the snapshot level of the file to be protected by the ROW read-only snapshot, so that the ROW read-only snapshot only protects the important files that need to be protected, which can effectively reduce the FS space occupied by the ROW read-only snapshot, so that the FS located in the critical path Use as much as possible to enhance the competitiveness of your products.
  • the method and apparatus for protecting stored data add a file snapshot level attribute to a file in a file system, and set different file to different snapshots by setting a file snapshot level attribute.
  • Level and you can specify the snapshot level of the file to be protected when creating a ROW read-only snapshot of the system file.
  • the snapshot level attribute is Determine whether to protect the file by snapshot. If it matches, retain the old data before the file is modified. Otherwise, delete the old data before the file is modified, so that the user can participate in the control of the ROW read-only snapshot.
  • the protection device for storing data provided by the foregoing embodiment is only exemplified by the division of the foregoing functional modules when implementing protection of the stored data.
  • the foregoing functions may be allocated according to requirements. Different functional modules are completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the protection device for storing data and the method for protecting the stored data provided by the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

一种存储数据的保护方法及装置,属于网络连接存储领域。所述方法包括:接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性;根据所述属性设置指令设置所述文件的文件快照级别属性;接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;根据所述快照创建指令为所述文件系统创建采用写时重定向ROW技术的ROW只读快照,所述ROW只读快照的只读快照级别属性根据所述文件快照级别属性参数设置。对该文件快照级别属性进行设置,并在对系统文件创建只读快照时指定该只读快照需要保护的文件的快照级别,根据应用场景决定该为文件系统的哪些文件创建快照,控制快照的使用空间,降低只读快照占用的文件系统的空间。

Description

一种存储数据的保护方法及装置
本申请要求于2013年12月30日提交中国专利局、申请号201310744238.0、发明名称为“一种存储数据的保护方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及网络连接存储领域,特别涉及一种存储数据的保护方法及装置。
背景技术
在NAS(Network Attached Storage,网络连接存储)领域,对FS(File System,文件系统)整体创建采用ROW(Redirect-on-write,写时重定向)技术的ROW只读快照是实现存储数据保护的主流技术。FS的ROW只读快照直接保护FS的写前数据块,即ROW只读快照将占用分配给FS的可用空间。目前对FS创建ROW只读快照的技术都是针对FS整体,当对FS频繁修改后,ROW只读快照会占据FS大量空间。例如一个总可用空间为100MB的FS,写入一个17.94MB的文件1,创建一个ROW只读快照,然后覆盖写入前面的文件1,如此反复4次,ROW只读快照累积独占空间将达到53.89MB,而原FS的可用空间降到28.1MB。当再向该FS写入一个37MB的文件时,就会出现FS空间不足、不能写入的错误。因此需要一种存储数据的保护方法,以解决ROW只读快照占用源文件系统过多空间的缺陷。
现有技术提出了几种降低只读快照占用空间的存储数据的保护方法:方法一、配置FS ROW只读快照预留,但ROW只读快照空间可超这个预留;方法二、配置FS自动扩容;方法三、配置FS自动删除ROW只读快照。
现有技术至少存在以下问题:
ROW只读快照占用大量FS可用空间,导致FS不可用,直接影响位于关键路径的FS的重要业务;针对上述问题的措施,不能从根本上解决ROW只读快照大量占用FS可用空间的问题。
发明内容
本发明提供了一种存储数据的保护方法及装置,技术方案如下。
第一方面,提供了存储数据的保护方法,所述方法包括:接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性;根据所述属性设置指令设置所述文件的文件快照级别属性;接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;根据所述快照创建指令为所述文件系统创建ROW只读快照,所述ROW只读快照的只读快照级别属性根据所述文件快照级别属性参数设置;在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
结合第一方面,在第一方面的第一种可能的实现方式中,根据所述快照创建指令为所述文件系统创建只读快照,包括:通过与所述文件系统共享根的方式创建所述ROW只读快照;根据所述文件快照级别属性设置所述ROW只读快照的只读快照级别属性;根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
结合第一方面或第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述系统快照级别属性包括快照级别-逻辑时间点对的集合,其中所述快照级别表示所述ROW只读快照保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点;所述只读快照级别属性包括快照级别-逻辑时间点对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
结合第一方面,在第一方面的第三种可能的实现方式中,所述快照创建指令还携带快照名称;所述根据所述快照创建指令为所述文件系统创建只读快照之后,还包括:根据所述快照名称命名所述ROW只读快照。
结合第一方面的第二种可能的实现方式,在第一方面的第四种可能的实现方式中,所述根据所述快照创建指令为所述文件系统创建只读快照之后,还包括:接收访问所述ROW只读快照的请求;输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性的快照级别的值相等的文件。
结合第一方面的第二种可能的实现方式,在第一方面的第五种可能的实现方式中,所述在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护,包括:接收所述 指定文件的修改数据;根据所述修改数据修改所述指定文件的数据,并将修改后的所述指定文件的新数据保存到新的磁盘位置;判断已创建的所述文件系统的只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的只读快照;若存在,保留所述指定文件修改前的旧数据,并将所述ROW只读快照的根指向所述指定文件的旧数据;否则,删除所述指定文件修改前的旧数据。
第二方面,提供了一种存储数据的保护装置,所述装置包括:接收单元,用于接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性,,以及用于接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;设置单元,用于根据所述接收单元接收的属性设置指令设置所述文件的文件快照级别属性;快照创建单元,用于根据所述接收单元接收的快照创建指令为所述文件系统创建只读快照,根据所述文件快照级别属性参数设置所述ROW只读快照的只读快照级别属性;文件保护单元,用于在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
结合第二方面,在第二方面的第一种可能的实现方式中,所述快照创建单元包括:创建模块,用于通过与所述文件系统共享根的方式创建所述ROW只读快照;设置模块,用于在所述创建模块创建所述ROW只读快照之后,根据所述文件快照级别属性设置所述ROW只读快照的只读快照级别属性,以及根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
结合第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述记录模块,还用于将所述系统快照级别属性记录为包括快照级别-逻辑时间点对的集合,其中所述快照级别表示所述ROW只读快照保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点;将所述只读快照级别属性记录为包括快照级别-逻辑时间点对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
结合第二方面,在第二方面的第三种可能的实现方式中,所述接收单元,还用于接收携带快照名称的快照创建指令;所述创建模块,还用于根据所述接 收单元接收的快照创建指令中携带的快照名称命名所述ROW只读快照。
结合第二方面的第二种可能的实现方式,在第二方面的第四种可能的实现方式中,所述接收单元,还用于在所述快照创建单元创建所述ROW只读快照之后,接收所述用户访问所述ROW只读快照的请求;所述装置还包括:输出单元,用于根据所述接收单元接收的请求输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性中的快照级别的值相等的文件。
结合第二方面、第二方面的第一种、第二种、第三种或第四种可能的实现方式,在第二方面第五种可能的实现方式中,所述接收单元,还用于接收所述文件系统中指定文件的修改数据;所述装置还包括:修改模块,用于根据所述接收单元接收的修改数据修改所述指定文件的数据,并将修改后的所述指定文件的新数据保存到新的磁盘位置;判断模块,用于在所述修改模块将修改后的所述指定文件的新数据保存到新的磁盘位置之后,判断已创建的所述文件系统的只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的只读快照;根模块,用于在所述判断模块判断存只读快照级别属性与所述指定文件的文件快照级别属性相匹配的ROW只读快照时,将所述ROW只读快照的根指向所述指定文件的旧数据;删除模块,用于在所述判断模块判断不存只读快照级别属性与所述指定文件的文件快照级别属性相匹配的只读快照时,删除所述指定文件修改前的旧数据。
本发明实施例提供的技术方案可以通过增加文件的文件快照级别属性,对该文件快照级别属性进行设置,可以将不同的文件设置成不同的快照级别,同时在对系统文件创建ROW只读快照时指定该ROW只读快照需要保护的文件的快照级别,让ROW只读快照只保护那些需要保护的重要文件,能够有效降低ROW只读快照对FS空间的占用。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,还可以根据这些附图获得其他的附图。
图1是本发明实施例一提供的存储数据的保护方法流程图;
图2是本发明实施例二提供的存储数据的保护方法流程图;
图3是本发明实施例二的fs1的文件的快照级别属性示意图;
图4是本发明实施例二为fs1创建指定快照级别的ROW只读快照示意图;
图5是本发明实施例二中修改不被快照保护的file1的示意图;
图6是本发明实施例二中修改被快照保护的file2的示意图;
图7是本发明实施例三提供的存储数据的保护方法流程图;
图8是本发明实施例三中创建多个只读快照的示意图;
图9是本发明实施例四提供的一种存储数据的保护装置的结构示意图;
图10是本发明实施例五提供的一种存储数据的保护装置的结构示意图。
具体实施方式
本发明的发明人在降低只读快照占用FS过多空间的研究过程中发现,在FS中并不是所有文件都值得用其只读快照保护起来,因此如果控制FS的只读快照选择性的保护FS中的重要文件,便可以解决只读快照大量占用FS可用空间的问题,进而让位于关键路径的FS业务尽量可用。
为了实现对只读快照的保护对象进行控制,本发明对FS的所有文件(包括目录)增加一个属性:文件快照级别属性,该属性也可以由用户设置;为创建FS只读快照的指令增加一个选项:文件快照级别属性参数,创建的这个FS只读快照将只保护FS中设置了与该文件快照级别属性参数匹配的文件快照级别属性的文件,即该文件快照级别属性的值与该文件快照级别属性参数的值相同;为FS新增系统快照级别属性;为只读快照新增只读快照级别属性。
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。
实施例一
本实施例提供一种存储数据的保护方法,请参阅图1,方法流程包括:
101、接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性;
102、根据所述属性设置指令设置所述文件的文件快照级别属性;
103、接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;
104、根据所述快照创建指令为所述文件系统创建只读快照,所述ROW只 读快照的只读快照级别属性根据所述文件快照级别属性参数设置;
105、在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
具体的,所述的写前保护是指对所述指定文件修改前的数据进行映像或保留。
进一步的,所述根据所述快照创建指令为所述文件系统创建只读快照,包括:
通过与所述文件系统共享根的方式创建所述ROW只读快照;
根据所述文件快照级别属性设置所述ROW只读快照的只读快照级别属性;
根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
具体的,文件系统或只读快照的根是一个磁盘地址,通过这个地址,可以访问到文件系统或ROW只读快照的所有目录、文件数据;由于文件系统或只读快照的目录、文件都被抽象成一个个的Objects(对象),所有这些Objects组成文件系统或只读快照的Objset(对象集),Objset以树的形式组织,树有一个Objset Root(树根)地址,通过这个Objset Root可以访问到文件系统/只读快照的所有Objects,所以文件系统或只读快照根又叫Objset Root。
通过与所述文件系统共享根的方式创建所述ROW只读快照,是指创建ROW只读快照时,将ROW只读快照的根指向文件系统的根。在ROW只读快照创建时,由于尚未对文件系统中的文件进行修改,而ROW只读快照直接保护FS的写前数据(即修改前的数据),因此,此时ROW只读快照的根指向文件系统的根。
进一步的,所述系统快照级别属性及所述只读快照级别属性包括[快照级别-逻辑时间点]对的集合,其中所述快照级别表示所述ROW只读快照保护的文件的快照级别,逻辑时间点表示创建所述ROW只读快照的逻辑时间点;
所述只读快照级别属性包括[快照级别-逻辑时间点]对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
进一步的,所述快照创建指令还携带快照名称;
所述根据所述快照创建指令为所述文件系统创建只读快照之后,还包括:
根据所述快照名称命名所述ROW只读快照。
进一步的,所述根据所述快照创建指令为所述文件系统创建只读快照之后,还包括:
接收访问所述ROW只读快照的请求;
输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性的快照级别的值相等的文件。
进一步的,所述在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护,包括:
接收所述文件系统中指定文件的修改数据;
判断已创建的所述文件系统的只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的只读快照;
若存在,保留所述指定文件修改前的旧数据,并将所述ROW只读快照的根指向所述指定文件的旧数据;否则,删除所述指定文件修改前的旧数据。
本实施例提供的存储数据的保护方法,通过增加文件的文件快照级别属性,对该文件快照级别属性进行设置,可以将不同的文件设置成不同的快照级别,同时在对系统文件创建ROW只读快照时指定该ROW只读快照需要保护的文件的快照级别,从而让ROW只读快照只保护那些需要保护的重要文件,也可让用户参与到ROW只读快照的控制,由用户根据应用场景去决定该为FS的哪些文件创建快照,尽可能控制快照的使用空间,降低ROW只读快照占用的FS的空间,使位于关键路径的FS尽可能可用,提升产品的竞争力。
实施例二
本实施例提供一种存储数据的保护方法,该方法以ROW只读快照为例进行说明。请参阅图2,方法流程包括:
201、接收用户输入的请求将fs1中的文件2(file2)的文件快照级别属性的值设置为1的属性设置指令。
具体的,fs1中的文件1(file1)、file2均设有文件快照级别属性:sanpLevel。
sanpLevel:文件的快照级别,默认为未设置(none)。
202、根据该属性设置指令将file2的文件快照级别属性的值设置为1。
具体的,根据该属性设置指令完成对file2的文件快照级别属性的设置之 后,fs1的文件的快照级别属性示意图,请参阅图3。
文件系统fs1设有四个与ROW只读快照相关的属性:
prevSnap(前一快照):指向FS的前一个ROW只读快照;
nextSnap(下一快照):指向FS的下一个ROW只读快照;
snapLevels系统快照级别:包含一个[key-value]对即[快照级别-逻辑时间点]对的集合,key为只读快照要保护的文件的快照级别,value为创建只读快照的逻辑时间点,未创建ROW只读快照时默认为[none];
FS Root(FS的根):指向fs1所有文件数据的根。
由于用户选择将file2的文件快照级别属性的值设置为1,因此本步骤完成用户的属性设置指令之后file2的sanpLevel=1,file1的sanpLevel=none。
203、接收用户输入的为fs1创建名称为snap1的只保护sanpLevel的值设置为1的文件的快照创建指令。
具体的,该快照创建指令可采用如下格式:
Snapshot create fs1 snap1 snapLevel=1
具体的,Snapshot create:表示创建快照;
fs1:表示给文件系统fs1创建快照;
snap1:表示快照的名字是snap1;
snapLevel=1:表示只给文件系统中设置了级别为1的文件创建快照,即只保护文件快照级别属性值为1的文件。
204、根据该快照创建指令创建名为snap1的ROW只读快照。
具体的,本步骤创建名为snap1的ROW只读快照,并使该快照共享文件系统的根。为fs1创建指定快照级别的ROW只读快照示意图,请参阅图4。
创建完成后,fs1及snap1的相关属性设置如下:
fs1的snapLevels设置了一个key-value对:“1-10”,表示文件系统fs1在逻辑时间点为10的时候创建了一个只保护文件快照级别属性值为1的文件(即表示创建了一个快照级别为1的ROW只读快照);
snap1的snapLevels设置了一个key-value对:“1-10”,表示创建该snap1的逻辑时间点为10,其只保护逻辑时间点10之前的,文件快照级别属性值为1的文件。
fs1的prevSnap指向快照snap1;sanp1的nextSnap指向fs1;
sanp1的Snap Root快照的根直接共享文件系统fs1的根:FS Root。
具体的,如果此时收到用户访问snap1的请求,将过滤掉与sanp1的snapLevels的不匹配的文件,而输出与所述ROW只读快照的快照级别匹配的文件,即ROW只读快照只输出snapLevel的值与自身的snapLevels的快照级别key的取值相同的文件。
205、接收对file1进行修改的修改数据;
206、根据该修改数据修改file1的数据,将修改后的file1的新数据保存到新的磁盘位置;
207、判断snap1的snapLevels与file1的snapLevel与不匹配,删除file1的旧数据。
具体的,判断snap1的snapLevels与file1的snapLevel是否匹配,主要根据snapLevel的值与snapLevels的key的值是否相等,若相等则判断两者匹配,否则判断两者不匹配。本实施例中file1的snapLevel值为none,snap1的snapLevels的key值为1,两者不匹配。
具体的,修改不被快照保护的file1的示意图,请参阅图5,图中“X”表示数据被删除。修改file1之后,遵循ROW原则,file1的新数据总是写到新的磁盘位置;而file1的旧数据因为file1的snapLevel=none而不被snap1保护,将被直接删除;此时fs1的根指向file1的新数据及file2的数据,而snap1的根则指向file2的数据。本步骤中,file1的旧数据被删除,将不再占用文件系统fs1的可用空间,从而降低了ROW只读快照对源FS可用空间的占用。
208、接收对file2进行修改的修改数据;
209、根据该修改数据修改file2的数据,将修改后的file2的新数据保存到新的磁盘位置;
210、判断snap1的snapLevelsl与file2的snapLeve匹配,保留file2的旧数据。
具体的,修改被快照保护的file2的示意图,请参阅图6。遵循ROW原则,file2的新数据总是写到新的磁盘位置;而file2的旧数据因为file2的snapLevel=1而被snap1保护,不会被删除。此时,fs1的根指向file1的新数据与file2的新数据,而snap1的根则指向file2的旧数据。
具体的,本实施例的执行主体可以是存储管理系统。
本实施例提供的存储数据的保护方法,为文件系统中的文件增加了文件快照级别属性,由用户通过对文件快照级别属性进行设置,将不同的文件设置成 不同的快照级别,同时用户可以在对系统文件创建ROW只读快照时指定需要保护的文件的快照级别,当对文件进行修改后,根据是否存在只读快照级别属性与被修改的文件的文件快照级别属性匹配的ROW只读快照确定是否对该文件进行快照保护,如果存在则保留该文件修改前的旧数据,否则删除该文件修改前的旧数据,从而让用户参与到ROW只读快照的控制,由用户根据应用场景去决定该为FS的哪些文件创建快照,尽可能控制快照的使用空间,降低只读快照占用的FS的空间,使位于关键路径的FS尽可能可用,提升产品的竞争力。
实施例三
本实施例提供了一种存储数据的保护方法。本实施例中文件系统fs1包含多个文件,文件名依次为file1、file2…file6,该多个文件的文件快照级别属性默认为snapLevel=none。请参阅图7,方法流程包括:
701、接收用户输入的将文件系统fs1中的文件file2、file5的文件快照级别属性的值设置为1的属性设置指令。
702、根据该属性设置指令将file2、file5的文件快照级别属性设置为snapLvel=1。
703、接收用户输入的携带snapLevel=1的快照创建指令,该快照创建指令要求创建一个快照级别为1,名称为sanp1的ROW只读快照。
704、在逻辑时间点为10时,创建名为snap1的快照级别为1的ROW只读快照。
705、接收用户输入的将文件系统fs1中的文件file3、file4的文件快照级别属性的值设置为2的属性设置指令。
706、根据该属性设置指令将file3、file4的文件快照级别属性设置为snapLevel=2。
707、接收用户输入的携带snapLevel=2的快照创建指令,该快照创建指令要求创建一个快照级别为2,名称为sanp2的快照。
708、在逻辑时间点为20时,创建名为snap2的快照级别为2的ROW只读快照。
具体的,请参阅图7,创建完成后,fs1的系统快照级别属性snapLevels记录为:[1-10,2-20],表示在逻辑时间点为10的时候创建了一个快照级别为 1的Row只读快照,在逻辑时间点为20的时候创建了一个快照级别为2的Row只读快照;snap1的只读快照级别属性snaLevels记录为:[1-10],表示该只读快照的只保护快照级别为1的文件,其保护逻辑时间点10之前的数据;snap2的只读快照级别属性snapLevels记录为:[2-20],表示该只读快照的只保护快照级别为2的文件,其保护逻辑时间点20之前的数据。sanp1、sanp2与fs1共享根。而,文件系统fs1的文件file1、file6由于其文件快照级别为none,将不被任何ROW只读快照保护。
具体的,对snap1、snap2的访问及修改fs1的文件时,对各文件的处理方法与前述实施例相同此处不再赘述。
本实施例提供的存储数据的保护方法,为文件系统中的文件增加了文件快照级别属性,由用户通过对文件快照级别属性进行设置,将不同的文件设置成不同的快照级别,同时用户可以在对系统文件创建只读快照时指定需要保护的文件的快照级别,因此在对文件系统的文件进行修改时,ROW只读快照只保护用户指定的文件,对于未指定的文件将不进行ROW只读快照保护,能够有效地节省文件系统的空间。
实施例四
参见图9,本实施例提供了一种存储数据的保护装置,该装置包括:
接收单元901,用于属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性;
设置单元902,用于根据所述接收单元901接收的属性设置指令设置所述文件的文件快照级别属性;
所述接收单元901,还用于接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;
快照创建单元903,用于根据所述接收单元901接收的快照创建指令为所述文件系统创建指定快照级别的ROW只读快照,根据所述文件快照级别属性参数设置所述ROW只读快照的只读快照级别属性;
文件保护单元904,用于在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
进一步的,所述快照创建单元903包括:
创建模块,用于通过与所述文件系统共享根的方式创建所述ROW只读快照;
设置模块,用于在所述创建模块创建所述ROW只读快照之后,根据所述文件快照级别属性设置所述ROW只读快照的只读快照级别属性,以及根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
进一步的,所述记录模块,还用于将所述系统快照级别属性记录为包括[快照级别-逻辑时间点]对的集合,其中所述快照级别表示创建的所述ROW只读快照保护的文件的快照级别的快照级别,逻辑时间点表示创建所述ROW只读快照的逻辑时间点;将所述只读快照级别属性记录为包括[快照级别-逻辑时间点]对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
进一步的,所述接收单元901,还用于接收携带快照名称的快照创建指令;
所述创建模块,还用于根据所述接收单元901接收的快照创建指令中携带的快照名称命名所述ROW只读快照。
进一步的,所述接收单元901,还用于在所述快照创建单元创建所述ROW只读快照之后,接收访问所述ROW只读快照的请求;
所述装置还包括:
输出单元,用于输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性中的快照级别的值相等的文件。
进一步的,所述接收单元901,还用于接收所述文件系统中指定文件的修改数据;
所述装置还包括:
修改模块,用于根据所述接收单元901接收的修改数据修改所述指定文件的数据,并将修改后的所述指定文件的新数据保存到新的磁盘位置;
判断模块,用于在所述修改模块将修改后的所述指定文件的新数据保存到新的磁盘位置之后,判断已创建的所述文件系统的ROW只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的ROW只读快照;
根模块,用于在所述判断模块判断存只读快照级别属性与所述指定文件的文件快照级别属性相匹配的ROW只读快照时,将所述ROW只读快照的根指向所述指定文件的旧数据;
删除模块,用于在所述判断模块判断不存只读快照级别属性与所述指定文件的文件快照级别属性相匹配的ROW只读快照时,删除所述指定文件修改前的旧数据。
本实施例存储数据的保护装置,通过增加文件的文件快照级别属性,对该文件快照级别属性进行设置,可以将不同的文件设置成不同的快照级别,同时在对系统文件创建ROW只读快照时指定该ROW只读快照需要保护的文件的快照级别,从而让ROW只读快照只保护那些需要保护的重要文件。在此基础上也可让用户参与到ROW只读快照的控制,由用户根据应用场景去决定该为FS的哪些文件创建快照,尽可能控制快照的使用空间,降低ROW只读快照占用的FS的空间,使位于关键路径的FS尽可能可用,提升产品的竞争力。
实施例五
请参阅图10,本实施例提供了一种存储数据的保护装置,该装置包括:
接收机1001,用于接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性;
处理器1002,用于根据所述接收机接收的属性设置指令设置所述文件的文件快照级别属性;
所述接收机1001,还用于接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;
所述处理器1002,还用于根据所述接收机1001接收的快照创建指令为所述文件系统创建ROW只读快照,根据所述文件快照级别属性参数设置所述ROW只读快照的只读快照级别属性;以及用于在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
进一步的,所述处理器1002,还用于通过与所述文件系统共享根的方式创建所述ROW只读快照;根据所述文件快照级别属性设置所述ROW只读快照的只读快照级别属性,以及根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
进一步的,所述处理器1002,还用于将所述系统快照级别属性记录为包括[快照级别-逻辑时间点]对的集合,其中所述快照级别表示创建的所述ROW只 读快照的快照级别,逻辑时间点表示创建所述ROW只读快照的逻辑时间点;将所述只读快照级别属性记录为包括[快照级别-逻辑时间点]对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
进一步的,所述接收机,还用于接收携带快照名称的快照创建指令;
所述处理器,还用于根据所述接收机接收的快照创建指令中携带的快照名称命名所述ROW只读快照。
进一步的,所述接收机1001,还用于在所述处理器1002创建所述ROW只读快照之后,接收访问所述ROW只读快照的请求;
所述装置还包括:
发送机,用于根据所述接收机1002接收的请求输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性中的快照级别的值相等的文件。
进一步的,所述接收机1001,还用于接收对所述文件系统中指定文件的进行修改的修改数据;
所述处理器1002,还用于根据所述接收机接收的修改数据修改所述指定文件的数据,并将修改后的所述指定文件的新数据保存到新的磁盘位置;判断已创建的所述文件系统的ROW只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的ROW只读快照,若存在,则保留所述指定文件修改前的旧数据,并将所述ROW只读快照的根指向所述指定文件的旧数据,若不存在,则删除所述指定文件修改前的旧数据。
本实施例提供的存储数据的保护装置,通过增加文件的文件快照级别属性,对该文件快照级别属性进行设置,可以将不同的文件设置成不同的快照级别,同时在对系统文件创建ROW只读快照时指定该ROW只读快照需要保护的文件的快照级别,从而让ROW只读快照只保护那些需要保护的重要文件,可有效降低ROW只读快照占用的FS的空间,使位于关键路径的FS尽可能可用,提升产品的竞争力。
综上所述,本发明实施例提供的存储数据的保护方法及装置,为文件系统中的文件增加了文件快照级别属性,通过对文件快照级别属性进行设置,将不同的文件设置成不同的快照级别,并且可以在对系统文件创建ROW只读快照时指定需要保护的文件的快照级别,当对文件进行修改时,根据被修改的文件的文件快照级别属性是否与创建的ROW只读快照的只读快照级别属性是否匹 配确定是否对该文件进行快照保护,如果匹配则保留该文件修改前的旧数据,否则删除该文件修改前的旧数据,从而能够让用户参与到ROW只读快照的控制,由用户根据应用场景去决定该为FS的哪些文件创建快照,尽可能控制快照的使用空间,降低ROW只读快照占用的FS的空间,使位于关键路径的FS尽可能可用,提升产品的竞争力。
需要说明的是:上述实施例提供的存储数据的保护装置,在实现对存储数据的保护时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的存储数据的保护装置与存储数据的保护方法实施属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (12)

  1. 一种存储数据的保护方法,其特征在于,所述方法包括:
    接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性;
    根据所述属性设置指令设置所述文件的文件快照级别属性;
    接收快照创建指令,所述快照创建指令中携带文件快照级别属性参数,用以指示创建的只读快照需要保护的文件;
    根据所述快照创建指令为所述文件系统创建采用写时重定向ROW技术的ROW只读快照,所述ROW只读快照的只读快照级别属性根据所述文件快照级别属性参数设置;
    在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述快照创建指令为所述文件系统创建ROW只读快照,包括:
    通过与所述文件系统共享根的方式创建所述ROW只读快照;
    根据所述文件快照级别属性参数设置所述ROW只读快照的只读快照级别属性;
    根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
  3. 根据权利要求2所述的方法,其特征在于,
    所述系统快照级别属性包括快照级别-逻辑时间点对的集合,其中所述快照级别表示所述ROW只读快照保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点;
    所述只读快照级别属性包括快照级别-逻辑时间点对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
  4. 根据权利要求1所述的方法,其特征在于,所述快照创建指令还携 带快照名称;
    所述根据所述快照创建指令为所述文件系统创建ROW只读快照之后,还包括:
    根据所述快照名称命名所述ROW只读快照。
  5. 根据权利要求3所述的方法,其特征在于,所述根据所述快照创建指令为所述文件系统创建ROW只读快照之后,还包括:
    接收访问所述ROW只读快照的请求;
    输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性的快照级别的值相等的文件。
  6. 根据权利要求3所述的方法,其特征在于,所述在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护,包括:
    接收所述指定文件的修改数据;
    根据所述修改数据修改所述指定文件的数据,并将修改后的所述指定文件的新数据保存到新的磁盘位置;
    判断已创建的所述文件系统的ROW只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的ROW只读快照;
    若存在,保留所述指定文件修改前的旧数据,并将所述ROW只读快照的根指向所述指定文件的旧数据;否则,删除所述指定文件修改前的旧数据。
  7. 一种存储数据的保护装置,其特征在于,包括:
    接收单元,用于接收属性设置指令,所述属性设置指令请求设置文件系统中文件的文件快照级别属性,以及用于接收快照创建指令,所述快照创建指令中携带需要保护的文件的文件快照级别属性参数;
    设置单元,用于根据所述接收单元接收的属性设置指令设置所述文件的文件快照级别属性;
    快照创建单元,用于根据所述接收单元接收的快照创建指令为所述文件系统创建ROW只读快照,根据所述文件快照级别属性参数设置所述ROW只读快照的只读快照级别属性;
    文件保护单元,用于在对指定文件进行修改时,判断所述指定文件的文件快照级别属性与已创建的ROW只读快照的只读快照级别属性是否匹配,并在匹配时根据所述已创建的ROW只读快照对所述指定文件进行写前保护。
  8. 根据权利要求7所述的装置,其特征在于,所述快照创建单元包括:
    创建模块,用于通过与所述文件系统共享根的方式创建所述ROW只读快照;
    设置模块,用于在所述创建模块创建所述ROW只读快照之后,根据所述文件快照级别属性设置所述ROW只读快照的只读快照级别属性,以及根据所述只读快照级别属性设置所述文件系统的系统快照级别属性。
  9. 根据权利要求8所述的装置,其特征在于,所述记录模块,还用于将所述系统快照级别属性记录为包括快照级别-逻辑时间点对的集合,其中所述快照级别表示创建的所述ROW只读快照保护的文件的快照级别的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点;将所述只读快照级别属性记录为包括快照级别-逻辑时间点对的集合,其中所述快照级别表示需要保护的文件的快照级别,所述逻辑时间点表示创建所述ROW只读快照的逻辑时间点。
  10. 根据权利要求7所述的装置,其特征在于,
    所述接收单元,还用于接收携带快照名称的快照创建指令;
    所述创建模块,还用于根据所述接收单元接收的快照创建指令中携带的快照名称命名所述ROW只读快照。
  11. 根据权利要求9所述的装置,其特征在于,
    所述接收单元,还用于在所述快照创建单元创建所述ROW只读快照之后,接收访问所述ROW只读快照的请求;
    所述装置还包括:
    输出单元,用于根据所述接收单元接收的请求输出文件快照级别属性的值与所述ROW只读快照的只读快照级别属性中的快照级别的值相等的文件。
  12. 根据权利要求7至11任一项所述的装置,其特征在于,
    所述接收单元,还用于接收所述文件系统中指定文件的修改数据;
    所述文件保护单元还包括:
    修改模块,用于根据所述接收单元接收的修改数据修改所述指定文件的数据,并将修改后的所述指定文件的新数据保存到新的磁盘位置;
    判断模块,用于在所述修改模块将修改后的所述指定文件的新数据保存到新的磁盘位置之后,判断已创建的所述文件系统的ROW只读快照中,是否存在只读快照级别属性的快照级别的值与所述指定文件的文件快照级别属性的值相等的ROW只读快照;
    根模块,用于在所述判断模块判断存只读快照级别属性与所述指定文件的文件快照级别属性相匹配的ROW只读快照时,将所述ROW只读快照的根指向所述指定文件的旧数据;
    删除模块,用于在所述判断模块判断不存只读快照级别属性与所述指定文件的文件快照级别属性相匹配的ROW只读快照时,删除所述指定文件修改前的旧数据。
PCT/CN2014/088940 2013-12-30 2014-10-20 一种存储数据的保护方法及装置 WO2015101083A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310744238.0 2013-12-30
CN201310744238.0A CN103729265B (zh) 2013-12-30 2013-12-30 一种存储数据的保护方法及装置

Publications (1)

Publication Number Publication Date
WO2015101083A1 true WO2015101083A1 (zh) 2015-07-09

Family

ID=50453348

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/088940 WO2015101083A1 (zh) 2013-12-30 2014-10-20 一种存储数据的保护方法及装置

Country Status (2)

Country Link
CN (1) CN103729265B (zh)
WO (1) WO2015101083A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020022347A (ja) * 2018-08-03 2020-02-06 エーエーシー テクノロジーズ ピーティーイー リミテッド 振動モータ

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729265B (zh) * 2013-12-30 2017-01-04 华为技术有限公司 一种存储数据的保护方法及装置
CN109032507B (zh) * 2018-06-28 2021-11-19 郑州云海信息技术有限公司 一种生成源卷存储快照的方法、系统及相关组件
CN110888779B (zh) * 2019-11-18 2023-07-07 上海新炬网络信息技术股份有限公司 基于模拟写入的文件系统只读判断方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040083345A1 (en) * 2002-10-24 2004-04-29 Kim Young Ho System and method of an efficient snapshot for shared large storage
CN101183383A (zh) * 2007-12-17 2008-05-21 中国科学院计算技术研究所 一种快照系统及其使用方法
CN101246458A (zh) * 2008-02-29 2008-08-20 中国科学院计算技术研究所 一种磁盘数据保护方法和系统
CN101661415A (zh) * 2009-09-21 2010-03-03 中兴通讯股份有限公司 一种保存快照数据的方法及存储快照系统
CN103729265A (zh) * 2013-12-30 2014-04-16 华为技术有限公司 一种存储数据的保护方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7010553B2 (en) * 2002-03-19 2006-03-07 Network Appliance, Inc. System and method for redirecting access to a remote mirrored snapshot
CN103473277B (zh) * 2013-08-27 2017-04-05 华为技术有限公司 文件系统的快照方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040083345A1 (en) * 2002-10-24 2004-04-29 Kim Young Ho System and method of an efficient snapshot for shared large storage
CN101183383A (zh) * 2007-12-17 2008-05-21 中国科学院计算技术研究所 一种快照系统及其使用方法
CN101246458A (zh) * 2008-02-29 2008-08-20 中国科学院计算技术研究所 一种磁盘数据保护方法和系统
CN101661415A (zh) * 2009-09-21 2010-03-03 中兴通讯股份有限公司 一种保存快照数据的方法及存储快照系统
CN103729265A (zh) * 2013-12-30 2014-04-16 华为技术有限公司 一种存储数据的保护方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020022347A (ja) * 2018-08-03 2020-02-06 エーエーシー テクノロジーズ ピーティーイー リミテッド 振動モータ

Also Published As

Publication number Publication date
CN103729265B (zh) 2017-01-04
CN103729265A (zh) 2014-04-16

Similar Documents

Publication Publication Date Title
US10949551B2 (en) Policy aware unified file system
US8458234B2 (en) Data management method
JP5514903B2 (ja) ファイルレベル階層ストレージ管理システム、方法、及び装置
US9558205B2 (en) Method for creating clone file, and file system adopting the same
US8515911B1 (en) Methods and apparatus for managing multiple point in time copies in a file system
US7464116B2 (en) Method and apparatus for cloning filesystems across computing systems
US20150006581A1 (en) Method for a Storage Device Accessing a File and Storage Device
US11977456B2 (en) File system framework
US7725673B2 (en) Storage apparatus for preventing falsification of data
WO2018121454A1 (zh) 文件访问控制列表管理方法和相关装置和系统
EP1209556A2 (en) Method and system for transparently extending non-volatile storage
JP2004355660A (ja) 小さいオブジェクトデータストリームを使用する、データオブジェクトを保存する方法
US9529809B2 (en) Managing log data using a circular fixed size file
CN109804359A (zh) 用于将数据回写到存储设备的系统和方法
WO2015101083A1 (zh) 一种存储数据的保护方法及装置
US9015526B2 (en) Restoring method and computer system
US8903804B2 (en) Data existence judging device and data existence judging method
JP2014178784A (ja) 情報処理装置、情報処理システム及び情報処理プログラム
WO2015154425A1 (zh) 磁盘数据保护方法及装置
US8046391B2 (en) Storage apparatus and its file control method and storage system
KR20210076828A (ko) 키-값 장치 및 이의 블록 인터페이스 에뮬레이션 방법
WO2017101477A1 (zh) 一种PostgreSQL块
WO2017172377A1 (en) File system support for file-level ghosting
WO2019231836A1 (en) Hydration of a hierarchy of dehydrated files
CN109478181A (zh) 用于使得能够修改文件系统卷内的多个数据对象的系统和方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14876075

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14876075

Country of ref document: EP

Kind code of ref document: A1