CN103810056A - Method for obtaining consistent backup on Linux platform - Google Patents

Method for obtaining consistent backup on Linux platform Download PDF

Info

Publication number
CN103810056A
CN103810056A CN 201210437244 CN201210437244A CN103810056A CN 103810056 A CN103810056 A CN 103810056A CN 201210437244 CN201210437244 CN 201210437244 CN 201210437244 A CN201210437244 A CN 201210437244A CN 103810056 A CN103810056 A CN 103810056A
Authority
CN
Grant status
Application
Patent type
Prior art keywords
file
backup
function
monitored
files
Prior art date
Application number
CN 201210437244
Other languages
Chinese (zh)
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

Links

Abstract

The invention discloses a method for obtaining a consistent backup on a Linux platform. The method comprises the steps that files to be backed up are monitored, write operations of the files are intercepted in the backup process of the files, real-time data files of the files in the process of the write operations are obtained, mirror image data of the monitored files and real-time data of the monitored files are combined to form a backup according to the time sequence, and the backup generated at the moment is the consistent backup. According to the method for obtaining the consistent backup on the Linux platform, the requirement for a Linux operating system is low; due to the fact that an application module and a kernel module are used, the consistent backup of files or databases can be obtained on any Linux operating system, and the method for obtaining the consistent backup on the Linux platform is universal, and does not depend on any selectable configuration or technologies.

Description

—种在Linux平台上获得一致性备份的方法 - ways to get a consistent backup on the Linux platform

技术领域 FIELD

[0001] 本发明涉及一种计算机数据安全领域,特别是涉及一种在LINUX平台上获得一致性备份的方法。 [0001] The present invention relates to the field of computer security data, in particular, it relates to a method of obtaining a consistent backup on LINUX platforms.

背景技术 Background technique

[0002] 随着计算机系统和互联网在各个领域的广泛应用,许多政府机构、公司甚至个人对计算机数据越来越依赖,因此数据安全成为信息社会的重要诉求之一,而数据备份正是解决数据安全的核心问题。 [0002] With the extensive application of computer systems and the Internet in various fields, many government agencies, companies and even individuals are increasingly dependent on computer data, data security has become one of the key demands of the information society, and data backup is to solve data the core security issues.

[0003] 本技术方案解决的正是如何在Linux平台上获得一致性备份,用户在某一个状态下做备份时,可能有应用正在修改某一文件或者数据,这就是使得备份的时候文件处于一个状态,而备份完后,文件却处于另一个状态,这种状态恢复数据库数据几乎不会成功。 [0003] The present technology solutions to exactly how to get in on the Linux platform consistent backup, do a backup when a user in one state, there may be a file or application is modifying data, this is the time to make a backup file in a state, and after the backup, but the file is in another state, this state restore database data hardly succeed.

[0004] Linux是一个性能稳定、功能强大、效率高的操作系统。 [0004] Linux is a stable, powerful, efficient operating system. 目前,Linux传统的文件备份工具如tar和cpio等命令功能比较简单,难以处理文件系统级的数据备份,而能够获得一致性备份的只有基于BTRFS、ZFS文件系统的快照技术和基于逻辑卷管理(LVM)的快照技术。 Currently, Linux traditional file backup tool such as tar and cpio commands such function is relatively simple, difficult to deal with file system-level data backup, but can only get a consistent backup BTRFS based snapshot technology-based ZFS file system and logical volume manager ( LVM) snapshot technology. Linux默认的ext3或ext4文件系统是不支持快照的,且逻辑卷管理需要安装,而且很多Linux用户可能并没有进行分区以及建立Ivm逻辑卷,因此,对于普通用户来说,快照这一功能有很大的使用局限性。 Linux default ext3 or ext4 file system is not supported snapshot, and logical volume manager needs to be installed, and many Linux users may not be partitioned and the establishment of Ivm logical, therefore, for the average user, there are a snapshot of this function large use limitations.

发明内容 SUMMARY

[0005] 本发明的目的是提供一种在Linux平台上获得一致性备份的方法。 [0005] The object of the present invention is to provide a method to obtain a consistent backup on a Linux platform. 用户在某一个状态下做备份时,可能有应用正在修改某一文件或者数据,这就使得备份的时候文件处于一个状态,而备份完后,文件却处于另一个状态,这种状态恢复数据库数据几乎不会成功。 When users make a backup in one state, there may be a file or application is modifying data, which makes backup files when in a state, and after the backup, but the file is in another state, this state recover database data hardly succeed.

