Snap installation with backup recovery

I had installed nextcloud with snap installed nextcloud and made a daily backup with rsnapshot.

I backed following folders:

  • /snap/nextcloud/current
  • /var/snap/nextcloud/current
  • /var/snap/nextcloud/common

After a crash I had installed nextcloud again, but now is the question, how can I restore the backup?
I tried to copy the backup files with

rsync -avr /bak/snap/nextcloud/current /snap/nextcloud/<number to the symlink>
rsync -avr /bak/var/snap/nextcloud/current/ /var/snap/nextcloud/<number to the symlink>
rsync -avr /bak/var/snap/nextcloud/common/ /var/snap/nextcloud/common

During rsync some files are read-only and can’t overwrite.

Do somebody now, how I can recovery nextcloud with my backup files?


Not sure, dont use snap myself, but if not root already, could try with sudo

sudo rsync …

Hello OliverV,

thanks for your answer.
Same issue with sudo rsync. I tested it already, but it doesn’t work.

/snap/nextcloud/current/ is the snap itself, it’s read-only by definition (sudo won’t help). Thankfully, since it’s read-only you didn’t need to back it up or restore it in the first place. You got the important directories (/var/snap/nextcloud/{common,current}), did restoring those help?

In the future, note that the snap includes import/export functionalities via sudo nextcloud.import and sudo nextcloud.export, respectively.

I tried it a again

  1. sudo snap remove nextcloud
  2. sudo snap install nextcloud
  3. sudo rsync -avr /backup/nextcloud/var/snap/nextcloud/current/ /var/snap/nextcloud/15916/
  4. sudo rsync -avr /backup/nextcloud/var/snap/nextcloud/common/ /var/snap/nextcloud/common/

But with the same results. When I log into the webui I can see the folder and images but the calender and tasks are missing :pensive:

Is there a way to get also the calender and tasks?

Where are the calendar and tasks are stored? I also can’t find them in the backup folders… :flushed:

I restored everything now and I’m on track again :grinning:
My new backup routine is that I daily start the sudo nextcloud.export and store it with rsnapshot on an external device.

Now I hope that it is enough to easily restore everything, if I have to reinstall nextcloud the next time

I have to stop the daily sudo nextcloud.export because I got problems with mit SATA harddisk on my raspberry pi 4. I think the export of about 20GB every day let the raspberry USB to SATA connection crash. I can’t find the harddisk with blkid and I have to switch off and on the raspberry.

Do somebody knows a better way to safe the nextcloud data (more incremental or differential)?

I solved it with sudo nextcloud.export -bc the other data I backup with rsnaphot. Hope this is enough the restore if necessary.

Maybe I add an daily calendar export to, to be more safe.

Have you tried this and does it restore everything you need?

I need some more or advanced help here. I also used a snap on an ubuntu server 20.4 LTE also due to its ease of use (no stack). I got a 150gb hdd for the OS and a RAID1 with (2x) 500gb.
now, I share my cloud with friends and have changed the data directory to /media/nextcloud/data, the RAID is mounted on /media. so trying the ‘sudo nextcloud.export’ will abort due to missing the data where it used to be.

I am about to get a new computer with more power and a more useful motherboard. hence, I presume I will need to run installation once again with all the new hardware, right? I won’t be able to just connect the drives from the old to the new computer and run as before? just presuming, though… (I did not mention my noob-state yet, did I? ^^)
since I won’t be changing anything on the RAID, and got an SSD to replace the other hdd for the OS, I would like to save (or backup) the admin- and user-settings. can anybody tell me, where those settings are saved? kyrofa mentioned above that /snap/nextcloud/current/ is the snap itself, it’s read-only by definition, so where does the snap write down all the user data and my settings (incl. all them apps)?