-1

I want to do a Bare Metal Backup of my server but I'm concerned about opened files.

My server contains many SQLite databases, and SQLite daemons are active 24/7/365. As I know, you cannot backup a SQLite database, while the daemon is active, by simply copying files, otherwise the backup will be corrupted.

I know some Bare Metal backup tools offer specific agents for some types of files, but no one offer agents for SQLite.

How the Bare Metal backup deals with opened files and with write cache?

Marco Marsala
  • 471
  • 3
  • 7
  • 14

1 Answers1

1

There is a SQLite backup API available for command line scripting. Previously, backup scripts tended to get locks preventing writes while doing their copy.

Being able to snapshot the storage, either LVM or otherwise, also helps. Suspend writes long enough to take a snap, then copy off the no longer changing snap at your convenience.

This pattern is not unique to SQLite or bare metal. Quite a few kinds of databases should be quiesced while you take online backups.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32
  • I know, but if I'm doing bare metal backups of an hosting server, where I wouldn't know what users stored in it? I looked at tools like Bacula or Amanda, they allow BMR with few clicks... But I will be sure that restored backups won't be corrupted? Also when writings are suspended, I cannot be sure the database is in a consistent state. For example if a long writing is suspended in the middle. Btw, these tools automatically suspend writes? – Marco Marsala Nov 14 '15 at 23:08
  • You can only be sure when you do a restore test and verify that databases have good integrity. The backup API and the transaction lock trick are designed so the database is consistent. LVM snapshots will get a consistent file which often works fine, but are not aware of how to suspend the database. Up to you how careful you want to be with your data. – John Mahowald Nov 14 '15 at 23:35
  • I did it and some resulting files were corrupted. Also I do an incremental Bare Metal Backup every 24h because server content change often How I can do a Bare Metal backup I can trust on it? – Marco Marsala Nov 15 '15 at 09:54
  • Then you (or your users) need to suspend writes with the backup API, the write lock trick, or shut down applications. None of these provide an incremental at the database level. I suggest getting good full backups of databases before figuring out how to save space with incremental or deduplication. – John Mahowald Nov 16 '15 at 00:17
  • Yes I know the incremental backup of database is not supported, and it isn't a requirement. Suspending writes with the backup API seems a good idea. Do you know is a backup program that automatically uses the backup API in every SQLite file it finds? Many backup tools offer agents for many file types, but no one for SQLite. Do you know other programs? – Marco Marsala Nov 16 '15 at 06:55
  • I do not know of backup agents that are as automatic as you would like. Consider asking the author of your favorite backup software what it would take to hire them to write a plugin. – John Mahowald Nov 16 '15 at 14:49
  • So, actually doesn't exist a commerciale bare metal solution for Linux that simply works? – Marco Marsala Nov 16 '15 at 19:58