Upgrading large installations of NextCloudThis week we upgraded some of our larger installations of ownCloud 18.104.22.168 to 22.214.171.124. In the past running the ownCloud update from the command line worked well for us:
sudo -u apache ./occ upgrade --skip-migration-testUnfortunately some of our installations now have 30GB of MariaDB data files. And running the installer will increase the size of MariaDB to >60GB and this is a little much for comfort. Looking into the database we found a number of tables with
oc_oc_prefix, they seem to be a left over from previous upgrades. So we removed those. Dumping and re-importing using mysqldump the database was still too large. Digging into the tables we found that over 90% of the storage was used in the
First we opted to just
TRUNCATE TABLE oc_filecache. Then the upgrade went well and MariaDB datafiles went to around 7GB (yes we removed the old data files). Unfortunately all shares (public links and between users) where no longer in the upgraded ownCloud. So we looked a bit more in the source code and found that the
oc_sharetable is inner joined with the
oc_filecachetable, this explained why the shares no longer showed up. So we decided to:
DELETE FROM oc_filecache WHERE oc_filecache.fileid NOT IN (SELECT oc_share.file_source FROM oc_share);That query took a little while:
But after the upgrade went smoothly and MariaDB datafiles are still very small compared to what they used to be. Unfortunately a re-download is triggered for users of the ownCloud sync app, but for this instance there where not many users affected, so we could accept that.
We hope the cache table does not need much changing in the future, as it seems quite difficult to upgrade large installations this way. Update: When migrating to Nextcloud 10/11 we found you can also speed up the upgrade process by running:
`TRUNCATE TABLE oc_file_locks`
Trackback from your site.