Where does Gnucash save it backup files when using mysql data source

AC gnucash at acarver.net
Sat Jul 4 20:18:17 EDT 2015


On 2015-07-04 16:59, L. D. James wrote:
> On 07/04/2015 07:11 PM, Dave H wrote:
>> I would have thought you'd probably have to look at backup options
>> within mysql itself for this ?
>>
>> Cheers Dave H.
>>
>>
>> On 5 July 2015 at 08:10, L. D. James <ljames at apollo3.com
>> <mailto:ljames at apollo3.com>> wrote:
>>
>>     I have found the backups of gnucash to be very invaluable.  In
>>     order to facilitate a client with their accounting (access from
>>     home and work) I'm exploring the mysql data feature.
>>
>>     I'm having problems locating where the backups are stored. Can
>>     someone help?
>>
>>     Thanks.
>>
> 
> Thanks Dave.  I understand how to back up my computer and all my date. 
> I've always known how to do this even when using the data files. 
> However, I find it very convenient that when actually using Gnucash, it
> actually backs up the data.  The data is backed-up when you use it.  If
> you don't open Gnucash for days or weeks it won't be backed up (by
> Gnucash).  The feature backs up the data when it's actually being used.
> 
> If I use it 10 times different in one day, it'll actually be backed up
> those 10 times.  Again, I find this extremely convenient.
> 
> I can backup the mysql data 10 or 20 times a day, but if it's only used
> once or twice on some days and not used on some days, that might be a
> lot of backing up.  Also if I only back up the mysql files once a day
> and it happens to get loaded and used 10 times that day, the
> functionality for reviewing the most recent change is gone.
> 
> I don't know if this has been considered by the developers, but it's
> something they might consider.
> 
> In the meantime, I'll write a routine for mine to regularly check the
> gnucash database for any changes or activity and back make a backed-up
> version when this happens.  I wouldn't consider it as efficient as the
> built-in backup facility of Gnucash itself, but it's something that
> might come in handy if something gets corrupted when it's being used.

Depending on the backup utility that you use, you don't need to worry
about whether the data has changed or how often you run the backup.

Most intelligent backup software uses differential backups rather than
outright images.  The first time you run the backup process (and usually
repeated after a certain number of backups or weeks depending on
configuration) the software will generate a full image of all the data.
 This would be the slowest part of the process along with the largest
storage consumption.  AFterwards, it performs a differential backup
copying only the portions that have changed (sometimes not even complete
files, just the changed blocks).  A differential backup is much faster
and smaller.  If nothing has changed, the backup will just make a note
of that and end.

In this regard, Gnucash's backup process for the XML file is actually
very inefficient since it does a total backup every time.  External
software is usually much better for this task anyway, since the Gnucash
backup is really a convenience rather than a fault tolerant backup method.

Backing up MySQL is a much more difficult process because it can't be
done when the database is open, so Gnucash can't do it on its own.  This
is a consequence of database engines and not specific to Gnucash.  You
have to either run an external backup only when Gnucash is closed (to
ensure all tables are flushed and unlocked) or you must configure
replication within the database engine to duplicate all transactions to
a secondary server (which is what large enterprise databases do).

To give you an idea of size and speed, I routinely back up a system that
currently has over 400 GB of data files on it (user data only, no
operating system files or program files).  The initial backup took
several days (this was over a network connection).  Some days no data is
generated, other days there's some new data.  On days when there is no
data generated, the backup takes about three minutes and uses 40
kilobytes of storage (a status file documenting the fact that nothing
has changed).  On days when data is generated, it takes no more than
about an hour depending on the volume of new data.

I do also backup a MySQL database but in that case it takes more work.
I have a replication server running to accept replication data and once
every few months I perform a full dump which will backup the structure
and data (this uses mysqldump).  The dump gives me a static snapshot in
time while the replication server gives me up to date backups.  I could
backup the MYD, MYI and frm files as part of a backup but the database
is always open and usually the resulting files are not useful because a
transaction in progress corrupted the file during the backup (write
during read).  Replication and mysqldump works better.  Backing up those
files only works when no application is accessing that database which
means closing Gnucash in this case.


More information about the gnucash-user mailing list