Background technology
Intel Virtualization Technology refers to computing element and moves on virtual basis rather than on real basis.Intel Virtualization Technology can expand the capacity of hardware, simplifies the process that reconfigures of software.It is parallel that the Intel Virtualization Technology of CPU can single CPU be simulated many CPU, allows a platform to move a plurality of operating system simultaneously, and application program can move and be independent of each other in separate space, thereby significantly improve the work efficiency of computing machine.
Along with the more and more maturation of Intel Virtualization Technology, particularly prestige farsighted (vmware) company runs business big and strong, and has released a series of virtual relevant products, all well helps user to solve a series of difficult problems such as hardware resource waste, IT complex management.In addition, the virtual insurmountable difficult problem of current device that more can solve, for example DynamicHost migration, fast deletes data, unified desktop management, or even creates enterprise's the integration environment etc. of blue screen never.
Virtual, to user, bring under the offensive that can not keep out temptation, a lot of enterprises and some other organizational structure all starts or by application migration to virtual platform.So how protect expeditiously the production data on virtual platform, thereby make production data that destructive loss not occur when being subject to disaster, become another hot issue of following applying virtual.
Vmware self is also in the performance that constantly promotes virtual machine backup recovery.Vmware introduces the virtual store application programming interface (VADP for data protection; vStorage API for Data Protection); for providing the application programming interface (API, Application Programming Interface) of a standard of direct accesses virtual machine file, backup application gathers.If the choice for use VADP of backup tool manufacturer, so the variation piece tracer technique of VADP make virtual platform can follow the trail of Last Backup to complete after the data block that changes of virtual machine file, certainly this variation piece tracer technique will lose efficacy in some cases, now again virtual machine disk was done to incremental backup and will carry out overall backup.Based on VADP, virtual machine disk is backed up, by calling virtual disk research and development kit (VDDK, Virtual Disk Development Kit) API reads the binary content of virtual machine disk, there is not the function of resolving virtual machine disk, therefore can only select one of following two kinds of operations: or virtual machine disk is all backed up all sectors from the beginning to the end, according to the variation piece tracer technique of VADP, get the data block of the variation of virtual machine disk, then the corresponding data sector that changes piece of backup.
Therefore, will there are the following problems when virtual machine being backed up based on VADP: in the situation that finishing full backup and VADP and changing piece tracer technique and lost efficacy, doing incremental backup can all back up the data of all sectors of whole virtual disk get off, even the actual amount of data of virtual machine disk is very little, or even the situation of blank diskette.So not only can make the BACKUP TIME of virtual machine backup elongated, and virtual machine backs up the performance that can affect virtual platform itself for a long time, End-Customer also will, for a lot of useless data provide expensive storage medium, also affect contingent recovery duration in the future.
Summary of the invention
The application provides a kind of virtual machine Disk Backup method, can shorten, reduce to the resource occupation of virtual platform and for client and save a lot of storage spaces so that backup recovers the duration of window.
A kind of virtual machine Disk Backup method that the embodiment of the present application provides, comprising:
A, backup server are initiated backup to the virtual machine on virtual platform;
B, backup server and virtual platform communicate, and notice virtual platform is carried out snapshot operation to described virtual machine;
C, virtual platform are carried out after snapshot operation virtual machine, and the stamper of described virtual machine is resolved and obtained the distribution of disk real data sector, and virtual platform returns to disk real data sector to backup server and distributes;
D, backup server get each disk real data sector and distribute, and then corresponding sector data are backuped in media server.
Preferably, the backup that backup server is initiated the virtual machine on virtual platform is that backup completely or VADP change the incremental backup that piece is followed the trail of inefficacy.
Preferably, the stamper of described virtual machine is resolved and is obtained disk real data sector and distribute and to comprise:
Read first sector data of the stamper of described virtual machine;
Whether the stamper that judges virtual machine according to the magic number in described first sector data is effective, if so, according to the system overhead field in described first sector data, determines position, master boot sector;
According to the partition list of stamper and the file system of each subregion of described master boot sector position acquisition virtual machine;
Real data sector according to the acquisition of information of each subregion to subregion distributes.
Preferably, described corresponding sector data is backuped in media server is:
Virtual disk research and development kit VDDK API by the virtual store application programming interface VADP for data protection backups to media server by corresponding sector data.
As can be seen from the above technical solutions, before backup, resolve and obtain the distribution of disk real data sector, and accordingly real data is backed up, thereby improve backup efficiency, and reduce, in backup procedure, the internal memory of virtual platform, network, the I/O read-write consumption of resource and the internal memory of backup server, network, I/O are read and write to resource consumption, and save the storage space of media server.In addition, because backup data quantity diminishes, when needs recover data, the duration of recovery just shortens so, helps user to improve the RTO of recovery.
Embodiment
Although that the type of virtual machine disk has is multiple, but it is identical having a bit, and that is exactly that the information that whole disk structure is relevant can be recorded in the first sector of each virtual machine disk file.Table 1 shows the description of each field of data structure body of first sector of a kind of virtual machine disk:
Data name |
Length or type |
Describe |
MagicNumber |
4 bytes |
Evil spirit number, represents that whether this virtual machine disk is effective, and " KDMV " is effective |
Version |
4 bytes |
Version number |
Flags |
4 bytes |
Zone bit, whether sign has redundancy granularity table, the information such as whether compresses |
Capacity |
8 bytes |
The capacity of virtual machine disk file, take sector as unit |
grainSize |
8 bytes |
The size of each granularity, take sector as unit |
DescriptorOffset |
8 bytes |
The initial sector of embedded disk descriptor |
DescriptorSize |
8 bytes |
The size of descriptor |
NumGTEsPerGT |
4 bytes |
Each granularity table has how many granularity entities |
RgdOffset |
8 bytes |
The initial sector of redundancy granularity catalogue |
gdOffset |
8 bytes |
The initial sector of granularity catalogue |
overHead |
8 bytes |
The initial sector of data |
uncleanShutdown |
1 byte |
Be used for arranging file and whether normally exited last time, normally exit and be set to false, otherwise be true |
singleEndLineChar |
Character |
Whether be used for authenticating documents has extremely in the transmitting procedure of ftp |
nonEndLineChar |
Character |
? |
DoubleEndLineChar1 |
Character |
? |
DoubleEndLineChar2 |
Character |
? |
CompressAlgorithm |
2 bytes |
For judging whether each grain of virtual machine disk compresses |
Pad |
? |
Filler |
Wherein, the magic number (MagicNumber) of 4 byte representation virtual machine disks of first sector beginning, whether evil spirit number is effective for judging virtual machine disk, and general value represents it is an effective virtual machine disk for " KMDV ", otherwise is an invalid virtual machine disk.The system overhead field (overHead) of 64th~72 bytes of first sector, what record is the position of the initial data sector of virtual machine disk, according to the value in these 8 bytes, can determine the position of virtual machine disk initial data sector, get this value and just can as resolving common hard disc file, to the content of virtual machine disk, resolve later.
The application's scheme, by resolving the form of virtual machine disk, can judge whether current virtual machine disk is an effective virtual disk, if this virtual disk is an effective virtual disk.Just can correctly get all subregion situations of this disk, and the sector auxiliary information that distributes of the file system type of each subregion and this subregion real data etc.
The storage organization of virtual machine disk is the same with the structure of file system of the same race on true hard disk.When resolving the filesystem information on true hard disk, point of penetration is Main Boot Record district (MBR), the location determining method of the MBR of virtual machine disk is so: read 64th~72 byte overHead fields of first sector of vmdk file, can navigate to the position of the MBR of virtual machine disk by the value of overHead field.MBR is totally 512 bytes, last 64 bytes are hard disk partition table (Disk Partition Table, DPT), and the byte of skew 0x04 is the file system type of this subregion, 4 sector numbers that byte has been used for this subregion that skew 0x08 rises, last 4 total bytes that byte is this sector.Get after the partition table information of DISK to Image, just can know the position, initial sector of each subregion and finish sector position and this partitioned file system type (a subregion list item accounts for 16 bytes, the content of the 1st byte is the guiding sign of subregion, represents whether this subregion is boot partition; 2nd~4 bytes represent initial magnetic head, sector, the cylinder of subregion, can obtain the position, initial sector of subregion according to the value of these three bytes; The 5th byte represents divisional type, for example, 07 represent NTFS subregion; 6th~8 represent end magnetic head, sector, the cylinder of subregion, just can obtain the end sector position of subregion according to these three values).Then according to the different file type of subregion, the file system of this subregion is resolved, can parse the sector position (sector position of resolving the All Files place of various file system is very proven technique, is no longer described in detail) at all file places of this partitioned file system the inside.So just can obtain descriptor on virtual machine disk and the concrete sector position at All Files place.
A kind of virtual machine Disk Backup method flow that the application provides as shown in Figure 1, comprising:
Step 101: backup server is initiated backup to some virtual machine on virtual platform.
If this type of backup is to back up completely or VADP changes piece and follows the trail of the incremental backup losing efficacy, continue execution step 102.If other situations, i.e. VADP variation piece is followed the trail of effective incremental backup, according to incremental backup method of the prior art, carries out follow-up backup-step.
Step 102: virtual platform is carried out snapshot operation to the virtual machine that will back up.
While creating snapshot, can be for each disk of virtual machine a newly-built sub-disk, and that original disk is exactly stamper with respect to snapshot dish.
Step 103: virtual platform is carried out after snapshot operation virtual machine, resolves and obtains the distribution of disk real data sector the stamper of described virtual machine, and virtual platform returns to disk real data sector to backup server and distributes.
Preferably, this step specifically comprises:
Read first sector data of the stamper of described virtual machine;
Whether the stamper that judges virtual machine according to the magic number in described first sector data is effective, if so, according to the system overhead field in described first sector data, determines position, master boot sector;
According to the partition list of stamper and the file system of each subregion of described master boot sector position acquisition virtual machine;
Real data sector according to the acquisition of information of each subregion to subregion distributes.
Step 104: backup server gets each disk real data sector and distributes, and then corresponding sector data is backuped in media server.
VDDK API provides the interface that reads vmdk disk sector, as long as those sectors of telling this interface will read vmdk disk are just passable, by this interface, just can directly get the data message of corresponding sector.
For making know-why, feature and the technique effect of present techniques scheme clearer, below in conjunction with specific embodiment, present techniques scheme is described in detail.
Fig. 2, for the virtual machine Disk Backup realization flow that the embodiment of the present application provides, comprises the steps:
Step 201: select a virtual machine A on virtual platform.
This virtual machine A has two disk disk1 and disk2, and disk1 and disk2 Disk Quotas size are all 100GB, and disk1 is that system disk actual amount of data is 20GB, and disk2 is that application data dish actual amount of data is 40GB.
Step 202: backup server is initiated backup to virtual platform, notice virtual platform is carried out snapshot to virtual machine A.
Step 203: backup server judges whether current type of backup is to back up completely, or VADP changes the incremental backup that piece tracking technique lost efficacy, if so, continuation execution step 204.
Step 204: backup server is resolved female disk of virtual machine A, gets quantity and the position of the real data sector of disk1 and disk2, and result is returned to backup server.
Step 205: after backup server gets the sector auxiliary information of these disks, the VDDK API by VADP reads out corresponding sector data, backups in media server.
Step 206: after having backed up, backup server confirms that this backup data quantity size is 60GB.
Present techniques scheme can be achieved as follows useful technique effect:
1, in virtual machine Disk Backup process, only need the size of backup virtual machine disk actual amount of data, will improve backup efficiency.
2, owing to only needing the size of the actual amount of data of backup virtual machine disk, total backup data volume can reduce relatively, and the internal memory, network, the I/O read-write resource that in backup procedure, consume so virtual platform just reduce.
3, the data volume due to backup diminishes, and the internal memory of backup server, network, I/O read-write resource consumption also can reduce so, are apparent that the data volume of media server storage reduces most, for user saves more storage space.
4, because backup data quantity diminishes, when needs recover data, the duration of recovery just shortens so, helps user to improve target release time (RTO, Recovery Time Objective) of recovery.
The foregoing is only the application's preferred embodiment; not in order to limit the application's protection domain; all within the spirit and principle of present techniques scheme, any modification of making, be equal to replacement, improvement etc., within all should being included in the scope of the application's protection.