# No space left on device

**URL:** https://dietpi.com/forum/t/no-space-left-on-device/6175
**Category:** Troubleshooting
**Created:** [11 January 2022 21:57 UTC](https://dietpi.com/forum/t/no-space-left-on-device/6175 "2022-01-11T21:57:03Z")
**Posts on this page:** 1
**Showing post:** 61

<div class="post-metadata">

### Author: ![droogi](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@droogi](https://dietpi.com/forum/u/droogi)
#### Post date: [4 March 2022 02:15 UTC](https://dietpi.com/forum/t/no-space-left-on-device/6175/61 "2022-03-04T02:15:24Z")

</div>

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](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:

```nohighlight
./nextcloud_db_backup: 13: [[: not found rm: das Entfernen von '' ist nicht möglich: Datei oder Verzeichnis nicht gefunden

```

```nohighlight
#!/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

```

---

_[View the full topic](https://dietpi.com/forum/t/no-space-left-on-device/6175)._
