NextCloudPi snapshots on BTRFS not working anymore

Hello dear all,

recently I realized that the snapshots of my NextCloudPi are not working anmyore. When I try to create a snapshot manually by running sudo ncp-config and navigating to BACKUPS -> nc-snapshot, the resulting error message says something about a bus error and such:

Running nc-snapshot
Maintenance mode enabled
Nextcloud is in maintenance mode - no apps have been loaded

/usr/local/bin/btrfs-snp: line 18: 31247 Bus error               btrfs subvolume show "$DIR" &> /dev/null
/media/myCloudDrive/ncdata is not a BTRFS mountpoint or snapshot
Maintenance mode disabled
Done. Press any key...

… where “$DIR” is /media/myCloudDrive/ncdata because the hourly cron file looks like:

#!/bin/bash
/usr/local/bin/btrfs-snp /media/myCloudDrive/ncdata hourly  24 3600    ../ncp-snapshots
/usr/local/bin/btrfs-snp /media/myCloudDrive/ncdata daily    7 86400   ../ncp-snapshots
/usr/local/bin/btrfs-snp /media/myCloudDrive/ncdata weekly   4 604800  ../ncp-snapshots
/usr/local/bin/btrfs-snp /media/myCloudDrive/ncdata monthly 12 2592000 ../ncp-snapshots

… and my cloud drive is mounted at /media/myCloudDrive/:

$ ls -1 /media/myCloudDrive/
ncdata
ncp-backups
ncp-snapshots

I have no clue what could possibly went wrong :open_mouth:

Also, I stumbled over the post Ncp-dist-upgrade to buster broke nc-snapshot-auto on my installation (renegade) by @prontog from which I can confirm, that the installed script btrfs-snp is the current one.

Any advice would be appreciated!

Thanks in advance

what does output of

sudo df -hT

look like?

I’d also look for errors in ncp.log and maybe syslog.

Here is the output of sudo df -hT:

$ sudo df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4       29G  3,9G   24G  14% /
devtmpfs       devtmpfs  1,8G     0  1,8G   0% /dev
tmpfs          tmpfs     1,9G     0  1,9G   0% /dev/shm
tmpfs          tmpfs     1,9G  9,6M  1,9G   1% /run
tmpfs          tmpfs     5,0M  4,0K  5,0M   1% /run/lock
tmpfs          tmpfs     1,9G     0  1,9G   0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat      511M   49M  463M  10% /boot
/dev/sda1      btrfs     932G  754G  177G  82% /media/myCloudDrive
tmpfs          tmpfs     385M     0  385M   0% /run/user/1000

/dev/sda1 is the btrfs partition mounted as volume /media/myCloudDrive where ALL THE data lies.

And this is the output of /var/log/ncp.log when I try to take a new snapshot:

[ nc-snapshot ] (Fr 12. Feb 21:00:11 CET 2021)
Maintenance mode enabled
Nextcloud is in maintenance mode - no apps have been loaded

/usr/local/bin/btrfs-snp: line 18: 19295 Bus error               btrfs subvolume show "$DIR" &> /dev/null
/media/myCloudDrive/ncdata is not a BTRFS mountpoint or snapshot
Maintenance mode disabled

And"

sudo btrfs subvolume list /media/myCloudDrive

?
Maybe not enough space? What does syslog say?

This is interesting. Here you can see the snapshots stopped working in January, which I can confirm. However, I can’t tell what could have happened back then.

$ sudo btrfs subvolume list /media/myCloudDrive
ID 257 gen 143234 top level 5 path ncdata
ID 7197 gen 53778 top level 5 path ncp-snapshots/monthly_2020-02-05_191702
ID 7889 gen 57954 top level 5 path ncp-snapshots/monthly_2020-03-06_191703
ID 8609 gen 64527 top level 5 path ncp-snapshots/monthly_2020-04-05_211702
ID 9413 gen 73822 top level 5 path ncp-snapshots/monthly_2020-05-05_211702
ID 10106 gen 81519 top level 5 path ncp-snapshots/monthly_2020-06-04_211702
ID 10815 gen 89768 top level 5 path ncp-snapshots/monthly_2020-07-04_211702
ID 11502 gen 96810 top level 5 path ncp-snapshots/monthly_2020-08-03_211702
ID 12240 gen 104060 top level 5 path ncp-snapshots/monthly_2020-09-02_211702
ID 12941 gen 109928 top level 5 path ncp-snapshots/monthly_2020-10-02_211702
ID 13646 gen 116768 top level 5 path ncp-snapshots/monthly_2020-11-01_201703
ID 14533 gen 125126 top level 5 path ncp-snapshots/monthly_2020-12-01_211702
ID 15232 gen 133044 top level 5 path ncp-snapshots/weekly_2020-12-27_081702
ID 15342 gen 134290 top level 5 path ncp-snapshots/monthly_2020-12-31_221702
ID 15402 gen 134744 top level 5 path ncp-snapshots/weekly_2021-01-03_081702
ID 15569 gen 135987 top level 5 path ncp-snapshots/weekly_2021-01-10_081702
ID 15906 gen 138019 top level 5 path ncp-snapshots/weekly_2021-01-17_081702

Addendum: Maybe I do remember what happened in January… Back then I tried to sync data that would have exceeded 1 TB. So, my cloud was full and could not sync data anymore. I didn’t know what to do. Although, I deleted the data I wanted to be synced, the space would not free up automatically, because it was taken by the snapshots made during running full, I suppose.

That’s why I decided to delete some of the newest snapshots until enough free space was available again for the cloud to work again. The commands I used to free up space (I googled them, because I’m no btrfs expert) were:

cd /media/myCloudDrive/ncp-snapshots/
sudo btrfs subvolume delete hourly_2021-01-1*
sudo btrfs subvolume delete daily_2021-01-1*

I’m no btrfs expert, but quick duckduckgo on the subject resulted in this info:
You might need to balance btrfs with:

sudo btrfs balance /media/myCloudDrive

Yesterday I have run this command. It took about 12 hours to finish. It revealed a few more GiB of free space but… Unfortunately, it didn’t help :frowning:

I am not sure, whether the fact that the snapshots are not working and the Bus Error are related to each other or not.

Another command with Bus error (at the bottom output) is:

$ sudo btrfs subvolume show /media/myCloudDrive/
/
	Name: 			<FS_TREE>
	UUID: 			-
	Parent UUID: 		-
	Received UUID: 		-
	Creation time: 		-
	Subvolume ID: 		5
	Generation: 		150859
	Gen at creation: 	0
	Parent ID: 		0
	Top level ID: 		0
	Flags: 			-
	Snapshot(s):
Bus error