[0006] 为解决上述技术问题,本发明采取以下技术方案: [0006] To solve the above problems, the present invention adopts the following technical scheme:

[0007] 步骤1:在Linux平台上,应用模块将需要监控的文件或目录传递给管理模块,并且向管理模块发送开始或停止监控的命令。 [0007] Step 1: On Linux platforms, application modules will need to be monitored file or directory passed to the management module and the command to start or stop monitoring to the management module.

[0008] 步骤2:Linux内核的监控模块拦截sys_write函数,将所述原sys_write函数记为0LDWRITE函数,并将拦截后的所述sys-write函数用NEffffRITE函数替换。 [0008] Step 2: Linux kernel monitoring module sys_write intercept function, the function is referred to as 0LDWRITE sys_write original function, and the function of intercepting the sys-write function is replaced with NEffffRITE.

[0009] 步骤3:当用户需要进行监控时,所述应用模块通过接口通知内核开始监控,当文件的写操作被截获后,所述NEffffRITE函数根据文件句柄判断所述文件是否为被监控的文件,如果是被监控文件,则捕获写操作的操作时刻、文件名、起始偏移、写入的数据内容以及字节数,将捕获到的实时监控信息存储到实时数据集合中,最后所述文件再调用0LDWRITE函数;如果不是监控文件,则直接调用0LDWRITE函数,继续原来的进程。 [0009] Step 3: When the user needs to be monitored, the application module through an interface tells the kernel starts to monitor the write operation when the file is intercepted, the file functions in accordance with a file handle NEffffRITE determines whether the file is to be monitored If the file is being monitored, the capturing operation timing of the write operation, file names, start offset, and the number of bytes written content data, the real-time monitoring of the captured information is stored in the real-time data collection, the last file recall 0LDWRITE function; if not monitored file, 0LDWRITE direct call function to continue the original process.

[0010] 步骤4:当用户程序完成对需要监控文件或目录的拷贝后,所述应用模块通过接口通知内核停止监控。 [0010] Step 4: After the complete copy of the program when the user needs to monitor the file or directory, the application module via the interface notification stop monitoring the kernel.

[0011] 步骤5:应用模块把上述监控文件的镜像数据和实时数据集合文件按实时数据操作时间的先后顺序组成一个备份文件,此时生成的备份就是一致性备份。 [0011] Step 5: The image data of the application module monitoring a set of data files and real-time files in real time according to a backup file operating time sequence data, generated at this time a backup is consistent backup. [0012] 从上述技术方案可以看出,与现有在Linux平台上获得一致性备份的方法相比,本发明具有以下优点: [0012] As can be seen from the above technical solution, compared to the conventional method to obtain a consistent backup on the Linux platform, the present invention has the following advantages:

[0013] 第一,本发明对Linux操作系统的要求比较低,通过使用应用模块和内核模块,可以在任何Linux系统上获得文件或数据库的一致性备份,方法通用,不依赖于任何可选配置或技术。 [0013] First, the Linux operating system requirements for the present invention is relatively low, by using the kernel module and the application module can be obtained consistent backup files or databases on any Linux system, general method, independent of any optional configuration or technology.

[0014] 第二,目前现有在Linux中,必须在支持快照技术的文件系统或逻辑卷管理上才能获得一致性备份。 [0014] Second, currently available in Linux, it is necessary to get a consistent backup support snapshots on a file system or logical volume management. 但是,Linux默认的ext3或ext4文件系统是不支持快照的,且逻辑卷管理需要安装,因此,对于普通用户来说,快照这一功能有很大的使用局限性。 However, Linux default ext3 or ext4 file system is not supported snapshot, and logical volume manager needs to be installed, therefore, for the average user, this feature has a great snapshot of the use of limitations.

[0015] 第三,LVM的快照采用COW(Copy-On-Write)的机制,即当对原逻辑卷的数据进行写操作时,原始的数据块将被拷贝到快照卷分配的空间,并将数据的流向记录在一个表中。 [0015] Third, using the LVM snapshot mechanism COW (Copy-On-Write), i.e., when the logical volume of the original data write, the original data blocks to be copied to the snapshot volume space allocation, and the flow of data records in a table. 如果该逻辑卷存在多个快照卷,则原始数据块将被拷贝到各个快照卷所分配的空间,降低了系统写磁盘的效率。 If there are a plurality of the logical volume snapshot volume, the original data blocks to be copied to the respective space allocated snapshot volume, reducing the efficiency of the system disk write.

