[GH-ISSUE #282] Count hard links only once between multiple directories on the command-line? #126

Closed
opened 2026-06-08 11:25:47 +03:00 by zhus · 2 comments
Owner

Originally created by @cr1901 on GitHub (Dec 14, 2022).
Original GitHub issue: https://github.com/bootandy/dust/issues/282

Consider the following two commands, where backups/foo/baz and backups/bar/baz have some files in them w/ the same inode (i.e multiple hard links):

du -sch backups/{foo,bar}/baz
...
7.6G    total
dust backups/{foo,bar}/baz
...
 10G ┌─┴ (total)

The -c option of du cumulatively prints the total disk usage for all input arguments (files or directories). This is useful for figuring out cumulative disk usage of similar trees that aren't in the same subdirectory. The -c option to du is hard-link aware.

dust doesn't seem to need a -c option to give the same information. However, it appears that dust counts files with the same inode more than once if given multiple directories on the command line (hence the difference in size in my example). Is there a way to make dust hard-link aware between multiple directories/files provided as input arguments?

(Additionally, should a -d of 0, still print out at least the top-level directory size for each input argument as well as a total?)

Version

william@xubuntu-dtrain:/shares/wjones/work/rdiff-test$ dust -V
Dust 0.8.3
Originally created by @cr1901 on GitHub (Dec 14, 2022). Original GitHub issue: https://github.com/bootandy/dust/issues/282 Consider the following two commands, where `backups/foo/baz` and `backups/bar/baz` have some files in them w/ the same inode (i.e multiple hard links): ```sh du -sch backups/{foo,bar}/baz ... 7.6G total ``` ``` dust backups/{foo,bar}/baz ... 10G ┌─┴ (total) ``` The `-c` option of `du` cumulatively prints the total disk usage for all input arguments (files or directories). This is useful for figuring out cumulative disk usage of similar trees that aren't in the same subdirectory. _The `-c` option to `du` is hard-link aware._ `dust` doesn't seem to need a `-c` option to give the same information. However, it appears that `dust` counts files with the same inode more than once if given multiple directories on the command line (hence the difference in size in my example). Is there a way to make `dust` hard-link aware _between_ multiple directories/files provided as input arguments? (Additionally, should a `-d` of `0`, still print out at least the top-level directory size for each input argument as well as a total?) ## Version ```sh william@xubuntu-dtrain:/shares/wjones/work/rdiff-test$ dust -V Dust 0.8.3 ```
zhus closed this issue 2026-06-08 11:25:47 +03:00
Author
Owner

@bootandy commented on GitHub (Jan 4, 2023):

However, it appears that dust counts files with the same inode more than once if given multiple directories on the command line

Well found. That counts as a bug. I'll look at fixing it.

(Additionally, should a -d of 0, still print out at least the top-level directory size for each input argument as well as a total?)

Yes I think it should, I never thought about that. I'll add it to the todo-list

<!-- gh-comment-id:1371328467 --> @bootandy commented on GitHub (Jan 4, 2023): > However, it appears that dust counts files with the same inode more than once if given multiple directories on the command line Well found. That counts as a bug. I'll look at fixing it. > (Additionally, should a -d of 0, still print out at least the top-level directory size for each input argument as well as a total?) Yes I think it should, I never thought about that. I'll add it to the todo-list
Author
Owner

@cr1901 commented on GitHub (Jan 8, 2023):

Excellent, tyvm for your good work! It seems to work for my immediate use case. There are more things I'd like to add to dust and/or discuss adding, but I'm trying to remove projects from my stack right now.

So any bugs I want to file/PRs I want to make will have to wait for now :(...

<!-- gh-comment-id:1374612987 --> @cr1901 commented on GitHub (Jan 8, 2023): Excellent, tyvm for your good work! It seems to work for my immediate use case. There are more things I'd like to add to `dust` and/or discuss adding, but I'm trying to _remove_ projects from my stack right now. So any bugs I want to file/PRs I want to make will have to wait for now :(...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#126