Skip to content

Script for migrating Nextcloud primary storage from S3 to local storage

License

Notifications You must be signed in to change notification settings

arawa/nextcloud-s3-to-disk-migration

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nextcloud S3 to local storage migration script ☁️ 💾

At the time of writing this script using S3 based primary storage in Nextcloud does not work very well. Still you might have configured your Nextcloud to use S3 based primary storage as indicated here. But what if you want to switch to local primary storage?

Officially it is not supported to change the primary storage in Nextcloud. However, it's very well possible and this unofficial script helps you in doing so. It will transfer files from S3 based primary storage to a local primary storage.

⚠️ This script was written in a rather quick & dirty way. It may fail and lead to data loss. Use at your own risk! ⚠️

Links

Related topics on the Nextcloud community are:

How to

Just follow the steps below:

  1. Run composer install to obtain some dependencies.
  2. Make sure that the Nextcloud cron job is disabled.
  3. Make sure that you local data is sufficiently large.
  4. Setup the three path variables at the top of the transfer.php file.
  5. Then just run the transfer.php file from the command line. Make sure to run the script as the system user that is normally used for running Nextcloud to avoid permission errors and maybe increase the memory limit to avoid nasty errors (e.g. execute sudo -u nextclouduser php -d memory_limit=1024M transfer.php). That's it! 🏁

Cleanup

If everything worked you might want to delete the backup folder and S3 instance manually. Also you probably want to delete this script after running it.

Notes

This script was tested successfully on Ubuntu 18.04 using a Maria SQL database and DigitalOcean Spaces as S3 object storage. The Nextcloud version was 17. Please make sure to review the script carefully before you run it to avoid any issues. Consider it as a prototype and not a finished tool.

Contributing

If you find this script useful and you make some modifications please consider making a pull request so that others can benefit from it. This would be highly appreciated!

License

This script is open-sourced software licensed under the MIT license. Please see LICENSE for details.

About

Script for migrating Nextcloud primary storage from S3 to local storage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%