[0016] 从上述可知,本发明技术具有可操作性高、成本低、效率高的特点。 [0016] From the foregoing, the techniques of this invention has high operability, low cost, high efficiency characteristics.

附图说明 BRIEF DESCRIPTION

[0017] 图1是本发明的总流程图。 [0017] FIG. 1 is a general flowchart of the present invention.

[0018] 图2是本发明监控模块拦截到sysirite函数并进行处理的流程图。 [0018] FIG 2 is a flowchart of a monitoring module of the present invention functions to intercept and process sysirite.

[0019] 图3是本发明记录实时数据的流程图。 [0019] FIG. 3 is a flowchart of real-time data recording of the present invention.

[0020] 图4是本发明中合成一致性备份文件的示意图。 [0020] FIG. 4 is a schematic diagram of the synthesis of the consistency of the backup file in the present invention.

具体实施方式 detailed description

[0021] 下面结合附图对本发明的技术方案进行详细说明。 [0021] DRAWINGS The technical solution of the present invention will be described in detail. 本实施方案在以本发明技术方案为前提下进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。 In the present embodiment in the aspect of the invention is a premise of embodiment, given and the specific operation of the embodiment in detail, but the scope of the present invention is not limited to the following examples.

[0022] 首先,用户根据备份需要通过应用模块告诉管理模块需要监控的文件或目录,当需要监控时,应用模块向管理模块发送开始监控的命令。 [0022] First of all, we need to tell the management module according to the backup application modules need to be monitored by a file or directory, when the need to monitor the application module sends the command to start monitoring the management module. 同理,当不需要监控时,应用模块向管理模块发送停止监控的命令。 Similarly, when no monitoring, application monitoring module sends a command to stop the management module. 例如,用户在10时至11时之间对文件进行备份,因此用户可以选择在10时或之前对文件进行监控,当备份结束后,用户可以结束监控,也可以根据需要继续监控。 For example, a user in the file between 10 to 11 the backup, the user can select the file or to monitor prior to 10:00, when the end of the backup, the user may end the monitoring, the monitoring may be continued as needed. 另外,应用模块可以向管理模块添加、删除需要监控的文件。 In addition, the application module can be added to the management module, delete the files need to be monitored.

[0023] 当应用模块通过接口通知内核模块开始监控后,监控模块拦截内核sys-write函数,并对sys-write函数进行处理,如图2所示,原sys-write函数记为OLDWRITE函数,并将拦截后的所述sys-write函数用NEffffRITE函数替换。 [0023] When the application module via the interface module notifies the kernel starts to monitor the monitoring module intercepting core sys-write function, and processing sys-write function, shown in Figure 2, the original functions referred to as sys-write function OLDWRITE, and after intercepting the sys-write function replaced with NEffffRITE function.

[0024] 如图3所示,当文件的写操作被截获后,并对截获的sysirite函数进行过处理后,NEffffRITE函数根据文件句柄判断该文件是否为被监控的文件,如果不是被监控的文件,则调用OLDWRITE函数,被截获的文件继续原来的进程;如果被截获的文件为被监控文件,捕获文件的操作信息,包括操作时刻、文件名、起始偏移、写入的数据内容以及字节数,将捕获到的实时监控信息存储到实时数据集合中,最后所述文件再调用OLDWRITE函数,继续原来的进程。 After [0024] As illustrated, the write operation when the file is intercepted, and intercepted functions sysirite been treated 3, NEffffRITE function to determine whether the file according to a file handle for the file to be monitored, if the file is not being monitored , the call OLDWRITE function, intercepted the original document to continue the process; if the files are intercepted file operation information monitoring, capture files, including the operating time, file name, start offset, the written word and data content number of sections, to capture the real-time monitoring information into real-time data collection, and finally the file and then call OLDWRITE function to continue the original process. 因为监控过程为实时的,因此能够实时捕获进行写操作的文件,每拦截一次形成一次实时数据。 Because the process is monitored in real time, thus enabling real-time capture for file write operations, each time forming intercept a real-time data. 由于操作信息非常繁杂,因此要对操作信息进行分析,将需要的操作信息记录到实时数据集合中,且实时数据文件以操作时刻命名,这样在后面按时间先后顺序合成一致性备份文件时,清晰明了,易于操作,保证数据的一致性。 Very complicated due to the operation information, and therefore the operation information is analyzed, the recording operation of the information required real-time data collection, real-time data and the timing to operate the file name, so that later chronologically consistent backup files Synthesis, clear clear, easy to operate, to ensure data consistency.

