G_TREESIZE /tmp gives similar result asls -la
Yes contact might be similar but important question is if it gives a file size.
Isn’t the file size between group and date in ls -la?
root@DietPi4 [19:31:46]~ # G_TREESIZE /tmp
0,0 bytes /tmp/.XIM-unix
0,0 bytes /tmp/.X11-unix
0,0 bytes /tmp/.Test-unix
0,0 bytes /tmp/systemd-private-9483f30167d642159b4029a36bc1dc58-systemd-logind.service-cIrAnh
0,0 bytes /tmp/systemd-private-9483f30167d642159b4029a36bc1dc58-redis-server.service-cVM9wj
0,0 bytes /tmp/systemd-private-9483f30167d642159b4029a36bc1dc58-logitechmediaserver.service-40tfjh
0,0 bytes /tmp/systemd-private-9483f30167d642159b4029a36bc1dc58-coturn.service-uqK5Oh
0,0 bytes /tmp/.ICE-unix
0,0 bytes /tmp/.font-unix
0,0 bytes /tmp
ls -la is showing the size of files only. It did not show any information on folders or the content inside. This is what usually G_TREESIZE does. It sum up the space used by folders. But in your case, something strange is going on as you system is showing always 0. Doesn’t matter how much space is used.
Please try to restart or stop the other services with use a private tmp subdir:
systemctl stop coturn systemd-logind
systemctl restart redis-server # just restarting since Nextcloud strictly requires it
sleep 2
df -h /tmp
systemctl start coturn systemd-logind
Why cannot I see that nextcloud MySQL is using /tmp?
May be offtopic, There is one failure in nextcloud system check
The PHP OPcache module is not properly configured:
The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.
The second one in protocol
Fatal
no app in context
2022-02-26T21:22:14+0100
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1021 Disk full (/tmp/#sql-temptable-3aa-127b-78.MAI); waiting for someone to free some space... (errno: 28 "No space left on device").
root@DietPi4 [04:46:07]/tmp # df -h /tmp
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
tmpfs 1,9G 1,1G 897M 54% /tmp
root@DietPi4 [04:46:23]/tmp # systemctl stop coturn systemd-logind
root@DietPi4 [04:46:47]/tmp # systemctl restart redis-server
root@DietPi4 [04:47:17]/tmp # sleep 2
root@DietPi4 [04:47:36]/tmp # df -h /tmp
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
tmpfs 1,9G 1,1G 895M 54% /tmp
root@DietPi4 [04:47:56]/tmp # systemctl start coturn systemd-logind
you could try to restart all DietPi managed services
dietpi-services restart
Nope, before and after restarting all “dietpi managed services” /tmp is 95%full.
Should I do a fresh install or continue investigating?
Or add a Cron job and reboot every 2 days?
(I could try to see if backup works in a virtual machine)
You can’t restore a backup from a physical device on a virtual machine. They both use different architecture.
I meant to restore the sql-dump of nextcloud in a virtual machine, that’s most important for me.
I am not sure how to export/import the certificates for my domain yet.
Pihole and lms would be ok
The SQL dump is one thing. The Nextcloud data another. They would need to be migrated as well.
HTTPS certificates should not be an issue, as they could be recreated easily.
Pihole themselves offer a function to export/import settings.
I used lsof to display open files, but still do not understand where to look. maybe its a cron issue?
root@DietPi4 [10:30:22]~ # df -h
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root 235G 110G 116G 49% /
devtmpfs 1,9G 0 1,9G 0% /dev
tmpfs 1,9G 1,3M 1,9G 1% /dev/shm
tmpfs 764M 18M 747M 3% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 1,9G 321M 1,6G 17% /tmp
tmpfs 50M 40K 50M 1% /var/log
/dev/mmcblk0p1 253M 52M 201M 21% /boot
tmpfs 382M 8,0K 382M 1% /run/user/999
/dev/sda1 113G 62G 51G 56% /mnt/128
/dev/sdb1 229G 160G 69G 70% /mnt/256
tmpfs 382M 8,0K 382M 1% /run/user/0
root@DietPi4 [10:30:28]~ # lsof /tmp
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mariadbd 797 mysql 6u REG 0,29 0 30 /tmp/ibUUhR4t (deleted)
mariadbd 797 mysql 7u REG 0,29 0 31 /tmp/ibHz3QDr (deleted)
mariadbd 797 mysql 8u REG 0,29 0 33 /tmp/ibe6Tf7r (deleted)
mariadbd 797 mysql 11u REG 0,29 0 34 /tmp/ibGSCdxs (deleted)
php-fpm7. 873 root 3u REG 0,29 0 38 /tmp/.ZendSem.M32GOb (deleted)
php-fpm7. 8139 www-data 3u REG 0,29 0 38 /tmp/.ZendSem.M32GOb (deleted)
php-fpm7. 8501 www-data 3u REG 0,29 0 38 /tmp/.ZendSem.M32GOb (deleted)
php-fpm7. 8507 www-data 3u REG 0,29 0 38 /tmp/.ZendSem.M32GOb (deleted)
php-fpm7. 8875 www-data 3u REG 0,29 0 38 /tmp/.ZendSem.M32GOb (deleted)
cron 13495 root 6u REG 0,29 335817057 3740 /tmp/#3740 (deleted)
dash 13497 root 1u REG 0,29 335817057 3740 /tmp/#3740 (deleted)
dash 13497 root 2u REG 0,29 335817057 3740 /tmp/#3740 (deleted)
run-parts 13500 root 1u REG 0,29 335817057 3740 /tmp/#3740 (deleted)
run-parts 13500 root 2u REG 0,29 335817057 3740 /tmp/#3740 (deleted)
Indeed it seems to be a cron job creating ~320 MiB large files (and removes them again). Check your cron jobs in /etc/cron.daily/ and /etc/cron.hourly/.
I think, I found it. It’s a failure in the nextcloud backup script.
My fault, when I made this file, I never checked, if it works and if backups were created. And I forgot about it, sorry.
@MichaIng could you please check the syntax of the attached script?
I made a mistake when copying from https://dietpi.com/forum/t/nextcloud-calender-contact-backup-script/5911/1
Result when executed manually:
No SQL dump is created.
And continuous error Loop:
./nextcloud_db_backup: 13: [[: not found rm: das Entfernen von '' ist nicht möglich: Datei oder Verzeichnis nicht gefunden
#!/bin/dash
# Enable maintenance mode
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
# Backup Nextcloud database with numerically sortable timestamp
mysqldump nextcloud > /mnt/dietpi_userdata/backup/$(date +%Y-%m-%d_%T).sql
# Disable maintenance mode
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
# Remove old backups until max 10 are left
until [[ $(find /mnt/dietpi_userdata/backup/ -name '*.sql' | wc -l) -le 10 ]]
do
rm -v "$(find /mnt/dietpi_userdata/backup/ -name '*.sql' | sort -n | head -1)"
done
exit 0
When I change path from /mnt/dietpi_userdata/backup/ to /mnt/128/backup/, the SQL dump is created.
Both backup folders are owned by root and have drwxr-xr-x.
can you share following
readlink /mnt/dietpi_userdata
readlink -f /mnt/dietpi_userdata
ls -la /mnt/dietpi_userdata/backup/
ls -la /mnt/128/backup/
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
readlink -f /mnt/dietpi_userdata
/mnt/dietpi_userdata
ls -la /mnt/dietpi_userdata/backup/
insgesamt 8
drwxr-xr-x 2 root root 4096 4. Mär 03:43 .
drwxrwxr-x 13 dietpi dietpi 4096 22. Feb 19:59 …
ls -la /mnt/128/backup/
insgesamt 204200
drwxr-xr-x 2 root root 4096 4. Mär 03:37 .
drwxrwxrwx 13 www-data www-data 4096 4. Mär 03:36 …
-rw-r–r-- 1 root root 209086023 4. Mär 03:37 2022-03-04_03:37:22.sql
lsblk -o name,fstype,label,size,ro,type,mountpoint,partuuid,uuid
NAME FSTYPE LABEL SIZE RO TYPE MOUNTPOINT PARTUUID UUID
sda 114,6G 0 disk
└─sda1
ext4 114,5G 0 part /mnt/128 dd3ad002-01 596a46a7-d2a1-4c7b-918f-3e64732233ac
sdb 233,3G 0 disk
└─sdb1
ext4 233,2G 0 part /mnt/256 aebece80-b588-49b3-8915-7560c330d847 20c4b904-1f5f-41f6-86a9-5aae128a3ab4
mmcblk0
│ 238,8G 0 disk
├─mmcblk0p1
│ vfat boot 256M 0 part /boot e8af6eb2-01 DC3E-E470
└─mmcblk0p2
ext4 rootfs
238G 0 part / e8af6eb2-02 a7adb26a-8b87-4729-99c8-9f5ac069d51e
There was a syntax error in the example script, i.e. it uses dash but contained [[ … ]] bash syntax. I adjusted it in the linked post. Basically replace double braces with single braces [ … ]. I also changed it from an “until” to a “while” loop, making an infinite loop less likely, e.g. breaking in case of an error.
I have no idea how changing the target directory should have solved the syntax error, did you change something else in the script?
@MichaIng: thanks for correcting the mistake in the script, i would never have found that.
I made an error while testing the path behaviour, i run mysqldumb nextcloud > /mnt/128/backup/filename.sql, the sql-file was created.
for the other path (/mnt/dietpi_userdata/backup/) i ran the backup script with mistake (see attached file). The sql files in the folder are deleted by the script just after creating. Therefore i thought i was depending on the path.
Thanks a lot for your patience, time and knowledge. I always made a backup of the sdcard, now i want to try to backup and restore! nextcloud using nextcloud script and backup and restore dietpi with dietpi script.
nextcloud_db_backup.falsch.txt (607 Bytes)