Nextcloud really is the software program of the long run. Due to it, it’s easier than ever to spin up your personal user-friendly, Dropbox-like storage resolution on Linux. Setup for the software program is extraordinarily straightforward due to issues like Snap packages. Nonetheless it isn’t as straightforward to backup a NextCloud Snap set up.

Observe: Earlier than doing a Nextcloud backup, make sure the entirety of your information has completed syncing. Through the backup course of, the NextCloud snap will shut off, suspending all companies to all customers related to it.

Cease The Server

Making a backup of Nextcloud, particularly the Snap model, requires the suspension of the server software program. With out turning the Nextcloud server off, sure information might fail to avoid wasting, permission errors may come up, and even knowledge could possibly be misplaced.

Fortunately, suspending a operating Nextcloud server is nearly as straightforward as putting in it! To cease the server, open up a terminal and achieve a root shell utilizing su or sudo -s. Then, use the snap cease command to cease all Nextcloud companies.

su -

or

sudo -s

snap cease nextcloud

Working the snap cease command will disable the SQL database, and different operating Nextcloud companies. It won’t uninstall them, so don’t fear! Your information are secure!

Again Up Folders

With the server briefly shut off, it’s secure to create a backup of Nextcloud. Nonetheless, earlier than the server-side backup can start, we suggest making a backup of the ~/Nextcloud folder for every person. This manner, if something occurs to the server backup, customers will nonetheless have a reproduction of their knowledge.

To create a backup of a Nextcloud sync folder, go to any Linux PC that makes use of the sync server, and open up a terminal. Within the terminal, use the Tar command to create an archive of the ~/Nextcloud folder. Remember to change “username” within the command beneath along with your username.

tar -zcvpf nextcloud-local-backup-username.tar.gz ~/Nexcloud

Relying on how giant ~/Nextcloud is, the compression course of might take some time. When the archiving course of is full, use the GPG command to encrypt the archive (for safety functions.)

gpg -c nextcloud-local-backup-username.tar.gz

rm nextcloud-local-backup-username.tar.gz

GnuPG will output nextcloud-local-backup-username.tar.gz.gpg.

After GPG finishes the encryption course of, place the encrypted backup someplace secure.

Again Up Nextcloud

Backing up the Snap model of Nextcloud is by far the simplest, in comparison with the standard Nextcloud setup. Since every thing is within the Nextcloud Snap folder, there’s no have to export any SQL databases or mess with particular person information. As an alternative, customers can create an entire backup of Nextcloud by making a duplicate of two particular person folders.

The primary folder to backup inside the Nextcloud Snap listing is the configuration listing. To decide the identify of the Nextcloud config folder, run lsblk and see the place it’s on the system. As of writing this text, the mount folder is:

/var/lib/snapd/snap/nextcloud/7658

9k=

Make a brand new backup folder inside /house/username/ with the mkdir command and use the cp command to repeat every thing to it.

mkdir ~/nextcloud-server-backup

mkdir ~/nextcloud-server-backup/config
sudo cp -rp /var/lib/snapd/snap/nextcloud/7658/* /house/username/nextcloud-server-backup/config

With the configuration information for Nextcloud within the backup folder, it’s time to avoid wasting the info.

mkdir ~/nextcloud-server-backup/knowledge

sudo cp -rp /var/snap/nextcloud/widespread/* /house/username/nextcloud-server-backup/knowledge

Compress The Backup

Now that the backup is full, it’s secure to compress the backup right into a Tar archive for safekeeping. Within the terminal, compress the info right into a TarGZ archive, utilizing the tar command.

Observe: earlier than compressing this backup, guarantee you have got sufficient disk area to assist it.

tar -zcvpf nextcloud-snap-server-backup.tar.gz ~/nextcloud-server-backup

Relying on how a lot knowledge is on Nextcloud, this might take some time. When the compression is full, be happy to maneuver the backup to an exterior onerous drive or backup file server.

Encrypt Backup

The Nextcloud server has a backup however it’s not secure because it isn’t encrypted. To guarantee the info in your Nextcloud server is secure from eavesdropping, encrypt it with GnuPG.

To encrypt the backup, open up a terminal and run the next command:

gpg -c nextcloud-snap-server-backup.tar.gz

Just like the Nextcloud native backup, GPG will output a nextcloud-snap-server-backup.tar.gz.gpg file. This file is encrypted and secure, so it’s OK to delete the unencrypted archive:

rm nextcloud-snap-server-backup.tar.gz

Restore Backup

Want to revive the backup? Begin out by shifting nextcloud-snap-server-backup.tar.gz.gpg to /house/username/.

Subsequent, decrypt the archive with gpg:

gpg nextcloud-snap-server-backup.tar.gz.gpg

Extract the archive, utilizing tar.

tar -xvpf nextcloud-snap-server-backup.tar.gz

Reinstall earlier than making an attempt to revive the backup (if on a brand new system).

sudo snap set up nextcloud

sudo snap cease nextcloud

Restore the backup with;

sudo cp -rpf /house/username/nextcloud-server-backup/knowledge/* /var/lib/snapd/snap/nextcloud/7658/

sudo cp -rpf /house/username/nextcloud-server-backup/config/* /var/snap/nextcloud/widespread/

Lastly, begin up the Nextcloud server with the snap begin command.

sudo snap begin nextcloud



Source link

Share.
Leave A Reply

Exit mobile version