Enabling restoration of virtual machine when backup contains abnormal portions
A method for enhancing backup and recovery of a virtual machine, including receiving, in connection with a backup operation, a metadata database and a backup image of the virtual machine. The method also includes making a first determination, based on the metadata database, that a portion of the backup image includes an anomaly, rewriting, in response to the first determination, the portion of the backup image to obtain a modified backup image, storing rewrite details in the metadata database to obtain a modified metadata database, and, after the storing, receiving a request to initiate a recovery operation for a host, providing the modified backup image and the modified metadata database to the host, mounting, at the host, the modified backup image, and performing a recovery operation for the virtual machine on the host using the modified metadata database and the modified backup image.
1 . A method for enhancing backup and recovery of a virtual machine, comprising:
receiving, in connection with a backup operation, a metadata database and a backup image of the virtual machine;
making a first determination, based on the metadata database, that a portion of the backup image comprises an anomaly;
rewriting, in response to the first determination, the portion of the backup image to obtain a modified backup image;
storing rewrite details in the metadata database to obtain a modified metadata database;
after the storing:
receiving a request to initiate a recovery operation for a host;
providing the modified backup image and the modified metadata database to the host;
making a second determination that the modified backup image is not mountable;
in response to the second determination, creating and attaching a mountable wrapper for the modified backup image;
mounting, at the host and using the mountable wrapper, the modified backup image; and
performing a recovery operation for the virtual machine on the host using the modified metadata database and the modified backup image.
2 . The method of claim 1 , wherein the rewriting comprises:
rewriting the portion of the backup image with a pre-determined pattern of bits.
3 . The method of claim 2 , wherein the pre-determined pattern comprises a combination of 0 and 1 bits.
4 . The method of claim 2 , wherein the rewrite details comprise a start location of the portion of the backup image, an end location of the portion of the backup image, and the pre-determined pattern of bits.
5 . The method of claim 4 , wherein the rewrite details further comprise a type of the anomaly.
6 . The method of claim 4 , wherein performing the recovery operation comprises:
identifying the portion of the backup image in the modified backup image based on the rewrite details in the modified metadata database; and
skipping, based on the identifying, recovery of the portion of the backup image.
7 . The method of claim 1 , wherein the first determination comprises:
determining that the first portion of the backup image does not comprise file system data.
8 . A non-transitory computer readable medium (CRM) comprising computer readable program code, which when executed by a computer processor, enables the computer processor to perform a method for efficient backup and recovery of a virtual machine, the method comprising:
receiving, in connection with a backup operation, a metadata database and a backup image of the virtual machine;
making a first determination, based on the metadata database, that a portion of the backup image comprises an anomaly;
rewriting, in response to the first determination, the portion of the backup image to obtain a modified backup image;
storing rewrite details in the metadata database to obtain a modified metadata database;
receiving a request to initiate a recovery operation for a host;
providing the modified backup image and the modified metadata database to the host;
making a second determination that the modified backup image is not mountable;
in response to the second determination, creating and attaching a mountable wrapper for the modified backup image;
mounting, at the host and using the mountable wrapper, the modified backup image; and
performing a recovery operation for the virtual machine on the host using the modified metadata database and the modified backup image.
9 . The non-transitory CRM of claim 8 , wherein the rewriting comprises:
rewriting the portion of the backup image with a pre-determined pattern of bits.
10 . The non-transitory CRM of claim 8 , wherein the pre-determined pattern comprises a combination of 0 and 1 bits.
11 . The non-transitory CRM of claim 8 , wherein the rewrite details comprise a start location of the portion of the backup image, an end location of the portion of the backup image, and the pre-determined pattern of bits.
12 . The non-transitory CRM of claim 8 , wherein the rewrite details further comprise a type of the anomaly.
13 . The non-transitory CRM of claim 8 , wherein the first determination comprises:
determining that the first portion of the backup image does not comprise file system data.