Difference between revisions of "Backup"

From GnuCash
Jump to: navigation, search
(Backup - moving FAQ questions not directly related to backup back to FAQ page)
(Related Files - cleaning up layout)
Line 28: Line 28:
 
[[Configuration Locations]] identifies the OS-dependent locations of all the different files, as well as their names.
 
[[Configuration Locations]] identifies the OS-dependent locations of all the different files, as well as their names.
  
Preferences you need also to save
+
Additional information you need to save includes ''general configuration'' data, ''preferences'' data, ''theming'' data, and ''online banking'' settings.
# Normal '''configuration''' data:
 
::* Gnucash 3.0 and newer: The contents of [[Configuration Locations#GNC_DATA_HOME|GNC_DATA_HOME]] and [[Configuration Locations#GNC_CONFIG_HOME|GNC_CONFIG_HOME]].
 
::* Gnucash 2.x and older:
 
:::;Linux and Windows: '''[[Configuration Locations#HOME|HOME]]\.gnucash''' - most of your preferences, adjusted report settings, column withs, window positions, ...
 
:::;MacOS: '''$HOME/Library/Application Support/Gnucash'''
 
  
# '''Preferences''' from <tt>Edit->Preferences</tt> (like [[#Q: I have deleted a gnucash file from my computer. How can I remove that file from the File menu's short list (MRU) as well ?|history]], sign reversals, auto save interval,...) are stored using GSettings (for gnucash 2.6 and newer) or GConf (for gnucash 2.4 and older).
+
:;General Configuration data
#*'''GSettings''' based settings ('''GnuCash 2.6''' and newer) - How to back these up depends on your platform:
+
::*Gnucash 3.0 and newer - The contents of [[Configuration Locations#GNC_DATA_HOME|GNC_DATA_HOME]] and [[Configuration Locations#GNC_CONFIG_HOME|GNC_CONFIG_HOME]].
#:*'''Linux and similar:''' GSettings uses dconf as backend. You can use the '''dconf''' tool to dump all the preferences:
+
::*Gnucash 2.x and older -
#::<code>dconf dump /org/gnucash/</code>
+
:::'''Linux and Windows''': [[Configuration Locations#HOME|HOME]]\.gnucash - most of your preferences, adjusted report settings, column withs, window positions, etc.
:#:*'''Windows:''' Gsettings uses the Windows registry as backend. You can make a backup of the ''HKEY_CURRENT_USER/Software/GSettings/org/gnucash/'' registry key using the <code>regedit</code> command ('''Registry Editor''').
+
:::'''MacOS''': HOME/Library/Application Support/Gnucash
:#:*'''MacOS:''' GSettings uses the system's native defaults. You can use the '''defaults''' tool to dump all the preferences:
 
:#::<code>defaults read --app Gnucash</code>
 
:#* '''GConf''' based settings ('''GnuCash 2.4''' and older):
 
:#:The GConf settings are stored in [[Configuration Locations#HOME|HOME]]/.gconf/apps/gnucash/
 
:# For ''Gnucash 3.0 and up'', if you made changes to the '''Gtk configuration''' (settings.ini or gtk.css) or have installed custom '''themes''' and/or icon themes you may want to back up the contents of the following directories as well: [[Configuration Locations#GTK_DATA_HOME|GTK_DATA_HOME]], [[Configuration Locations#GTK_CONFIG_HOME|GTK_CONFIG_HOME]], [[Configuration Locations#USER_CONFIG_HOME|USER_CONFIG_HOME]]/themes and [[Configuration Locations#USER_CONFIG_HOME|USER_CONFIG_HOME]]/icons. [[GTK3]] has more info on when these directories are used.
 
:
 
  
# Lastly if you are using [[AqBanking]] online banking
+
:;Preferences data
::*'''Linux and similar, and MacOS:'''
+
:Preferences from <tt>Edit->Preferences</tt> (like [[#Q: I have deleted a gnucash file from my computer. How can I remove that file from the File menu's short list (MRU) as well ?|history]], sign reversals, auto save interval, etc.) are stored using '''GSettings''' (for GnuCash 2.6 and newer) or '''GConf''' (for GnuCash 2.4 and older).
 +
::* For '''GSettings''' settings:
 +
:::*'''Linux and similar:''' GSettings uses dconf as backend. You can use the '''dconf''' tool to dump all the preferences:
 +
::::<code>dconf dump /org/gnucash/</code>
 +
:::*'''Windows:''' Gsettings uses the Windows registry as backend. You can make a backup of the ''HKEY_CURRENT_USER/Software/GSettings/org/gnucash/'' registry key using the <code>regedit</code> command ('''Registry Editor''').
 +
:::*'''MacOS:''' GSettings uses the system's native defaults. You can use the '''defaults''' tool to dump all the preferences:
 +
::::<code>defaults read --app Gnucash</code>
 +
::* '''GConf''' based settings ('''GnuCash 2.4''' and older):
 +
:::The GConf settings are stored in [[Configuration Locations#HOME|HOME]]/.gconf/apps/gnucash/
 +
 
 +
:;Theming Data
 +
: For ''Gnucash 3.0 and up'', if you made changes to the '''GTK configuration''' (settings.ini or gtk.css) or have installed custom '''themes''' and/or icon themes you may want to back up the contents of the following directories as well: [[Configuration Locations#GTK_DATA_HOME|GTK_DATA_HOME]], [[Configuration Locations#GTK_CONFIG_HOME|GTK_CONFIG_HOME]], [[Configuration Locations#USER_CONFIG_HOME|USER_CONFIG_HOME]]/themes and [[Configuration Locations#USER_CONFIG_HOME|USER_CONFIG_HOME]]/icons. [[GTK3]] has more info on when these directories are used.
 +
 
 +
:;Online Banking data
 +
:If you are using [[AqBanking]] online banking, the stored settings are placed in a specific folder.
 +
::*'''Linux and MacOS:'''  
 
:::'''[[Configuration Locations#HOME|HOME]]/.[aq]banking''' holds your online banking settings. In older versions it was named ''.banking'' but ''.aqbanking'' is the current name.
 
:::'''[[Configuration Locations#HOME|HOME]]/.[aq]banking''' holds your online banking settings. In older versions it was named ''.banking'' but ''.aqbanking'' is the current name.
 
::*'''Windows:'''
 
::*'''Windows:'''

Revision as of 16:51, 19 October 2018

Introduction

Backing up your GnuCash data is important to protect and secure your financial data from potential equipment failure or data corruption.

GnuCash does not directly provide back up services for this type of failure. Recovering data in the event of equipment failure depends on having a robust backup process that includes offsite storage of up-to-date copies of your data. You are strongly advised to implement such processes.

GnuCash Data Files

Determining what are the GnuCash data files depends on the type of backend used to store the book information.

  • If you're using the XML (default) backend, GnuCash makes local backups for you every time it saves your file. You must save your file (by clicking the Save button or using Autosave functionality in the preferences). It does this by renaming the previous version of the file with a date-time-stamp and a new .gnucash suffix. For example, if your data file is named MyAccounts.gnucash, one of the backups might be named MyAccounts.gnucash.20140131150812.gnucash.
  • With SQL backends, GnuCash saves changes to sql data stores automatically as you go. For this reason, there are no backup files for the SQL. Even though there are no automatic backup files generated when using SQLite backend, GnuCash will still generate .log files with changes. While it might possible to replay .log files on top of an sql book, this is not officially supported. One option, in case of data loss, would be to convert the sqlite book to xml and replay the transactions log on top of that and then re-save the file in SQLite. More info in the related bug.
  • If you're using the SQLite3 backend you should use a timed backup program to copy your account file in some way.
  • If you're using either the MySQL or Postgresql backend, you should perform backups on the database in accordance with the recommended best practices appropriate to the server. We're not competent to advise you about this beyond recommending that you make backups.

As noted above, it is strongly recommended that whatever backup plan you use includes a provision for offsite backups. A good option is one of the many cloud storage services like DropBox, Google Drive, or Carbonite. Those are just popular examples; there are dozens of such services, and we can make no recommendation of one over another.

There is a free 3rd party tool for creating GnuCash backups called BackupGnuCash. See Published_tools.

Related Files

Of course, you should save your actual data files, although it is up to you whether you save the backup and log files (.gnucash or .xac, .log). See #GnuCash data files, above, for more on the subject.

In addition to the actual data file, however, there are a number of files that store your preferences, user interface settings, and saved reports. It is advisable to back these resources up as well.

Configuration Locations identifies the OS-dependent locations of all the different files, as well as their names.

Additional information you need to save includes general configuration data, preferences data, theming data, and online banking settings.

General Configuration data
Linux and Windows: HOME\.gnucash - most of your preferences, adjusted report settings, column withs, window positions, etc.
MacOS: HOME/Library/Application Support/Gnucash
Preferences data
Preferences from Edit->Preferences (like history, sign reversals, auto save interval, etc.) are stored using GSettings (for GnuCash 2.6 and newer) or GConf (for GnuCash 2.4 and older).
  • For GSettings settings:
  • Linux and similar: GSettings uses dconf as backend. You can use the dconf tool to dump all the preferences:
dconf dump /org/gnucash/
  • Windows: Gsettings uses the Windows registry as backend. You can make a backup of the HKEY_CURRENT_USER/Software/GSettings/org/gnucash/ registry key using the regedit command (Registry Editor).
  • MacOS: GSettings uses the system's native defaults. You can use the defaults tool to dump all the preferences:
defaults read --app Gnucash
  • GConf based settings (GnuCash 2.4 and older):
The GConf settings are stored in HOME/.gconf/apps/gnucash/
Theming Data
For Gnucash 3.0 and up, if you made changes to the GTK configuration (settings.ini or gtk.css) or have installed custom themes and/or icon themes you may want to back up the contents of the following directories as well: GTK_DATA_HOME, GTK_CONFIG_HOME, USER_CONFIG_HOME/themes and USER_CONFIG_HOME/icons. GTK3 has more info on when these directories are used.
Online Banking data
If you are using AqBanking online banking, the stored settings are placed in a specific folder.
  • Linux and MacOS:
HOME/.[aq]banking holds your online banking settings. In older versions it was named .banking but .aqbanking is the current name.
  • Windows:
HOME/aqbanking

Restoring

Restoring a data file is simply a matter of removing the defective file and renaming one of the backup files to that, then starting Gnucash or using File>Open and selecting the file from the File Chooser.

To restore from an offsite backup, just copy the remote file back into the directory where the original is.