[PVE-User] Backup in snapshot mode with running sortware

Adam Thompson athompso at athompso.net
Mon Jul 28 21:48:52 CEST 2014

On 14-07-28 01:22 PM, Gilberto Nunes wrote:
> In other words, nothing to be so concerned, at all...

I wouldn't go *quite* that far.

It *should* work, but make sure you do backups the regular way (i.e. 
mysqldump, an agent or some sort, or shut down the database first) until 
you've proven that snapshots are adequate for your situation, i.e. don't 
rely on them until you've confirmed they work for your exact scenario.

Worst-case: MySQL writes to the DB every second, you've turned off 
transactional guarantees (i.e. set MySQL to cache writes for ~10sec, 
mounted ext3 "nobarrier, data=writeback") to increase performance. You 
take a disk-level snapshot at *exactly* the wrong instant, as MySQL is 
expanding a file, or as ext3 is writing a dirent to disk ahead of the 
data, or something like that, and you could lose access to the entire 
database if you're very, very unlucky.

You CAN experience data loss with snapshots if you get very unlucky and 
the deck is stacked against you.
If you have not done anything strange with mount options, and ext3 is 
able to use barriers (check your dmesg!!!) inside the VM, and MySQL is 
flush()ing data correctly, and everything else works correctly, then 
snapshots are fine.

I'm not saying don't use snapshots, I'm saying "trust, but verify" so 
you don't get burned later on when a critical snapshot turns out to be 

(FWIW: somewhat counter-intuitively, Oracle and Sybase seem to be much 
more vulnerable to this sort of problem than MySQL or PgSQL, at least in 
my experience.)

-Adam Thompson
  athompso at athompso.net

More information about the pve-user mailing list