[0025] 当用户完成对某一文件的拷贝后,应用模块通过接口通知内核停止监控。 [0025] When the user of the completion of copying of a file, the application notification via the interface module stops monitoring the kernel. 如果用户需要对该文件继续监控,则根据需要继续监控所述文件,在此后形成的实时数据文件仍按照操作时刻命名,在用户进行下一次备份时,合成一致性备份文件。 If the user needs to continue monitoring the file, then continues to monitor the files as needed, real-time data file named thereafter formed according to the operation time remains, when the user performs the next backup, the backup file consistency synthesis.

[0026] 最后,如图4所示,应用模块把监控文件的镜像数据和实时数据文件集合按操作时间顺序组合成一个新的备份文件,此时生产的备份文件就是一致性备份。 [0026] Finally, FIG. 4, the application module monitoring a set of data files and image data files in real time according to the time sequence of operations are combined into a new backup file, the backup file is produced at this time consistent backup. 在形成一个新的一致性备份文件后,用户可以将产生的镜像文件和实时数据文件删除,增加电脑空间。 After the formation of a new consistent backup file, the user can generate real-time data and image file file deletion, an increase of cyberspace.

Claims (3)

  1. 1.一种在Linux平台上获得一致性备份的方法,其特征在于包括以下步骤: 步骤1:应用模块将需要监控的文件或目录传递给管理模块,并且向管理模块发送开始或停止监控的命令; 步骤2:Linux内核的监控模块拦截sys-write函数,将所述原sys_write函数记为OLDWRITE,并将拦截后的所述sys-write函数用NEffffRITE函数替换; 步骤3:所述应用模块通过接口通知内核开始监控,当文件的写操作被截获后,所述NEffffRITE函数根据文件句柄判断所述文件是否为被监控的文件,如果是被监控文件,则捕获写操作的操作时刻、文件名、起始偏移、写入的数据内容以及字节数,将捕获到的实时监控信息存储到实时数据集合中,最后所述文件再调用OLDWRITE函数,如果不是监控文件,则直接调用OLDWRITE函数; 步骤4:当用户程序完成对需要监控文件或目录的拷贝后,所述应用模块通过接口通知内 A method for obtaining a consistent backup on the Linux platform, characterized by comprising the following steps: Step 1: The application module need to be monitored is passed to a file or directory management module, and transmits the command to start or stop monitoring the management module ; step 2: Linux kernel sys-write monitoring module intercepting function, the function is referred to as the original sys_write OLDWRITE, and the function of intercepting the sys-write function is replaced with NEffffRITE; step 3: the application module via the interface inform the kernel to start monitoring, when a file write operation is intercepted, the NEffffRITE function depending on whether the file handle for the file to determine whether the file is monitored, and if the monitored file, the capture operation timing of the write operation, the file name, since start offset, and the number of bytes written content data, the real-time monitoring of the captured information is stored in the real-time data collection, and finally the file and then call the function OLDWRITE, if the file is not monitored, the direct call function OLDWRITE; step 4 : when the user program need to be monitored to complete copying of a file or directory after the application module via the notification interface 核停止监控; 步骤5:应用模块把上述监控文件的镜像数据和实时数据集合文件按时间的先后顺序组成一个备份文件,此时生成的备份就是一致性备份。 Nuclear stop monitoring; Step 5: Application of the mirror data module files and said monitor real-time data file according to the order of time set up a backup file, backup generated at this time is consistent backup.
  2. 2.如权利要求1中所述一种在Linux平台上获得一致性备份的方法,所述Linux平台对Linux操作系统的要求比较低,默认文件系统即可,不需要具备快照功能、安装逻辑卷管理以及其他复杂配置。 2. The method of claim 1 for obtaining a consistent backup on the Linux platform as claimed in claim, claim the Linux platform Linux operating system is relatively low, the default file system can not necessary to provide a snapshot function, the logical volume mounted management, and other complex configurations.
  3. 3.如权利要求1中所述一种在Linux平台上获得一致性备份的方法,所述实时数据集合是存储监控文件进行写操作时捕获到的实时监控信息,每拦截到一次写操作并进行一次记录,其功能类似日志。 3. The method of claim 1 for obtaining a consistent backup on the Linux platform as claimed in claim time data sets are stored in a file for real-time monitoring of the captured monitoring information write operation, each write operation to intercept and once recording, which functions like a log.
