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
  • 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 | 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
12 Posts 4 Posters 463 Views 4 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 Offline
    J Offline
    jayonrails
    translator
    wrote on last edited by
    #1

    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 1 Reply Last reply
    0
    • J Offline
      J Offline
      jayonrails
      translator
      wrote on last edited by
      #2
      root@258e2da2-ade7-441e-a8b2-11897f7d8acf:/app/code# sudo -u www-data php -f /app/code/occ files:cleanup
      0 orphaned file cache entries deleted
      0 orphaned file cache extended entries deleted
      0 orphaned mount entries deleted
      

      This also didn't help. Recreating the index for all users also doesn't bring any change in the calculated used space.

      jdaviescoatesJ 1 Reply Last reply
      0
      • J jayonrails
        root@258e2da2-ade7-441e-a8b2-11897f7d8acf:/app/code# sudo -u www-data php -f /app/code/occ files:cleanup
        0 orphaned file cache entries deleted
        0 orphaned file cache extended entries deleted
        0 orphaned mount entries deleted
        

        This also didn't help. Recreating the index for all users also doesn't bring any change in the calculated used space.

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

        @jayonrails have you checked Jay's Nextcloud trash/ deleted files?

        I use Cloudron with Gandi & Hetzner

        1 Reply Last reply
        0
        • J Offline
          J Offline
          joseph
          Staff
          wrote on last edited by
          #4

          Maybe https://docs.cloudron.io/apps/nextcloud/#managing-deleted-files ?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jayonrails
            translator
            wrote on last edited by
            #5

            Thanks for your suggeestions, deleted files is empty on all users.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              joseph
              Staff
              wrote on last edited by
              #6

              Do you have versioning enabled (probably via some plugin of nextcloud)?

              Otherwise, open a Web Terminal and cd /app/data and du -hcs <folder> to try to find out what is taking the space.

              1 Reply Last reply
              0
              • 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 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 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 1 Reply Last reply
                      2
                      • 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 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
                        2
                        • jdaviescoatesJ Offline
                          jdaviescoatesJ Offline
                          jdaviescoates
                          wrote 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
                          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