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

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Feature Requests
  3. Use `gdu` instead of `du` (was "Exlude du from backup check")

Use `gdu` instead of `du` (was "Exlude du from backup check")

Scheduled Pinned Locked Moved Feature Requests
10 Posts 3 Posters 162 Views 3 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.
  • nichu42N Offline
    nichu42N Offline
    nichu42
    wrote last edited by nebulon
    #1

    Hey there,

    Can I set Cloudron Backup to skip

    shell: backuptask: du --dereference-args --summarize --block-size=1 --exclude=*.lock --exclude=dovecot.list.index.log.* /home/yellowtent/appsdata/c5d30482-9837-4fdb-8c21-04ef653d691c
    

    ?

    It wastes 20 minutes on my Mastodon backup each night. And my S3 won't run out of space any time soon...

    Matrix: @nichu42:beeper.com

    1 Reply Last reply
    2
    • nebulonN Away
      nebulonN Away
      nebulon
      Staff
      wrote last edited by
      #2

      Disabling this is not really possible or exposed as some setting. Once question though is, why does it take so long to just calculate the size of the folder to estimate the backup size?

      nichu42N 1 Reply Last reply
      0
      • nebulonN nebulon

        Disabling this is not really possible or exposed as some setting. Once question though is, why does it take so long to just calculate the size of the folder to estimate the backup size?

        nichu42N Offline
        nichu42N Offline
        nichu42
        wrote last edited by
        #3

        @nebulon I guess because my public Mastodon instance has hundreds of thousands of small files.

        Matrix: @nichu42:beeper.com

        1 Reply Last reply
        0
        • necrevistonnezrN Online
          necrevistonnezrN Online
          necrevistonnezr
          wrote last edited by necrevistonnezr
          #4

          GNU du is single-threaded leading to stalls on scanning hundreds of thousands of files.

          Multi-threaded Alternatives:
          • gdu (in repositories): Go-based, multi-threaded.
          • diskus (Rust, GitHub) : Minimalist CLI total-size calculator.
          Disk Usage Benchmark Comparison

          Dataset: ~400,000 small files across 100,000 directories (~15 GB on NVMe SSD, 8-Core CPU)

          Tool Cold Cache Execution Warm Cache Execution Architecture Source
          gdu ~2.10 s (~1.2x vs diskus) ~500 ms (On par) Go (Parallel Goroutines, SSD-optimized) dundee/gdu GitHub Benchmarks
          du -sh (GNU) 17.78 s (~10x slower) 1098 ms (~2.2x slower) C (Single-threaded coreutils) GNU Coreutils du.c
          diskus 1.75 s (Baseline) ~500 ms (Baseline) Rust (Parallel crossbeam traversal) sharkdp/diskus GitHub Benchmark

          On non-cached disks (e.g., night-time cron tasks), multi-threaded tools (gdu, diskus) bypass the stat() I/O latency bottleneck by querying drive metadata across all CPU threads concurrently.

          NOT a full drop-In Replacement for Scripts

          Command Comparison
          Original GNU du

          du --dereference-args --summarize --block-size=1 --exclude=*.lock --exclude=dovecot.list.index.log.* /home/yellowtent/
          

          Script-Compatible gdu Drop-In

          gdu -ns -a --no-prefix -L -I ".*\.lock,dovecot\.list\.index\.log.*" /home/yellowtent/ | awk '{print $1"\t"$2}'
          
          Flag Mapping
          GNU du gdu Equivalent Purpose
          -s, --summarize -s Output total size only
          --block-size=1 -a --no-prefix Raw byte count (no unit suffix)
          -D, --dereference-args -L Follow symlinks
          --exclude=A --exclude=B -I "A,B" Comma-separated exclude patterns
          N/A -n Non-interactive mode (disables TUI)
          Key Caveats
          • Delimiter (Tab vs. Space): GNU du separates bytes and path with \t. gdu uses spaces. Piping to awk '{print $1"\t"$2}' prevents broken cut -f1 parsers in scripts.
          • Symlink Scope: GNU du --dereference-args resolves symlinks only at the root level. gdu -L resolves all internal symlinks recursively, which can inflate total calculated sizes.
          • Exit Codes: gdu -n silently skips unreadable files and exits 0. GNU du exits 1 on permission errors, which backup scripts often monitor.
          1 Reply Last reply
          2
          • necrevistonnezrN Online
            necrevistonnezrN Online
            necrevistonnezr
            wrote last edited by necrevistonnezr
            #5

            Just tested on my machine: When not excluding anything (i.e. including maildir to simulate a folder with hundreds of thousands of files):

            du

            time (du -h --dereference-args --summarize --block-size=1 /home/yellowtent/ | sort -hr) 
            
            „Warm Cache“:
            real  0m0,617s
            user  0m0,139s
            sys   0m0,482s
            
            After reboot (to simulate cold cache):
            real  0m12,146s
            user  0m0,347s
            sys   0m1,733s
            

            gdu

            time (gdu -ns -a --no-prefix -L -I /home/yellowtent/ | awk '{print $1"\t"$2}')
            
            „Warm cache“:
            real  0m0,239s
            user  0m0,391s
            sys   0m0,372s
            
            After reboot (to simulate cold cache):
            real  0m2,844s
            user  0m0,729s
            sys   0m1,652s
            
            1 Reply Last reply
            1
            • nichu42N Offline
              nichu42N Offline
              nichu42
              wrote last edited by nichu42
              #6

              I have an 8 Core Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz VPS.
              My Mastodon app data directory has ~ 450,000 files.

              Matrix: @nichu42:beeper.com

              necrevistonnezrN 1 Reply Last reply
              0
              • nebulonN Away
                nebulonN Away
                nebulon
                Staff
                wrote last edited by
                #7

                woah that is a lot of files! But I have also seen my personal instance growing the file count a lot. I have set the cache retention days to 1 without noticable issues, it may have to refetch from the federated instance a bit more often if those posts do come up. Maybe this can help your instance also with file counts https://docs.cloudron.io/packages/mastodon#cache-retention-days

                1 Reply Last reply
                1
                • nichu42N Offline
                  nichu42N Offline
                  nichu42
                  wrote last edited by
                  #8

                  1 day would be good for me, but most of my users log in once a week, so I cut it down to 7 days.
                  I have also resumed my project of moving to S3, and I think I have everything ready now. I am currently waiting for my user's browser caches to catch up with the new CSP, so images won't break when I do the switch.

                  But changing to gdu as suggested by @necrevistonnezr seems to be a good idea anyway.

                  Matrix: @nichu42:beeper.com

                  1 Reply Last reply
                  0
                  • nebulonN nebulon moved this topic from Discuss
                  • nebulonN Away
                    nebulonN Away
                    nebulon
                    Staff
                    wrote last edited by
                    #9

                    I have moved it to feature request section and adjusted the title now

                    1 Reply Last reply
                    2
                    • nichu42N nichu42

                      I have an 8 Core Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz VPS.
                      My Mastodon app data directory has ~ 450,000 files.

                      necrevistonnezrN Online
                      necrevistonnezrN Online
                      necrevistonnezr
                      wrote last edited by necrevistonnezr
                      #10

                      @nichu42 said:

                      I have an 8 Core Intel(R) Xeon(R) Gold 6142 CPU @ 2.60GHz VPS.
                      My Mastodon app data directory has ~ 450,000 files.

                      FYI my yellowtent folder has ~ 250.000 files on an SSD - just to give you perspective on the benchmarks.

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      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