How to backup, restore and migrate Nextcloud snap

Snap snapshot backup & restore

See Nextcloud snap wiki

Snap snapshot is a snap utility to create and manage snap snapshots. It may be used for random snapshots or automated as scripted cronjob and has the added convenience of easy snap migration.

Snap snapshots official documentation
Example rotating backup script by @scubamuc
Example backup script by @sbe-arg

Backup Nextcloud snap with snap snapshot

Snap snapshot will backup the entire Nextcloud snap including configuration, apps, certificates, database and data into a compressed file (*.zip) located in /var/lib/snapd/snapshots. See what’s inside a snapshot.

See documentation in man snap and snap snapshot documentation

Backup procedure

  • stop Nextcloud snap sudo snap stop nextcloud
  • save Nextcloud snap sudo snap save nextcloud
  • start Nextcloud snap sudo snap start nextcloud
  • copy/move snapshot (*.zip) in /var/lib/snapd/snapshots to wherever

Restore or migrate Nextcloud snap with snap restore

MPORTANT

  • When migrating be sure that Nextcloud snap is installed on the target device.
  • Snap restore restores the entire Nextcloud snap including configuration, apps, certificates, database and data.
  • CAUTION!: snap restore is not incremental and will completely replace existing installation.

See documentation in man snap and snap snapshot documentation

Restore or migration procedure

  • copy/move snapshot (*.zip) to /var/lib/snapd/snapshots
  • discover snapshot-id using snap saved
  • restore snapshot sudo snap restore <snapshot-id>

Deleting snap snapshots

See documentation in man snap and snap snapshot documentation

Delete snapshot procedure

  • discover snapshot-id using snap saved
  • delete snapshot sudo snap forget <snapshot-id>

How to export and import Nextcloud snap

See Export & import

1 Like