1

I'm considering doing image based backups (Acronis) on production Windows systems during non-peak hours. I'm just wondering if they can potentially lead to application data corruption. Lets say that I have a database that is getting hit pretty hard. Could I potentially have the beginning blocks of the database be commit ed to the image, data inserted into the db (which changes the beginning blocks of the DB on the server but not the image), then the blocks of data committed to the image (leading to an inconsistent state).

Here's an example of what I'm trying to illustrate. Imagine a simple data structure which has a number in the front which represents the number of "a"s in a file. The number and data are delimited by a "-". For example:

 4-ajjjjjjjajuuuuuuuaoffffa

If an "a" is changed, the datastructure resets the number in the begining of the file such as:

 3-ajjjjjjjajuuuuuuuboffffa

I assume acronis writes block by block being a straight up image so here is what i'm invisioning happening with my database

 t0: 4-ajjjjjjjajuuuuuuuaoffffa
     ^pointer is here
 t1: 4-ajjjjjjjajuuuuuuuaoffffa
               ^pointer is here (all data before this is comitted to the image)
 t2: 4-ajjjjjjjajuuuuuuuboffffa
                 ^pointer is here (all data before this is comitted to the image)
     Also notice how one of the "a"s change to a b.  There are only 3 "a"s now
 t3: 4-ajjjjjjjajuuuuuuuboffffa
                               ^pointer is here (all data before this is comitted to the image)

The final image now reads "4-ajjjjjjjajuuuuuuuboffffa", while the true data is "3-ajjjjjjjajuuuuuuuboffffa" leading to a corrupt "database".

Basically changes further down the blockchain could be reflected in the image, while important header and synchronization could already be committed. The out of date header information doesn't accurately reflect the structure of the blocks to come.

ServerAdminGuy45
  • 371
  • 1
  • 3
  • 3

1 Answers1

7

What happens here is for acronis and almost all backup software is the use of the volume shadow service. Various applications like SQL and exchange server have their own VSS writer as well.

http://blog.macrium.com/2012/11/backup-internals-what-is-vss-how-does-it-work-and-why-do-we-use-it/ has a pretty good overview of how it works.

Basically acronis will tell windows do create a snapshot. From then on when a program changes a file the original data is saved to shadow storage. When acronis gets to that part of the file vss gives it the original version from the shadow storage instead of the updated one all the regular programs see.

When it all works properly you end up with a copy of exactly what you would have gotten if you pulled the plug on the server and did the backup offline. VSS aware applications like SQL get a chance before the snapshot is created to save anything that needs saving to help avoid inconsistent data. Other programs could have corrupt data in the backup if they were right in the middle of writing a file, but since the snapshot happens quickly that is rare, and no worse than if power was lost and the server rebooted.

Grant
  • 17,671
  • 14
  • 69
  • 101
  • Thanks. So since Acronis, Ghost, and Plain old WBS use VSS I should be able to rely on them to backup applications such as SQL, even if busy without the need to instantiate a true "SQL backup". I assume only MS apps are VSS aware. I wonder if this pertains to all "random applications" – ServerAdminGuy45 Oct 24 '13 at 03:36
  • Most database software on windows is vss aware (MS SQL server certainly is)and will put their files in a consistent state just before the snapshotting starts. If you have other programs that are constantly writing and not vss aware its best to stop them before the snapshot. Most backup programs let you run a script before and after creating the snapshot so you can shutdown such services and start them again a moment later. But since programs have to deal with the same issues on power loss most handle it without any special precautions. – Grant Oct 24 '13 at 03:42
  • So you would trust an image only solution from a reliability perspective. Thanks for the info – ServerAdminGuy45 Oct 24 '13 at 04:04
  • Yes. But like any other backup you need to test restoring them once In awhile. – Grant Oct 24 '13 at 11:28