Btrfs snapshot not working

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, 20.0.5): 23.0.2
Operating system and version (eg, Ubuntu 20.04): `Raspbian Bullseye
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 7.4): 8.0

The issue you are facing:

When I try to create a btrfs snapshot I get an error.
the folder, in my configuration ncp_snapshots gets created in:

/media/ncp-snapshots

and not in the same folder where the ncdata is in
I guess that is the Problem, but I do not know how to fix this.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. In NCP use nc-snapshot to create a BTRFS Snapshot in the Datadir

The output of the error is this

Running nc-snapshot
Maintenance mode enabled
Nextcloud is in maintenance mode, hence the database isn't accessible.
Cannot perform any command except 'maintenance:mode --off'
ERROR: not a btrfs filesystem: /media/data1/../ncp-snapshots
Maintenance mode disabled
Done. Press any key...

But the drive ist definately Btrfs… Here the out put of a df -hT:

pi@raspberrypi:~ $ df -hT
Dateisystem    Typ      Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root      ext4       29G     20G  8,2G   71% /
devtmpfs       devtmpfs  1,8G       0  1,8G    0% /dev
tmpfs          tmpfs     1,9G     16K  1,9G    1% /dev/shm
tmpfs          tmpfs     768M    1,4M  767M    1% /run
tmpfs          tmpfs     5,0M    8,0K  5,0M    1% /run/lock
/dev/sda1      btrfs     466G    4,8G  460G    2% /media/data
/dev/sdb1      btrfs     120G     50G   70G   42% /media/data1
/dev/loop1     squashfs   46M     46M     0  100% /snap/core18/2251
/dev/loop2     squashfs   46M     46M     0  100% /snap/core18/2288
/dev/loop0     squashfs   94M     94M     0  100% /snap/core/12727
/dev/loop3     squashfs   52M     52M     0  100% /snap/core20/1331
/dev/loop4     squashfs   52M     52M     0  100% /snap/core20/1362
/dev/loop5     squashfs  191M    191M     0  100% /snap/sabnzbd/3799
/dev/loop6     squashfs  190M    190M     0  100% /snap/sabnzbd/3757
/dev/mmcblk0p1 vfat      253M     50M  203M   20% /boot
tmpfs          tmpfs     384M     76K  384M    1% /run/user/1000
pi@raspberrypi:~ $

We are talking about /dev/sdb1

Output of nc-report without database and http

pi@raspberrypi:~ $ sudo ncp-report 
<--! Paste this in GitHub report -->

<details>
<summary>NextCloudPi diagnostics</summary>

NextCloudPi version v1.46.6
OS Raspbian GNU/Linux 11. 5.10.92-v7l+ (armv7l)
automount no
USB devices sda sdb
datadir /media/data1/ncdata
data in SD no
data filesystem btrfs
data disk usage 50G/120G
rootfs usage 20G/29G
swapfile /var/swap
dbdir /var/lib/mysql
Nextcloud check ok
Nextcloud version 23.0.2.1
HTTPD service up
PHP service up
MariaDB service up
Redis service up
HPB service up
Postfix service up
internet check ok
port check 80 open
port check 443 open
IP REMOVED SENSITIVE VALUE
gateway REMOVED SENSITIVE VALUE
interface eth0
certificates REMOVED SENSITIVE VALUE
NAT loopback no
uptime 8:10

</details>


<details>
<summary>Nextcloud configuration</summary>

{
“system”: {
“passwordsalt”: “REMOVED SENSITIVE VALUE”,
“secret”: “REMOVED SENSITIVE VALUE”,
“trusted_domains”: {
“0”: “localhost”,
“11”: “78.35.183.108”,
“1”: “192.168.178.22”,
“5”: “nextcloudpi.local”,
“7”: “nextcloudpi”,
“8”: “nextcloudpi.lan”,
“4”: “nextcloud.mentese.eu”,
“12”: “nextcloud.mentese.eu”,
“3”: “raspberrypi”,
“22”: “raspberrypi”,
“14”: “raspberrypi”,
“”: “nextcloud.mentese.eu”
},
“default_phone_region”: “DE”,
“datadirectory”: “REMOVED SENSITIVE VALUE”,
“dbtype”: “mysql”,
“version”: “23.0.2.1”,
“overwrite.cli.url”: “https://raspberrypi/”,
“dbname”: “REMOVED SENSITIVE VALUE”,
“dbhost”: “REMOVED SENSITIVE VALUE”,
“dbport”: “”,
“dbtableprefix”: “oc_”,
“mysql.utf8mb4”: true,
“dbuser”: “REMOVED SENSITIVE VALUE”,
“dbpassword”: “REMOVED SENSITIVE VALUE”,
“installed”: true,
“instanceid”: “REMOVED SENSITIVE VALUE”,
“memcache.local”: “\OC\Memcache\Redis”,
“memcache.locking”: “\OC\Memcache\Redis”,
“redis”: {
“host”: “REMOVED SENSITIVE VALUE”,
“port”: 0,
“timeout”: 0
},
“tempdirectory”: “/media/data1/ncdata/tmp”,
“mail_smtpmode”: “sendmail”,
“mail_smtpauthtype”: “LOGIN”,
“mail_from_address”: “REMOVED SENSITIVE VALUE”,
“mail_domain”: “REMOVED SENSITIVE VALUE”,
“preview_max_x”: “2048”,
“preview_max_y”: “2048”,
“jpeg_quality”: “60”,
“overwriteprotocol”: “https”,
“loglevel”: “2”,
“log_type”: “file”,
“maintenance”: false,
“theme”: “”,
“logfile”: “/media/data1/ncdata/nextcloud.log”,
“data-fingerprint”: “3b392877a6a02688a4d91cacee0239fa”,
“app_install_overwrite”: [
“nextcloudpi”,
“socialsharing_diaspora”,
“socialsharing_facebook”,
“socialsharing_twitter”,
“socialsharing_email”,
“admin_notifications”,
“zenodo”,
“orcid”,
“dashboard”,
“emlviewer”
],
“trusted_proxies”: “REMOVED SENSITIVE VALUE”
}
}


does anyone has an idea what could be the Problem. I have already tried to reformat the usb stick with ncp an not with gparted.

what is the output from stat -fc%T /media/data1? if it’s a multi-line I think I know

It is:

**pi@raspberrypi**:**~ $** stat -fc%T /media/data1
btrfs

oh wait, are you using the root of /media/data1 as your ncp datadir?

No, it is:

/media/data1/ncdata

but is ncdata a BTRFS subvolume? I think that’s your problem. Did you move it manually instead of with nc-datadir?

Correct, I have moved it manually because I had an issue with my last SSD.
I did it with:

sudo rsync -ar /media/data/daily...... /media/data1/...

from an existing snapshot.

you need to use nc-datadir because it creates a subvolume in the BTRFS case. Also it deals with all the paths that need to be changed accross the system. You need a subvolume as the base for BTRFS snapshots.

If I were you I would run nc-datadir to /media/data1/ncdata1 and try again

I have tried it and get:

[ nc-datadir ] (Sat Mar 5 01:36:21 CET 2022)
Maintenance mode enabled
moving data directory from /media/data1/ncdata to /media/data1/ncdata1...
BTRFS filesystem detected
Create subvolume '/media/data1/ncdata1'
Nextcloud is in maintenance mode, hence the database isn't accessible.
Cannot perform any command except 'maintenance:mode --off'

System config value logfile set to string /media/data1/ncdata1/data/nextcloud.log
Nextcloud is in maintenance mode, hence the database isn't accessible.
Cannot perform any command except 'maintenance:mode --off'

System config value tempdirectory set to string /media/data1/ncdata1/data/tmp
sed: can't read /etc/php/7.3/cli/php.ini: No such file or directory

but I have php8 installed!?!

pi@raspberrypi~ $php -v

PHP 8.0.16 (cli) (built: Feb 21 2022 14:48:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.16, Copyright (c) Zend Technologies
with Zend OPcache v8.0.16, Copyright (c), by Zend Technologies

if you have php8 is because you installed it yourself, so I am afraid I cannot help you. Possibly other people will chime in

Yes, I know that I have installed it myself. I was just wondering why ncp does not use it…

Also the ncp.cfg looks strange…
I am bullseye and using as told before 8.0 which is recommended in the documentation.

{
“nextcloud_version”: “23.0.2”,
“php_version”: “7.3”,
“release”: “buster”,
“datadir”: “/media/data1/ncdata1/data”
}

the good thing, also with the error my nc-datadir was moved and snapshots are working. So i will open another thread to correct the php version. Thanks @nachoparker