[Bug 2132245] [NEW] "du" is double-counting hard links when multiple arguments specified
Nick Tait
2132245 at bugs.launchpad.net
Sun Nov 23 09:23:30 UTC 2025
Public bug reported:
I have a script that uses "du" to show the disk space taken up by
historical backups. The backups are in separate folders, and there are a
lot of hard links shared between the folders (i.e. where there were no
changes to the files between backups).
Using the original version of "du", I could specify the (multiple)
backup folders on the command line, and a given file's disk usage
wouldn't be counted if it had been included in an an earlier folder.
(The reason this was useful was to know how much space could be freed up
by deleting the oldest backups.) For example:
$ du -h /opt/backup/2025-10-26 /opt/backup/2025-10-22 /opt/backup/2025-10-19
8.1G /opt/backup/2025-10-26
6.7G /opt/backup/2025-10-22
6.7G /opt/backup/2025-10-19
FYI Running 3 separate du commands highlights the shared disk usage
(i.e. 8.2G for #2 & #3 instead of 6.7G above):
$ du -h /opt/backup/2025-10-26
8.1G /opt/backup/2025-10-26
$ du -h /opt/backup/2025-10-22
8.2G /opt/backup/2025-10-22
$ du -h /opt/backup/2025-10-19
8.2G /opt/backup/2025-10-19
However since upgrading to Ubuntu 25.10 this has stopped working. Now
each argument passed to du seems to be processed independently, as shown
by the following example (from a different server):
$ du -h /opt/backup/2025-10-26 /opt/backup/2025-10-22 /opt/backup/2025-10-19
42G /opt/backup/2025-10-26
42G /opt/backup/2025-10-22
42G /opt/backup/2025-10-19
Which is the same as you get when running 3 separate du commands:
$ du -h /opt/backup/2025-10-26
42G /opt/backup/2025-10-26
$ du -h /opt/backup/2025-10-22
42G /opt/backup/2025-10-22
$ du -h /opt/backup/2025-10-19
42G /opt/backup/2025-10-19
Can you please look at restoring the behaviour of the original "du"
command when passing in multiple arguments?
-----
$ lsb_release -rd
Description: Ubuntu 25.10
Release: 25.10
$ apt-cache policy rust-coreutils
rust-coreutils:
Installed: (none)
Candidate: 0.0.30-1
Version table:
0.0.30-1 500
500 http://nz.archive.ubuntu.com/ubuntu plucky/universe amd64 Packages
** Affects: rust-coreutils (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/2132245
Title:
"du" is double-counting hard links when multiple arguments specified
Status in rust-coreutils package in Ubuntu:
New
Bug description:
I have a script that uses "du" to show the disk space taken up by
historical backups. The backups are in separate folders, and there are
a lot of hard links shared between the folders (i.e. where there were
no changes to the files between backups).
Using the original version of "du", I could specify the (multiple)
backup folders on the command line, and a given file's disk usage
wouldn't be counted if it had been included in an an earlier folder.
(The reason this was useful was to know how much space could be freed
up by deleting the oldest backups.) For example:
$ du -h /opt/backup/2025-10-26 /opt/backup/2025-10-22 /opt/backup/2025-10-19
8.1G /opt/backup/2025-10-26
6.7G /opt/backup/2025-10-22
6.7G /opt/backup/2025-10-19
FYI Running 3 separate du commands highlights the shared disk usage
(i.e. 8.2G for #2 & #3 instead of 6.7G above):
$ du -h /opt/backup/2025-10-26
8.1G /opt/backup/2025-10-26
$ du -h /opt/backup/2025-10-22
8.2G /opt/backup/2025-10-22
$ du -h /opt/backup/2025-10-19
8.2G /opt/backup/2025-10-19
However since upgrading to Ubuntu 25.10 this has stopped working. Now
each argument passed to du seems to be processed independently, as
shown by the following example (from a different server):
$ du -h /opt/backup/2025-10-26 /opt/backup/2025-10-22 /opt/backup/2025-10-19
42G /opt/backup/2025-10-26
42G /opt/backup/2025-10-22
42G /opt/backup/2025-10-19
Which is the same as you get when running 3 separate du commands:
$ du -h /opt/backup/2025-10-26
42G /opt/backup/2025-10-26
$ du -h /opt/backup/2025-10-22
42G /opt/backup/2025-10-22
$ du -h /opt/backup/2025-10-19
42G /opt/backup/2025-10-19
Can you please look at restoring the behaviour of the original "du"
command when passing in multiple arguments?
-----
$ lsb_release -rd
Description: Ubuntu 25.10
Release: 25.10
$ apt-cache policy rust-coreutils
rust-coreutils:
Installed: (none)
Candidate: 0.0.30-1
Version table:
0.0.30-1 500
500 http://nz.archive.ubuntu.com/ubuntu plucky/universe amd64 Packages
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2132245/+subscriptions
More information about the foundations-bugs
mailing list