I’ve been mingling with ownCloud for about a year now. We copy the ownCloud data over to an external USB Drive mounted on the system before we run any backups or updates on the system. I have 2 folders on my USB drive, note them in the commands below. Also my folder locations may be different than your setup. You also need to know your mySQL root password to complete the mySQL dump.
My current system is as follows
Ubuntu 14.04 Server
Mounted 4TB external USB Drive
To backup an ownCloud installation there are three main things you need to retain:
- The config folder
- The data folder
- The database
Put ownCloud into Maintenance mode:
Turn Maintenance mode on
sudo -u www-data php occ maintenance:mode –on
Simply copy your config and data folder (or even your whole ownCloud install and data folder) to a place outside of your ownCloud environment.
You could use this command:
sudo rsync -Aax owncloud/ /media/usb/ownCloud_Backups/owncloud-dirbkp_`date +”%Y%m%d”`/
MySQL is the recommended database engine. To backup MySQL:
sudo mysqldump –lock-tables -u root -p owncloud > /media/usb/ownCloud_mySQL_Dumps/owncloud-sqlbkp_`date +”%Y%m%d”`.bak
As you run the backup, there is no response from CLI, so it may take awhile to complete. Ours takes approx 4hrs @ 300gb of data.
When your backup is complete.
Turn Maintenance mode off
sudo -u www-data php occ maintenance:mode –off