My Owncloud and Selfoss servers at home have become a central service for me over the past year and I have taken care that I can cut-over my services to an alternative access remotely should the DSL line or DSL router fail. For the details see here and here. While I'm pretty well covered for line failures I'd still be dead in the water if the server itself would fail. Agreed, this is unlikely but not unheard of, so I decided to work on a backup strategy for such a scenario as well.
What I need is not only the data that I could restore on a backup server but that backup server must be up and running so that I can quickly turn it into the main server even while not at home should it become necessary. As it's a backup server and slow service is better than no service it doesn't have to be very powerful. Therefore, I decided to use a Raspberry Pi for the purpose on which I've installed Owncloud and Selfoss. Getting the data over from the active servers is actually simpler than I thought by using tar:
To create a copy I think its prudent to halt the web server before creating a copy of the Owncloud data directory as follows:
sudo service apache2 stop
sudo tar cvzf 2014-xx-xx-oc-backup.tar .
sudo service apache2 restart
This creates a complete copy of all data of all users. The tar file can become almost as big as all data stored on Owncloud so there must be as much free disk space left on the server as there is data stored in the Owncloud data folder.
In the second step, the tar archive is copied to the target machine. Scp or sftp do a good job. Once the file has been copied, the tar file should be deleted on the server to free up space.
On the target machine, I stop the web server as well, delete the the owncloud data directory and then unpack the tar archive:
sudo service apache2 stop
sudo rm -rf owncloud-data
sudo mkdir owncloud-data
tar xvzf /path-to-tar/2014-xx-xx-oc-backup.tar
sudo chown -R www-data:www-data /media/oc/owncloud-data
sudo service apache2 start
And once that is done the backup Owncloud instance runs with the calendar, address book and file data of the standard server.
One important thing to keep in mind when setting this up for the first time is to copy and paste the password salt value from /var/www/owncloud/config/config.php over to the backup server as well as otherwise it's not possible to log into the backup Owncloud instance. And finally, have a close look in the same configuration file on the backup server if the 'trusted domains' parameters match your requirements. For details have a look at the end of this page.
The same principle also works for getting a working copy of the Selfoss RSS server.