How to backup your owncloud installation (data, database, and configuration)


#1

First of all: This is no official manual.
Myself is just happily using owncloud and this way I like to contribute to this project.

Please read it carefully.

Config file
Go to config folder and copy config.php
Rename copied file and add version information e.g. config-4.0.7

Database
MySQL
Use your favorite admin tool to export your database. Mine is phpMyAdmin.

Better idea is to have daily backups of your database.
Do you have shell access? If so would recommend a shell script like http://sourceforge.net/projects/automysqlbackup/

Sqlite
Never used it. Can somebody provide some information? I will add it. Thx.

PostgreSQL

pg_dump owncloud -f backup.sql
tar cjf backup.sql.tar.bz2 backup.sql

The first command makes a full backup of the database "owncloud" including data scheme and actual data in sql-form. To restore it, enter

psql -d owncloud -f backup.sql

The second command is optional and compresses the file. Since it's pure ascii, it should compress quite well.

Files
Copy whole data folder.
There are many ways to do that. It depends on access mode.
Using ssh you can directly create tar and compress it. Result is one nice *.tar.gz file.
Using ftp you have to backup full directory and store it locally. Compressing can be done using your favorite archiving tool.
Another idea using ftp is to mirror full data folder using wget. Steps will follow if requested.

:!: Please upgrade only after taking care of config file, database and files.
This way there is always a way back if something bad happens.

Please let me know your comments, ideas and critics.


#2