CN 201210437244 2012-11-06 2012-11-06 Method for obtaining consistent backup on Linux platform CN103810056A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201210437244 CN103810056A (en) 2012-11-06 2012-11-06 Method for obtaining consistent backup on Linux platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201210437244 CN103810056A (en) 2012-11-06 2012-11-06 Method for obtaining consistent backup on Linux platform

Publications (1)

Publication Number Publication Date
CN103810056A true true CN103810056A (en) 2014-05-21

Family

ID=50706862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201210437244 CN103810056A (en) 2012-11-06 2012-11-06 Method for obtaining consistent backup on Linux platform

Country Status (1)

Country Link
CN (1) CN103810056A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017190580A1 (en) * 2016-05-06 2017-11-09 北京奇虎科技有限公司 Method and device for accessing database

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5086502A (en) * 1989-07-11 1992-02-04 Intelligence Quotient International Limited Method of operating a data processing system
US5546534A (en) * 1993-07-19 1996-08-13 Intelligence Quotient International Ltd. Method of operating a computer system
CN1326155A (en) * 2000-05-25 2001-12-12 英业达股份有限公司 Method for instantaneous generation of file version
CN1368683A (en) * 2001-02-02 2002-09-11 英业达股份有限公司 Fault-tolerant method by means of synchronous directory
CN102467557A (en) * 2010-11-17 2012-05-23 英业达股份有限公司 Data de-duplication processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5086502A (en) * 1989-07-11 1992-02-04 Intelligence Quotient International Limited Method of operating a data processing system
US5546534A (en) * 1993-07-19 1996-08-13 Intelligence Quotient International Ltd. Method of operating a computer system
CN1326155A (en) * 2000-05-25 2001-12-12 英业达股份有限公司 Method for instantaneous generation of file version
CN1368683A (en) * 2001-02-02 2002-09-11 英业达股份有限公司 Fault-tolerant method by means of synchronous directory
CN102467557A (en) * 2010-11-17 2012-05-23 英业达股份有限公司 Data de-duplication processing method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017190580A1 (en) * 2016-05-06 2017-11-09 北京奇虎科技有限公司 Method and device for accessing database

Similar Documents

Publication Publication Date Title
US7454443B2 (en) Method, system, and program for personal data management using content-based replication
US7899788B2 (en) Using a data protection server to backup and restore data on virtual servers
US7162662B1 (en) System and method for fault-tolerant synchronization of replica updates for fixed persistent consistency point image consumption
Hutchinson et al. Logical vs. physical file system backup
US7937547B2 (en) System and method for high performance enterprise data protection
US7596713B2 (en) Fast backup storage and fast recovery of data (FBSRD)
US7610307B2 (en) Method and system of detecting file system namespace changes and restoring consistency
US20120016839A1 (en) De-Duplication Based Backup Of File Systems
US6799189B2 (en) System and method for creating a series of online snapshots for recovery purposes
US7877357B1 (en) Providing a simulated dynamic image of a file system
US8332689B2 (en) Systems, methods, and computer program products for instant recovery of image level backups
US20040260726A1 (en) DBMS backup without suspending updates and corresponding recovery using separately stored log and data files
US20070180304A1 (en) Mapping apparatus for backup and restoration of multi-generation recovered snapshots
US20060047720A1 (en) Database backup, refresh and cloning system and method
US20040002934A1 (en) System and method for providing requested file mapping information for a file on a storage device
US20130339303A1 (en) System and method for incrementally backing up out-of-band data
US20110307657A1 (en) Selective Processing of File System Objects for Image Level Backups
US20080104146A1 (en) System for automatically shadowing encrypted data and file directory structures for a plurality of network-connected computers using a network-attached memory with single instance storage
US20110161299A1 (en) Systems and methods for performing data management operations using snapshots
US20120151250A1 (en) Failure recovery method in information processing system and information processing system
US20100076932A1 (en) Image level copy or restore, such as image level restore without knowledge of data object metadata
US20060190505A1 (en) System and method for using a file system to automatically backup a file as a generational file
US20140372384A1 (en) Live restore for a data intelligent storage system
US20110106768A1 (en) Backup using metadata virtual hard drive and differential virtual hard drive
US7672979B1 (en) Backup and restore techniques using inconsistent state indicators

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
WD01