Following up with my last post about why the CDP MySQL Add-On is so important to getting a good backup of your MySQL database I have been asked a lot: “What good is the point-in-time snapshot anyways if it’s not good enough for MySQL? What about XYZ application?”
I think it’s hard to talk about volume snapshots without talking about who you are and what applications you use. If you are a database admin you have one view, a Linux server admin a different view, and a Windows server admin yet a third view.
You know you need some way to get a backup copy of open files as Windows enforces file locking and windows application typically lock files for reading. When you shop for backup software you are used to making sure it has some kind of support for backing up open files. Before MS Volume Shadow Copy you may have purchased expensive third party tools like OTM (open transaction manager) to solve this problem with your backups in the past.
You probably never thought much about snapshots or consistency of files during backup. On Linux the root user can read any file it wants and at any time regardless if the file is being written to or not. You can even read locked files. Basically you are not protected from yourself unlike Windows where file locking really locks files.
You know your database needs more than just a file copy when it comes to backup. You perform a scheduled database dump at a minimum, you likely purchase add-ons from your Windows/Linux file backup vendor that supports your database (e.g. R1Soft). You may even purchase a specialized commercial database backup tool made just for your database.
The CDP Agent performs an online point-in-time snapshot using the Microsoft Volume Shadow Copy Service (VSS).
Changes to the file system (writes to a file, new files, etc) that happen after the snapshot don’t appear in the backup.
On Windows we have the MS VSS Service which provides just about all the snapshot features you could ever want. (Linux really is lacking here). And while we love to hate VSS when it does not work… it is very powerful and credit is due here.
Any application that decided to support VSS can inform VSS that it should be informed when there is a backup operation so it can write un-saved changes in memory to disk. MS VSS calls this a VSS writer.
So the question to ask on Windows is: Does my application integrate with Microsoft VSS. Microsoft calls this a VSS Writer.
Linux has no Volume Shadow Copy Service and no snapshot support in the popular file systems (ext2/3/4, reiserfs, XFS, etc). To bring VSS type volume snapshots to the Linux world R1Soft developed a special device driver (kernel module) for Linux that can perform a point-in-time snapshot of any Linux block device. Now that’s not all the CDP Linux device driver does… it has some magic that perform asynchronous replication… making backup windows very short… that is another matter.
For the file system this means:
Changes to the file system (writes to a file, new files, etc) that happen after the snapshot don’t appear in the backup.
So the question to ask on Linux is: Is my application safe with or without just a point-in-time snapshot. And does my Linux application need special treatment during a backup.
No, tar, rsync, bacula, amanda and just about every other Linux backup application* besides R1Soft CDP are reading from files while other applications are writing to them. They are actually WORSE OFF. There is no point-in-time snapshot so you get a mix match of changes to the file system in your backup and there is no protection at all to backing up open files. If you use these utilities to backup Linux you are almost guaranteeing corrupt files! Sorry, the truth is ugly I know… best we are aware.
It depends on the application and how it does disk I/O and what is doing. Here is a summary of some popular applications that I have done the homework for you on:
Life is easy as most critical apps support VSS and MS did all the hard work.
| Application | VSS Integration | Safe with VSS Snapshot |
| Exchange | No | Safe w/ VSS |
| MS SQL Server | No | Safe w/ VSS |
| Oracle | No | Safe w/ VSS |
| MS Hyper-V | No | Safe w/ VSS |
| Sharepoint | No | Safe w/ VSS |
| MySQL | No | Needs special integration with backup application |
| PostgreSQL | No | Safe** |
R1Soft has made your life much better by giving you a point-in-time snapshot… life is still complicated because there is no VSS and few application developers take time to solve the consistent backup problem.
| Application | Safe with No snapshot? | Safe with only volume snapshot? |
| MySQL | No | Needs special LOCK AND FLUSH TABLES WITH READ LOCK query timed with snapshot |
| PostgreSQL | Safe** | Safe** |
| Sendmail / Postfix mail spool files | No | Safe*** |
| MS Hyper-V | No | Safe w/ VSS |
| Qmail Maildir style mail spool | No | Safe |
| Oracle | No | Needs special integration with backup application |
| Vim (text editor) | No (do you care?) | No (do you care?) |
| scp (network file copy) | No (do you care?) | No (do you care?) |
| NFS (network file system) Exports | No | Safe |
*Acronis True Image and Linux backup applications that use LVM to perform snapshots assuming all your data is on LVM Logical Volumes are also capable of performing point-in-time snapshots. Zamanda can use LVM snapshots and this is good if all your data lives on LVM and you set aside special snapshot storage ahead of time.
**PostgreSQL is safe to copy at any time because of the way its magnificent write journal works. See http://www.r1soft.com/linux-cdp/cdp-server-20/postgresql/ for more details.
***Postfix mail spool files in my opinion are safe with only a file system snapshot with the caveat that mail spool files may have partially written or deleted messages.
Leave a reply