Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to produce exact same byte count totals as du #144

Closed
omac777 opened this issue Apr 26, 2023 · 8 comments
Closed

how to produce exact same byte count totals as du #144

omac777 opened this issue Apr 26, 2023 · 8 comments

Comments

@omac777
Copy link

omac777 commented Apr 26, 2023

Firstly, I want to say I find your app very useful and cool. Cheers to that.

I want to place confidence in erdtree for listing files/directories totals, but my issue with it is I cannot achieve the same totals as what I am used to seeing with du -cab which for me is a gold standard. The byte count is different when I list erdtree itself du vs erdtree. Why is that?

erd

time ./target/release/erd --hidden --no-color ~/erdtree/
20463616 B erdtree
36 directories, 110 files
real	0m0.006s

versus du

time du -cab ~/erdtree/
233522328	total
real	0m0.017s

How do I produce different du usages with erdtree with identical results(byte count totals)? It would be useful to have such a table.

Thank you for reading this far.

@ilyapopov
Copy link

ilyapopov commented Apr 26, 2023

You need to add at least -no-ignore. This will get you close, but still not exact.

@ilyapopov
Copy link

Also, flag -b for du implies --apparent-size, which should be equivalent to --disk-usage logical for erd, but result is still not identical.

@solidiquis
Copy link
Owner

As @ilyapopov mentioned, definitely try passing in -i, --no-ignore in as well as --disk-usage logical which is essentially --apparent-size. .gitignore is respected by default and as mentioned in the README, any file filtered out by .gitignore will not be included in the total disk usage.

Additionally, two things to note:

If you'd rather erdtree behave as du as in no filtering by default, be sure to make use of a configuration file.

Regarding differences to du:

du returns filesystem block usage by default. erdtree returns the physical size in bytes by default.

Additionally, the amount of blocks reported by du can vary. From the man page for du:

       Display values are in units of the first available SIZE from
       --block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE
       environment variables.  Otherwise, units default to 1024 bytes
       (or 512 if POSIXLY_CORRECT is set).

erdtree defaults to st_size which is 512 bytes.

erdtree is much more like dust in how disk usage is reported by default.

If you'd like an option for more du-like reporting that can be added.

@Vollbrecht
Copy link

i have a large directory. Running with erd -i.HL 1 -u=si -d=physical i get the following report of the size of the dir.

 40.97 GB esp_rust

292 directories, 320 files

using du -hls ./ in that same dir i got

47G     ./

when i am using the -d=logical erdtree even reports less.
Thanks for your great tool anyway! Because of the tool i started more to think about how tools measure disk-sizes. Its similar in that regard to tools like top, htop etc and the question how much ram is in use currently systemwide. Every tool gives you a different answer, depending of an internal definition of what it is checking.

@ilyapopov
Copy link

-l flag for du makes it count hardlinked files multiple times, while erd counts them only once. I don't see a flag in erd to change this behavior.

@solidiquis
Copy link
Owner

solidiquis commented Apr 26, 2023

-l flag for du makes it count hardlinked files multiple times, while erd counts them only once. I don't see a flag in erd to change this behavior.

@ilyapopov that seems to be an issue. I will address this.

@solidiquis
Copy link
Owner

@Vollbrecht yeah I will include in the documentation later what is actually being considered what computing disk usage to make it clear :]

@solidiquis
Copy link
Owner

solidiquis commented May 25, 2023

Closed by #172

This is going to be included in the v3.0 release tonight.

Here's how to get the same output as du

$ erd --layout flat --disk-usage block --no-ignore --hidden --level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants