Why is my data directory so full?

Hello,

I’ve been enjoying my nextcloud for a couple of years without any problems at all. Love it!

Nextcloud version (eg, 20.0.5): 21.0.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache2
PHP version (eg, 7.4): php 7.4.3

I am running ubuntu on a raspberry pi4, and I put it all on an external 128GB flash drive. I figured that would last me forever since I keep a small amount of shared data, currently it is only 11GB of files.

The issue I am facing is, for whatever reason, my entire 128GB is full, even though I am only sharing 11GB of files. I’ve been all over the nextcloud forum here and did find where I can clear versions and the trashbin. What else am I missing? I have no other users, it’s just my own personal cloud. I have unlimited quota. I’m out of ideas. I noticed this when I went to do an upgrade and my upgrade is failing due to full disk.

After clearing the versions and trashbin, I did manage to free up about 5GB of free space, which filled up as soon as I tried to upgrade again.

Here’s a listing of my entire nextcloud directory sorted by size - can I remove the large ( updater-octgmmwarv5b) one?

root@nextcloud:/media/kensdrive/nextcloud# du -cks * | sort -rn | head

125006848 total

108232192 updater-octgmmwarv5b

11454976 myusername

5296640 appdata_octgmmwarv5b

20480 nextcloud.log

1024 files_external

1024 cloudguy

512 updater.log

Any help is much appreciated. I’d rather solve the issue than go throw money at it getting a larger flash drive and having the same issue again in a few years. Thanks!

The output of your Nextcloud log in Admin > Logging:

{"reqId":"sBRJbbM73z9zYmyMGlpP","level":3,"time":"2022-01-20T00:00:16+00:00","remoteAddr":"192.168.1.193","user":"Ken","app":"PHP","method":"GET","url":"/index.php/settings/user/sharing","message":{"Exception":"Error","Message":"file_put_contents(): write of 680 bytes failed with errno=28 No space left on device at /var/www/nextcloud/lib/private/Files/Storage/Local.php#282","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Local.php","line":282,"function":"file_put_contents"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":259,"function":"file_put_contents","class":"OC\\Files\\Storage\\Local","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1170,"function":"file_put_contents","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":707,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","line":201,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/SimpleFS/NewSimpleFile.php","line":134,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nextcloud/lib/private/Template/SCSSCacher.php","line":362,"function":"putContent","class":"OC\\Files\\SimpleFS\\NewSimpleFile","type":"->"},{"file":"/var/www/nextcloud/lib/private/Template/SCSSCacher.php","line":189,"function":"cache","class":"OC\\Template\\SCSSCacher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Template/CSSResourceLocator.php","line":111,"function":"process","class":"OC\\Template\\SCSSCacher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Template/CSSResourceLocator.php","line":86,"function":"cacheAndAppendScssIfExist","class":"OC\\Template\\CSSResourceLocator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Template/ResourceLocator.php","line":79,"function":"doFind","class":"OC\\Template\\CSSResourceLocator","type":"->"},{"file":"/var/www/nextcloud/lib/private/TemplateLayout.php","line":330,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->"},{"file":"/var/www/nextcloud/lib/private/TemplateLayout.php","line":238,"function":"findStylesheetFiles","class":"OC\\TemplateLayout","type":"::"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Template.php","line":183,"function":"__construct","class":"OC\\TemplateLayout","type":"->"},{"file":"/var/www/nextcloud/lib/public/AppFramework/Http/TemplateResponse.php","line":210,"function":"fetchPage","class":"OC_Template","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":172,"function":"render","class":"OCP\\AppFramework\\Http\\TemplateResponse","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":993,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36","version":"21.0.3.1","id":"61e8c12780921"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  'trusted_domains' => 
  array (
    0 => '192.168.1.100',
    1 => 'nextcloud.lan',
    2 => 'dethscloud.sytes.net:25556',
  ),
  'datadirectory' => '/media/kensdrive/nextcloud',
  'dbtype' => 'mysql',
  'version' => '21.0.3.1',
  'overwrite.cli.url' => 'https://192.168.1.100',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'admin',
  'dbpassword' => 'secret',
  'installed' => true,
  'maintenance' => false,
  'has_rebuilt_cache' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'theme' => '',
  'loglevel' => 2,

In this directory you can delete some folders.
I think there are more than 100 GB :wink:

Use the command ncdu for more details.

sudo apt-get install ncdu
screenshots of ncdu

Thanks, but I still wouldn’t know which directories I can remove safely, if any at all.

Plus I’m pretty comfy with the command line, ‘du’ has always been my friend. :smiley:

So here’s the contents of this hog directory. Nothing in the ‘downloads’ directory, and here’s what’s in the other ‘backups’ directory. Seems it should be safe to at least remove the older ones? Yep, 104GB of ‘update backups’…

root@nextcloud:/media/kensdrive/nextcloud/updater-octgmmwarv5b# ls -ltr

total 1024

drwxrwx— 1 www-data root 524288 Aug 10 18:18 downloads

drwxrwx— 1 www-data root 524288 Jan 19 20:22 backups

root@nextcloud:/media/kensdrive/nextcloud/updater-octgmmwarv5b# ls -ltr downloads/

total 0

root@nextcloud:/media/kensdrive/nextcloud/updater-octgmmwarv5b# ls -ltr backups/

total 4608

drwxrwx— 1 www-data root 524288 Jun 19 2020 nextcloud-18.0.3.0

drwxrwx— 1 www-data root 524288 Sep 24 2020 nextcloud-18.0.6.0

drwxrwx— 1 www-data root 524288 Sep 24 2020 nextcloud-18.0.9.1

drwxrwx— 1 www-data root 524288 Jan 23 2021 nextcloud-19.0.3.1

drwxrwx— 1 www-data root 524288 Aug 10 17:31 nextcloud-19.0.7.1-1628627176

drwxrwx— 1 www-data root 524288 Aug 10 17:52 nextcloud-19.0.13.1-1628628511

drwxrwx— 1 www-data root 524288 Aug 10 18:11 nextcloud-20.0.11.1-1628629592

drwxrwx— 1 www-data root 524288 Jan 19 19:42 nextcloud-21.0.3.1-1642635620

drwxrwx— 1 www-data root 524288 Jan 19 20:24 nextcloud-21.0.3.1-1642641739

root@nextcloud:/media/kensdrive/nextcloud/updater-octgmmwarv5b# du -sh .

104G .

The larger question here really is, if the update process is creating all these backups, shouldn’t it also be managing them? I can write a script that runs once a year and just removes all but, say, the two most recent. Seems like a shortcoming of the nextcloud update process…

Actually this strange, for me it does cleanup and whenever I do major update and will not be able to rollback to some older versions, they are deleted.

ls -la backups/
total 20
drwxr-x---  5 www-data www-data 4096 Nov 19 10:26 .
drwxr-xr-x  4 www-data www-data 4096 Nov 19 10:20 ..
drwxr-x--- 13 www-data www-data 4096 Nov 13 05:07 nextcloud-21.0.5.1-1636776363
drwxr-x--- 13 www-data www-data 4096 Jan  3 03:19 nextcloud-21.0.6.2-1637055699
drwxr-x--- 13 www-data www-data 4096 Jan  3 03:19 nextcloud-21.0.7.0-1637313377
du -sh backups/
3.6G	backups/

Current NC Version is 22.2.3

OMG, it’s a commie plot!

I removed all of mine but the last two and I’m now updating to version 23.0.0.

I’ll see if the problem persists, which I suspect it will, and script a manual solution accordingly.

Thanks for the help ladies!

DFA

well I do see the owner of your directories are www-data www-data, mine are www-data root.

bet that’s it. not sure how to make them be created with those more-better ownership…