2022年9月24日 星期六

[nextcloud, restore] How to restore a backup nextcloud service

How to restore a backup nextcloud service

井民全, Jing, mqjing@gmail.com

The google doc version: (view)

Not enough space to store the data? This document shows you how to restore the old smaller one device to a larger device. Do any thing, please backup your nextcloud system at first.

 

# Backup the system

Aceess the page https://192.168.1.108:4443

choose [BACKUPS] -> [nc-backup]

 

Here, we're talking about restore. 

In oder to access your backup file,  you should mount the USB device where the backup file located and make sure it can be access from the nextcloud instance. After that, you use occ-restore command. So the basic idea can be divided into 3 steps.

 

# Backup the system

Aceess the page https://192.168.1.108:4443

choose [BACKUPS] -> [nc-backup]


Let's see the quick procedure.

Enjoy!

by Jing.

1. Quick

cd /var/lib/docker/volumes/ncdata_old/_data

mount /dev/sda1 ./backup    # mount the USB device to the backup folder


# Get the file location in the nextcloud ervice docker instance

sudo docker exec -it nextcloudpi bash   

cd /data/backup/ncdata/backups/ncp-backups

ls # check the file


# Restor the system

Aceess the page https://192.168.1.108:4443

choose [BACKUPS] -> [nc-restore]

In case you forgot the passwords after system restored.

Command

sudo docker exec -it nextcloudpi ncp-configs

Choose [CONFIG] - > [nc-admin]



 

2. Detail

Step 1: Locate the backup file

Supoose your backup file location at following.

Device:

/dev/sda1

File: 

/media/pi/MYDISK/ncdata/backups/ncp-backups/nextcloud-bkp_20220922_1663858689.tar.gz

 

Step 2: Mount the device

If our nextcloud service instance was running by following commands.


sudo docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v ncdata_old:/data --name nextcloudpi ownyourbits/nextcloudpi 192.168.1.108

The easiest way to access to the file that will be used to restore the system is mount the device to the sub-directory of the nc_data_old/_data. (Note, you cannot use symbolic link in docker.)

 

In host,

In host,

cd /var/lib/docker/volumes/ncdata_old/_data

mount /dev/sda1 ./backup    # mount the USB device to the backup folder


e.g.

Step 3: Verification & Get the file location

sudo docker exec -it nextcloudpi bash   

cd /data/backup/ncdata/backups/ncp-backups

ls # check the file

e.g.

 

The full file path is the location where you can used to restore for occ-restore instruction.

File: /data/backup/ncdata/backups/ncp-backups/nextcloud-bkp_20220922_1663858689.tar.gz

 

Step 4: Restore the system

Access the nextcloudPi control panel.

e.g.

Aceess the page https://192.168.1.108:4443 and choose [BACKUPS] -> [nc-restore].

Fill the Backup File: /data/backup/ncdata/backups/ncp-backups/nextcloud-bkp_20220922_1663858689.tar.gz

 

And then [Apply]

 

Wait for minutes or hours... (depends on your data size). 

If there is no issue, you will see the following information.

Note: If you forget the admin user ncp's password, you can follow the instructions to reset it. (check detail)



Command

sudo docker exec -it nextcloudpi ncp-configs

Choose [CONFIG] - > [nc-admin]