Restore Nextcloud from screenshots

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 15.0.1
Operating system and version (eg, Ubuntu 17.04): raspbian stretch
Apache or nginx version (eg, Apache 2.4.25): unknown
PHP version (eg, 7.1): unknown

The issue you are facing:
As described in another topic my nextcloudpi was not starting anymore, SD card seems broken.

I installed raspbian stretch, then Nextcloud pi via container.

How do I know restore the backups?

The filesystem looks like this:

pi@raspberrypi:/media/Touro1TB $ ls
ncdata ncdata-03-20-19 NCP ncp-config_20180724.tar ncp-snapshots
pi@raspberrypi:/media/Touro1TB $ cd ncp-snapshots
pi@raspberrypi:/media/Touro1TB/ncp-snapshots $ ls
autobackup_2019-03-20_060858 hourly_2019-03-15_091702
autobackup_2019-03-20_062107 hourly_2019-03-15_101702
daily_2019-03-08_201703 hourly_2019-03-15_111701
daily_2019-03-09_201703 hourly_2019-03-15_121702
daily_2019-03-10_211702 hourly_2019-03-15_131701
daily_2019-03-11_211702 hourly_2019-03-15_141701
daily_2019-03-12_211702 hourly_2019-03-15_151701
daily_2019-03-13_211702 hourly_2019-03-15_161702
daily_2019-03-14_211702 hourly_2019-03-15_171701
hourly_2019-03-14_191701 hourly_2019-03-15_181701
hourly_2019-03-14_201701 hourly_2019-03-15_191701
hourly_2019-03-14_211701 hourly_2019-03-16_001701
hourly_2019-03-14_221701 manual_2018-12-04_203221
hourly_2019-03-14_231701 manual_2018-12-04_203505
hourly_2019-03-15_001701 monthly_2018-12-13_191703
hourly_2019-03-15_011701 monthly_2019-01-12_191707
hourly_2019-03-15_021701 monthly_2019-02-11_201708
hourly_2019-03-15_031701 monthly_2019-03-13_211703
hourly_2019-03-15_041701 weekly_2019-02-21_231702
hourly_2019-03-15_051939 weekly_2019-02-28_231702
hourly_2019-03-15_071701 weekly_2019-03-07_231703
hourly_2019-03-15_081701 weekly_2019-03-14_231702

I tried to use the nc-restore-snapshot within the ncp web panel with

/media/Touro1TB/ncp-snapshots/hourly_2019-03-15_191701

[ nc-restore-snapshot ]
Create a readonly snapshot of ‘/media/Touro1TB/ncdata’ in ‘/media/Touro1TB/ncdata/…/ncp-snapshots/autobackup_2019-03-21_074832’
snapshot autobackup_2019-03-21_074832 generated
Maintenance mode enabled
Delete subvolume (no-commit): ‘/media/Touro1TB/ncdata’
Create a snapshot of ‘/media/Touro1TB/ncp-snapshots/hourly_2019-03-15_191701’ in ‘/media/USBdrive/ncdata’
Maintenance mode disabled
Starting scan for user 1 out of 1 (ncp)
Folder /ncp/
Folder /ncp/files
File /ncp/files/Nextcloud Manual.pdf
File /ncp/files/Nextcloud.mp4
Folder /ncp/files/Documents
File /ncp/files/Documents/About.txt
File /ncp/files/Documents/About.odt
Folder /ncp/files/Photos
File /ncp/files/Photos/Coast.jpg
File /ncp/files/Photos/Nut.jpg
File /ncp/files/Photos/Hummingbird.jpg

±--------±------±-------------+
| Folders | Files | Elapsed time |
±--------±------±-------------+
| 4 | 7 | 00:00:00 |
±--------±------±-------------+
snapshot /media/Touro1TB/ncp-snapshots/hourly_2019-03-15_191701 restored

As you can see, this was not helpful, nothing important was restored. I had ~250 GB of files on the disk.

I do not have NC PI, but they are using BTRFS snapshots, so you can now mount that snapshot as if it were the original sub volume and check if you would like to restre it before to do this.
Also check this out:

And Backup and Restore was described here, may be you will find few hints:

there’s a new ncp-app called nc-restore-snapshot to restore the data, and you can use nc-restore to restore the rest. Look in docs.nextcloudpi.com, there is a tutorial

Thank you both very much for the information!

I read the instructions here but I still encounter some problems:

I have the suggested configuration with HDD1 for the datadir and HDD2 for the backups. HDD1 and HDD2 are connected to the Pi

  • When I want to use NCP import, there is the text “ncp-config_xxxxxx.cfg” in the relevant box in the admin panel. But I only have a file “ncp-config_20180724.tar” in my directory (as shown above). So the filetype cfg and tar do not match. Is still seems to work though, at least it says “configuration restored”.
  • When I try to cd to HDD2 called “Backup_4TB”, I have no permission. I need to access it with root permission. So when I try NC restore in “/media/Backup_4TB/ncp-backups/nextcloud-bkp_20190315_1552618831.tar”, I get “nc-restore read error”
  • When I try to restore the backup by “ncp-config”, I get the following:

root@raspberrypi:/media/Backup_4TB/ncp-backups# ncp-config
cat: /usr/local/etc/ncp-version: Datei oder Verzeichnis nicht gefunden
cat: /usr/local/etc/ncp-version: Datei oder Verzeichnis nicht gefunden
cat: /usr/local/etc/ncp-version: Datei oder Verzeichnis nicht gefunden
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 1, column 20
parse error: Invalid numeric literal at line 1, column 20
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
parse error: Invalid numeric literal at line 2, column 0
Running nc-restore
parse error: Invalid numeric literal at line 2, column 0
not found
Done. Press any key…

I just installed everything from scratch, but I still have the same erros messsages at stated in the post above.

read error… check your drives for errors with nc-hdd-test

I installed everything from scratch for the 5th time.

Several remarks:

  • With a new system, the webpanel of NCP shows v0.0.0 in the corner left on top. Sudo ncp-config leads to
    sudo ncp-config
    cat: /var/run/.ncp-latest-version: Datei oder Verzeichnis nicht gefunden
    cat: /usr/local/etc/ncp-version: Datei oder Verzeichnis nicht gefunden
    cat: /usr/local/etc/ncp-version: Datei oder Verzeichnis nicht gefunden

  • Update in the webpanel and the info left on top says v1.10.4. sudo ncp-config works then fine

  • NCP import ruins everything, then the parse errors occur

  • When I try “Restore a previously backuped NC instance” and enter the path
    /media/Backup_4TB/ncp-backups/nextcloud-bkp_20190301_1551409204.tar, I get the following error messages:
    [ nc-restore ]
    extracting backup file /media/Backup_4TB/ncp-backups/nextcloud-bkp_20190301_1551409204.tar…
    tar: /media/Backup_4TB/ncp-backups/nextcloud-bkp_20190301_1551409204.tar: Cannot read: Input/output error
    tar: At beginning of tape, quitting now
    tar: Error is not recoverable: exiting now
    Cleanup…

Is there anything I can rescue from my system?

Your drive seems to be bad, unless you have other copies of the backups not much you can do

There are two drives: One with the datadir and one with the Backup. Should both be broken?

The one with the Backups is just 6 months old and a western digital, which is one of the most durable on the market. I can Try to catch the SMART values, but I think more of a software problem here.