# How to restore NextcloudPi Backup

**URL:** <https://help.nextcloud.com/t/how-to-restore-nextcloudpi-backup/126312>\
**Category:** NextcloudPi Documentation\
**Tags:** backup, ncp, raspberrypi, 5-general\
**Created:** [October 29, 2021, 11:38pm UTC](https://help.nextcloud.com/t/how-to-restore-nextcloudpi-backup/126312 "2021-10-29T23:38:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ncpbot](https://help.nextcloud.com/user_avatar/help.nextcloud.com/ncpbot/32/43429_2.png) [@ncpbot](https://help.nextcloud.com/u/ncpbot)\
**Post date:** [October 29, 2021, 11:38pm UTC](https://help.nextcloud.com/t/how-to-restore-nextcloudpi-backup/126312/1 "2021-10-29T23:38:32Z")

</div>

![nextcloudpidocs_banner_short_V3](https://help.nextcloud.com/uploads/default/original/3X/7/c/7c4ca640751c3a223666a44aec991abd85dc7279.jpeg)

# Restore your Backup

A complete restore needs of course in advance a complete backup of

- NextcloudPi Settings (using `nc-export-ncp`) and
- Nextcloud Data, User, Files (using `nc-backup` - with `includedata = yes`)

## Restoring NCP Settings

> **:: Note ::**  
> These are only the **Settings** of NCP, no users, no apps, only what you have configured in the NCP TUI or WebUI.

1. Take care, that your USB-Backupdrive will be mounted automatically. To do that,  
1.1 navigate to NCP-TUI or NCP-WebUI  
1.2 navigate to section “System”  
1.3 Choose “`nc-automount`” and activate it.
2. login to your pi via SSH (ssh pi@IP-ADDRESS)
3. Type `df -h` to list attached drives.
4. Look for your backup drive and type: `ls /media/BACKUP-DRIVE/`  
You should see a list of your backups. Look for the config-backup and note its name: `ncp-config_XXXXXXXX.tar`

 ![ls media backupdrive](https://help.nextcloud.com/uploads/default/original/3X/b/c/bcbd11222da602cec694d9e67e2ce8119f4a4118.png)

1. Finally, do it: Go back to the NextcloudPi TUI or WebUI  
5.1 Navigate to section “`Backups`”  
5.2 choose “`nc-import-ncp`”  
5.3 Fill in `path` & `file name `and hit apply.  
This will not take long as it only restores your ncp settings. _(You will not have any user or data restored. This we will do in the following step.)_

 ![nc-import-ncp](https://help.nextcloud.com/uploads/default/original/3X/9/4/94452fd8f4a136669141ea9c6b7ea017e3ac047d.png)

## Restoring the Nextcloud data-backup

> **:: Note ::**  
> o This is your data, users and apps.  
> o It does not include the NCP configurations.

1. Follow step 1-7 from the description above
2. Look for the backup file and note its name: `nextcloud-bkp_XXXXXXXX_XXXXXXXXXX.tar` or - in case of compressed backups - .tar.gz
3. Go back to the NextcloudPi TUI or WebUI  
3.1 Navigate to section “`Backups`”  
3.2 choose `nc-restore`  
3.3 Fill in `path` & `file name` and hit apply.  
Depending on your backup size this can take a very long time.
4. Once the backup has been restored successfully reboot NCP using the WebUI _(top right)_ or just reboot the pi itself with SSH `sudo reboot now`

Now you will be able to login to your Nextcloud with your former login and all your data, apps and users should be restored.

 ![ncp successfull restore](https://help.nextcloud.com/uploads/default/original/3X/9/c/9ce5d30c87a098767c6461bd41f5946fcc086b84.png)

Congratulations, you’re done! 🥳

> **:: Note ::**  
> The WebUI login will not be restored. you will have to use the password you got when you first activated _(NCP activation page)_

_(the process for restore of dateless backups (`includedata = no`) is the same - however dateless restore will need further steps to take care of the datadir. This can be done e.g. by using BTRFS and `nc-restore-snapshot` as described [here](https://help.nextcloud.com/t/how-to-backup-and-restore-a-nextcloudpi-instance-using-ncp-config/125973)._

### Restoring compressed backups (.tar.gz)

`nc-backup` can create compressed backups to save diskspace (.tar.gz instead of .tar only). On the other hand, this has a small disadvantage when it comes to restoring:  
The decompression of the .tar.gz - file is done in the disk that contains the backup.  
You might run into “disk full” error-messages because of that.  
**Possible workarounds:**

- move your .tar.gz-file to a bigger disk 🙂
- decompress manually (and choose different disks)

### Restoring across Nextcloud-Versions

`nc-restore` will restore Nextcloud to the version installed when creating the backup.

In few situations this might cause trouble: E.g. if your NextcloudPi-Version already is setup for Nextcloud 24 and PHP 8.1, but you are trying to restore a much older Nextcloud-Version (e.g. Nextcloud 22), which isn’t compatible to this PHP-Version yet.  
**Recommendation** : Try to keep your backup/restore version close. In worst case you might have to setup your new instance with an old version like described [here](https://help.nextcloud.com/t/how-does-one-install-an-older-version-of-the-curl-script-in-order-to-recover-to-php-7-4-and-nextcloud-22/148629)

### Restore of huge backups

A restore of a huge backup will take time. Of course this depends on your hardware, compression yes/no - but as an example it’s been reported that a restore of 400GB took more than 24 hours.  
**Recommendation:** If you aren’t physically in front of your NextcloudPi instance (via keyboard/display) and using SSH or WebUI instead, take care of a stable network connection and try to avoid powersaving-mode or similar.

### Restore to new instance plus change of datadir in parallel

This is not supported. The restore will use the datadir-path, that’s been used when the backup has been created.  
If your datadir has been e.g. `/media/usbdrive` during your backup, this path will be used also for the restore. You cannot restore to `/media/newusbdrive`!

* * *

_We hope this doc was helpful, if you encounter any issues please reach out to the [community](https://help.nextcloud.com/t/forum-github-or-chat-which-to-use-when/126318)._  
_These docs are written by volunteers, please consider becoming one of them.  
Contact the wiki team at [Matrix](https://matrix.to/#/#nextcloudpi:matrix.org) or [Telegram](https://t.me/NCP_Wiki_Team)_

---

<div class="post-metadata">

**Author:** ![anon75456558](https://help.nextcloud.com/letter_avatar/anon75456558/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon75456558](https://help.nextcloud.com/u/anon75456558)\
**Post date:** [July 15, 2022, 9:01pm UTC](https://help.nextcloud.com/t/how-to-restore-nextcloudpi-backup/126312/2 "2022-07-15T21:01:15Z")

</div>

3 posts were merged into an existing topic: [About moving the articles](https://help.nextcloud.com/t/about-moving-the-articles/134642/77)
