Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Nextcloud
  3. 33 GB of usage, 177 GB system space occupied - how to find ghost files?

33 GB of usage, 177 GB system space occupied - how to find ghost files?

Scheduled Pinned Locked Moved Nextcloud
16 Posts 5 Posters 2.8k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J jayonrails

    Hi,

    I am running the following setup:

    • Cloudron v8.2.4
    • Nextcloud package com.nextcloud.cloudronapp@4.23.4

    There are a few users in Nextcloud, using 33 GB in total storage if you add up the usage that is shown at //settings/users

    When I open up Cloudron system information and let it calculate the disk usage, it shows me that Nextcloud is using 177.08 GB of storage on the Cloudron server.

    When running

    sudo -u www-data php -f /app/code/occ files:scan jay
    

    I get the following output:

    root@258e2da2-ade7-441e-a8b2-11897f7d8acf:/app/code# sudo -u www-data php -f /app/code/occ files:scan jay
    Starting scan for user 1 out of 1 (jay)
     +---------+-------+-----+---------+---------+--------+--------------+
    | Folders | Files | New | Updated | Removed | Errors | Elapsed time |
    +---------+-------+-----+---------+---------+--------+--------------+
    | 233     | 6319  | 0   | 6547    | 0       | 0      | 00:00:09     |
    +---------+-------+-----+---------+---------+--------+--------------+
    

    User "jay" is the only one having more than just a few KB of files.

    I remember that some file uploads to the Nextcloud system failed a few months ago and I think these might be still stored somewhere, where the application cannot find it, but still take space.

    How can I find those?

    Best
    Jay

    J Offline
    J Offline
    jayonrails
    translator
    wrote on last edited by
    #7

    @jayonrails said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:

    I remember that some file uploads to the Nextcloud system failed a few months ago and I think these might be still stored somewhere, where the application cannot find it, but still take space.

    I was right on this one. I downloaded all the files that are present on the Nextcloud, deleted all the servers on the web interface and then re-synced from my computer. The ghost files are gone, it is now using around the 33 GB as I would have expected it.

    Nextcloud is great tool, but sometimes does weird things. This is one example of being weird.

    The issue is resolved for now, thanks for your ideas on it.

    jdaviescoatesJ 1 Reply Last reply
    3
    • J jayonrails

      @jayonrails said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:

      I remember that some file uploads to the Nextcloud system failed a few months ago and I think these might be still stored somewhere, where the application cannot find it, but still take space.

      I was right on this one. I downloaded all the files that are present on the Nextcloud, deleted all the servers on the web interface and then re-synced from my computer. The ghost files are gone, it is now using around the 33 GB as I would have expected it.

      Nextcloud is great tool, but sometimes does weird things. This is one example of being weird.

      The issue is resolved for now, thanks for your ideas on it.

      jdaviescoatesJ Offline
      jdaviescoatesJ Offline
      jdaviescoates
      wrote on last edited by
      #8

      @jayonrails good one!

      Out of interest I asked ChatGPT where partially uploaded files might be within Nextcloud and the advice it gave was:

      • Delete files in /data/<user>/uploads/
      • Clear /data/tmp/
      • Remove .part files
      • Fix database with occ files:scan --all
      • Run occ files:cleanup to remove orphaned files

      I use Cloudron with Gandi & Hetzner

      1 Reply Last reply
      2
      • jdaviescoatesJ Offline
        jdaviescoatesJ Offline
        jdaviescoates
        wrote on last edited by
        #9

        I facing this issue now too. My users are using about 90GB but Cloudron says it's nearly 160GB (and that's after deleting all my deleted items). I'm struggling to find the 70GB of ghost files so I can remove them!

        I use Cloudron with Gandi & Hetzner

        1 Reply Last reply
        0
        • jdaviescoatesJ Offline
          jdaviescoatesJ Offline
          jdaviescoates
          wrote on last edited by jdaviescoates
          #10

          🧹 How to Find and Delete Ghost Files in Nextcloud (Cloudron)

          If you're seeing way more disk space used than expected in your Nextcloud app (33 GB used but 177 GB occupied etc.), here are some terminal commands you can run inside the app to identify and clean up ghost files, previews, app caches, and more.

          To open the terminal:
          Cloudron Dashboard β†’ Nextcloud β†’ Terminal (Web Terminal tab)


          πŸ” Check Overall Disk Usage

          du -sh /app/data
          

          See how much disk space is used by Nextcloud's data directory.


          πŸ“‚ List Folder Sizes in /app/data

          du -sh /app/data/* | sort -h
          

          This shows usage per user/app folder so you can spot what's bloating.


          🧼 Clean Common Space Hogs

          1. Delete Preview Cache (safe to delete)

          rm -rf /app/data/appdata_*/preview/*
          

          You can regenerate them later as needed.


          2. Delete Old File Versions & Deleted Files

          occ versions:cleanup
          occ trashbin:expire
          occ trashbin:cleanup
          

          If that doesn’t clear enough, nuke them manually:

          rm -rf /app/data/*/files_versions/*
          rm -rf /app/data/*/files_trashbin/*
          

          3. Clear Unused App Data (e.g. SnappyMail)

          If you’re not using the built-in SnappyMail app and use external email instead:

          rm -rf /app/data/appdata_snappymail
          

          ⚠️ Make sure your email is stored elsewhere (e.g. Cloudron mail server) before deleting.


          πŸ” Reindex Files After Cleanup

          occ files:scan --all
          

          This updates Nextcloud’s file index to reflect the actual files on disk.


          πŸ›‘ Disable or Remove Unused Apps

          If not using an app, stop it from consuming space:

          occ app:disable snappymail
          occ app:remove snappymail
          

          πŸ’‘ Bonus: See Per-User File Usage

          du -sh /app/data/*/files | sort -h
          

          These steps helped me recover over 50 GB of space (from 142 GB β†’ 87 GB) just by clearing previews and unused mail cache. Hopefully they help you too! πŸ‘£

          Let me know if you spot anything else that tends to grow quietly.

          I use Cloudron with Gandi & Hetzner

          humptydumptyH jdaviescoatesJ 2 Replies Last reply
          3
          • jdaviescoatesJ jdaviescoates

            🧹 How to Find and Delete Ghost Files in Nextcloud (Cloudron)

            If you're seeing way more disk space used than expected in your Nextcloud app (33 GB used but 177 GB occupied etc.), here are some terminal commands you can run inside the app to identify and clean up ghost files, previews, app caches, and more.

            To open the terminal:
            Cloudron Dashboard β†’ Nextcloud β†’ Terminal (Web Terminal tab)


            πŸ” Check Overall Disk Usage

            du -sh /app/data
            

            See how much disk space is used by Nextcloud's data directory.


            πŸ“‚ List Folder Sizes in /app/data

            du -sh /app/data/* | sort -h
            

            This shows usage per user/app folder so you can spot what's bloating.


            🧼 Clean Common Space Hogs

            1. Delete Preview Cache (safe to delete)

            rm -rf /app/data/appdata_*/preview/*
            

            You can regenerate them later as needed.


            2. Delete Old File Versions & Deleted Files

            occ versions:cleanup
            occ trashbin:expire
            occ trashbin:cleanup
            

            If that doesn’t clear enough, nuke them manually:

            rm -rf /app/data/*/files_versions/*
            rm -rf /app/data/*/files_trashbin/*
            

            3. Clear Unused App Data (e.g. SnappyMail)

            If you’re not using the built-in SnappyMail app and use external email instead:

            rm -rf /app/data/appdata_snappymail
            

            ⚠️ Make sure your email is stored elsewhere (e.g. Cloudron mail server) before deleting.


            πŸ” Reindex Files After Cleanup

            occ files:scan --all
            

            This updates Nextcloud’s file index to reflect the actual files on disk.


            πŸ›‘ Disable or Remove Unused Apps

            If not using an app, stop it from consuming space:

            occ app:disable snappymail
            occ app:remove snappymail
            

            πŸ’‘ Bonus: See Per-User File Usage

            du -sh /app/data/*/files | sort -h
            

            These steps helped me recover over 50 GB of space (from 142 GB β†’ 87 GB) just by clearing previews and unused mail cache. Hopefully they help you too! πŸ‘£

            Let me know if you spot anything else that tends to grow quietly.

            humptydumptyH Offline
            humptydumptyH Offline
            humptydumpty
            wrote on last edited by
            #11

            @jdaviescoates said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:

            🧹 How to Find and Delete Ghost Files in Nextcloud (Cloudron)

            This should be a stickied post. Thanks for sharing!

            1 Reply Last reply
            3
            • jdaviescoatesJ Offline
              jdaviescoatesJ Offline
              jdaviescoates
              wrote on last edited by
              #12

              Yeah. @staff I imagine this is quite a common issue - perhaps make it a Guide/ add it to docs? πŸ™‚

              I use Cloudron with Gandi & Hetzner

              1 Reply Last reply
              2
              • jamesJ Offline
                jamesJ Offline
                james
                Staff
                wrote on last edited by
                #13

                Hello @nextcloud users -

                Thanks, @jdaviescoates for the great write-up.
                Would you like to add this to the https://docs.cloudron.io/guides/community/ section with a PR or should I do this and credit you in the guide?

                jdaviescoatesJ 1 Reply Last reply
                2
                • jamesJ james

                  Hello @nextcloud users -

                  Thanks, @jdaviescoates for the great write-up.
                  Would you like to add this to the https://docs.cloudron.io/guides/community/ section with a PR or should I do this and credit you in the guide?

                  jdaviescoatesJ Offline
                  jdaviescoatesJ Offline
                  jdaviescoates
                  wrote on last edited by
                  #14

                  @james I'm a bit over stretched at the mo so if you could do it that'd be great, thanks πŸ™‚

                  I use Cloudron with Gandi & Hetzner

                  1 Reply Last reply
                  1
                  • jdaviescoatesJ jdaviescoates

                    🧹 How to Find and Delete Ghost Files in Nextcloud (Cloudron)

                    If you're seeing way more disk space used than expected in your Nextcloud app (33 GB used but 177 GB occupied etc.), here are some terminal commands you can run inside the app to identify and clean up ghost files, previews, app caches, and more.

                    To open the terminal:
                    Cloudron Dashboard β†’ Nextcloud β†’ Terminal (Web Terminal tab)


                    πŸ” Check Overall Disk Usage

                    du -sh /app/data
                    

                    See how much disk space is used by Nextcloud's data directory.


                    πŸ“‚ List Folder Sizes in /app/data

                    du -sh /app/data/* | sort -h
                    

                    This shows usage per user/app folder so you can spot what's bloating.


                    🧼 Clean Common Space Hogs

                    1. Delete Preview Cache (safe to delete)

                    rm -rf /app/data/appdata_*/preview/*
                    

                    You can regenerate them later as needed.


                    2. Delete Old File Versions & Deleted Files

                    occ versions:cleanup
                    occ trashbin:expire
                    occ trashbin:cleanup
                    

                    If that doesn’t clear enough, nuke them manually:

                    rm -rf /app/data/*/files_versions/*
                    rm -rf /app/data/*/files_trashbin/*
                    

                    3. Clear Unused App Data (e.g. SnappyMail)

                    If you’re not using the built-in SnappyMail app and use external email instead:

                    rm -rf /app/data/appdata_snappymail
                    

                    ⚠️ Make sure your email is stored elsewhere (e.g. Cloudron mail server) before deleting.


                    πŸ” Reindex Files After Cleanup

                    occ files:scan --all
                    

                    This updates Nextcloud’s file index to reflect the actual files on disk.


                    πŸ›‘ Disable or Remove Unused Apps

                    If not using an app, stop it from consuming space:

                    occ app:disable snappymail
                    occ app:remove snappymail
                    

                    πŸ’‘ Bonus: See Per-User File Usage

                    du -sh /app/data/*/files | sort -h
                    

                    These steps helped me recover over 50 GB of space (from 142 GB β†’ 87 GB) just by clearing previews and unused mail cache. Hopefully they help you too! πŸ‘£

                    Let me know if you spot anything else that tends to grow quietly.

                    jdaviescoatesJ Offline
                    jdaviescoatesJ Offline
                    jdaviescoates
                    wrote last edited by jdaviescoates
                    #15

                    said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:

                    occ versions:cleanup

                    My server was filling up again and this command by itself just reduced my personal Nextcloud files space from 140GB to 87GB!

                    With that in mind I just ran this code in the Web Terminal to automatically bin versions after 30 days:

                    occ config:app:set files_versions max_age --value="30"
                    

                    I also did this so versions are kept for at least 7 days too:

                    occ config:app:set files_versions min_age --value="7"
                    

                    I use Cloudron with Gandi & Hetzner

                    humptydumptyH 1 Reply Last reply
                    2
                    • jdaviescoatesJ jdaviescoates

                      said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:

                      occ versions:cleanup

                      My server was filling up again and this command by itself just reduced my personal Nextcloud files space from 140GB to 87GB!

                      With that in mind I just ran this code in the Web Terminal to automatically bin versions after 30 days:

                      occ config:app:set files_versions max_age --value="30"
                      

                      I also did this so versions are kept for at least 7 days too:

                      occ config:app:set files_versions min_age --value="7"
                      
                      humptydumptyH Offline
                      humptydumptyH Offline
                      humptydumpty
                      wrote last edited by humptydumpty
                      #16

                      @jdaviescoates Pure gold! I just cleaned up 30ish GBπŸ‘Œ

                      I hope setting the max/min age to 30/7 should prevent this from building up anytime soon.

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search