ownCloud + Nextcloud migration script for v6.0 update

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
User avatar
Posts: 208
Joined: Sat Nov 18, 2017 5:21 pm

ownCloud + Nextcloud migration script for v6.0 update

Post by MichaIng » Sun Jan 28, 2018 7:09 pm

Hi there,

as DietPi v6.0 was just released and we decided to not allow direct updating due to heavy internal changes, I wrote a small migration script, that allows easier transfer of your ownCloud and/or Nextcloud instance.
It includes:
- Backup of database into datadir (to preserve your settings and apps data)
- Backup of installation into datadir (to guarantee compatibility of installation version and database, in case of e.g. manual beta update, and preserve manually installed apps)
- Optional moving of datadir to an external USB stick or whatever you want to use to transfer it to the new server/updated DietPi system.

1. Download: wget https://raw.githubusercontent.com/Fourd ... -migration
2. Allow script execution: chmod +x dietpi-cloud-migration
3. Execute the script: ./dietpi-cloud-migration /mnt/<external_whatever>/nextcloud_data The path/argument is optional, if not given, you would need to manually move your ownCloud/Nextcloud datadir to the desired backup location after script execution.
4. Carefully watch the scripts output. It should notify you about errors, however, I can't give a guarantee of course.
5. Check the backup made, there should be your whole datadir with additional dietpi-..cloud-database-backup.sql (database backup) and dietpi-..cloud-installation-backup/ (cloud installation folder backup) inside.
6. If you are sure, everything went well, you can umount/plug-off the backup drive/stick/card and play the fresh v6.0 image onto your machine.
7. After successful first run of the new system. Plug+mount the backup drive again. Copy/rsync the backup datadir to your desired location, where you finally want it. By default this is /mnt/dietpi_userdata/nextcloud_data respectively .../owncloud_data. You can move the whole DietPi userdata via dietpi-software, the mnt location will remain the same. If you want your ownCloud/Nextcloud datadir outside of dietpi_userdata, you can adjust this via dietpi.txt by SOFTWARE_OWNCLOUD_DATADIR respectively SOFTWARE_NEXTCLOUD_DATADIR value.
8. At last just install ownCloud/Nextcloud via dietpi-software. The installation should automatically recognize the existing datadir and the backups inside and will recover them for you. If everything went well, then you should be able to access your cloud instance, if nothing happened, besides some tweaks, we made in between: E.g. see your URL appearing without /index.php/ now, if Apache is used, and some other background optimizations.

I tested the script up and down on my testing system, however, as always can't guarantee, everything is working fine on your machine. So as always, if it's about backing up sensible/important/personal data, be careful and recheck everything, to be sure that everything is there. The migration script, as well as ownCloud/Nextcloud installation/uninstallation does not touch the datadir. So if anything goes wrong, you should find your data still in place.

User avatar
Site Admin
Posts: 2744
Joined: Tue Feb 06, 2007 12:36 pm

Re: ownCloud + Nextcloud migration script for v6.0 update

Post by Fourdee » Sun Jan 28, 2018 7:17 pm

Legend, many thanks for doing this :)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal and Bitcoin.

User avatar
Posts: 254
Joined: Thu Jul 20, 2017 7:55 am

Re: ownCloud + Nextcloud migration script for v6.0 update

Post by WarHawk » Mon Jan 29, 2018 5:47 am

Awesome!!! Thanks!

Post Reply