Wiki source code of Back Up an XWiki Instance

Last modified by Eleni Cojocariu on 2026/08/20 10:08

Show last authors
1 To copy everything an XWiki instance holds into a backup you can [[restore>>doc:documentation.xs.admin.backup.restore-instance.WebHome]] later, part by part as [[Backup and Restore>>doc:documentation.xs.admin.backup.WebHome]] lists them:
2
3 1. Stop the [[servlet container>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.configure-servlet-container.WebHome]], so that the files are copied in a consistent state.
4 1. Dump the database with [[the command of your database>>doc:documentation.xs.admin.backup.database-commands.WebHome]], and compress the dump.
5 1. Copy the [[permanent directory>>doc:documentation.xs.admin.configuration.directories.permanent-directory.WebHome]], whose location you can [[read from the instance>>doc:documentation.xs.admin.configuration.directories.permanent-directory.find-permanent-directory.WebHome]]:(((
6 {{code language="bash"}}
7 tar -C /var/lib/xwiki -czf permanent-directory.tar.gz --exclude=cache data
8 {{/code}}
9
10 Leaving out the ##cache## [[sub-directory>>doc:documentation.xs.admin.configuration.directories.permanent-directory.sub-directories.WebHome]] keeps the archive small, at the price of a slower first start after the restore.
11 )))
12 1. Copy the [[configuration files>>doc:documentation.xs.admin.configuration.WebHome]] of the web application, the part of it that XWiki does not reinstall as it was shipped:(((
13 {{code language="bash"}}
14 tar -C /usr/lib/xwiki -czf configuration.tar.gz \
15 WEB-INF/hibernate.cfg.xml \
16 WEB-INF/xwiki.cfg \
17 WEB-INF/xwiki.properties \
18 WEB-INF/classes/logback.xml \
19 WEB-INF/observation
20 {{/code}}
21 )))
22 1. Copy whatever else you added around the wiki: the JDBC driver and any other jar in ##WEB-INF/lib##, any skin under ##skins##, and the servlet container's own configuration and TLS keystore if you changed them. Archiving the whole web application directory is the way not to forget one of them.
23 1. Copy the log files, if you want to be able to read afterwards what the instance was doing. They go wherever the [[logging configuration>>xwiki:Documentation.AdminGuide.Logging]] sends them, by default the console output of the servlet container.
24 1. Start the servlet container again.
25 1. Check that the backup holds one file per part:(((
26 {{code language="none"}}
27 $ ls -1 /srv/backup/xwiki/2026-08-19/
28 configuration.tar.gz
29 database.sql.gz
30 permanent-directory.tar.gz
31 webapp.tar.gz
32 {{/code}}
33 )))

Get Connected