Nextcloud snap: how to use nextcloud.export when data is on external drive?

Hi [carlier74] as your data folder is on an external storage you need to back up your settings so if you happen to have an error in your snap installation you can easily restore the settings and the files remain unchanged on your external storage

In my scenario I follow the following script

  1. ->> Remove the Default Backups Directory.

rm -rf /var/snap/nextcloud/common/backups

2 ->> I create a folder called Backups on the external drive where the nextcloud data folder is.

mkdir /mnt/Nextcloud/Backups

  1. ->> I create a symbolic link pointing to the folder that was created in the previous step.

ln -s /mnt/Nextcloud/Backups /var/snap/nextcloud/common/backups

  1. ->> I export the Settings

nextcloud.export -abc

5 Backup the drive with Borg or rsync

Restoration

  1. ->> install snap

sudo snap install nextcloud

  1. ->> Remove the default backups directory

rm -rf /var/snap/nextcloud/common/backups

  1. ->> Symbolic link to the backups folder on the external storage

ln -s /mnt/Nextcloud/Backups /var/snap/nextcloud/common/backups

  1. ->> Restore Settings

nextcloud.import -abc /var/snap/nextcloud/common/backups/20221002-1200

  1. ->> Activate the option for snap to recognize external storage media.

sudo snap connect nextcloud:removable-media

Ready!! Your nextcloud instance will already be restored

2 Likes