[GH-ISSUE #517] show amount of disk space used by files with zero hardlinks #226

Open
opened 2026-06-08 11:26:14 +03:00 by zhus · 4 comments
Owner

Originally created by @lolbinarycat on GitHub (Jul 11, 2025).
Original GitHub issue: https://github.com/bootandy/dust/issues/517

unlinked files generally occur one of two ways:

  1. unnamed temporaries
  2. a file has been deleted, but its file descriptor is still held open.

I recently encountered a situation where tmpfs got filled up by a logfile, and then removing the logfile did not actually free up any space, because the program was still holding the fd of the logfile.

These files are not seen by programs like du, however, df is able to see the total amount of space used on a drive, including unlinked files, so simple subtraction could be used to see how much of the disk is taken up by unlinked files.

Originally created by @lolbinarycat on GitHub (Jul 11, 2025). Original GitHub issue: https://github.com/bootandy/dust/issues/517 unlinked files generally occur one of two ways: 1. unnamed temporaries 2. a file has been deleted, but its file descriptor is still held open. I recently encountered a situation where tmpfs got filled up by a logfile, and then removing the logfile did not actually free up any space, because the program was still holding the fd of the logfile. These files are not seen by programs like `du`, however, `df` is able to see the total amount of space used on a drive, including unlinked files, so simple subtraction could be used to see how much of the disk is taken up by unlinked files.
Author
Owner

@bootandy commented on GitHub (Jul 11, 2025):

is this the same as: https://github.com/bootandy/dust/issues/444 ?

<!-- gh-comment-id:3063356070 --> @bootandy commented on GitHub (Jul 11, 2025): is this the same as: https://github.com/bootandy/dust/issues/444 ?
Author
Owner

@lolbinarycat commented on GitHub (Jul 11, 2025):

Similar, but I'm proposing a much simpler solution: just ask the fs for the total used space (like how df does), then subtracting the size of named files from that, and displaying that number if it is significant.

<!-- gh-comment-id:3063467249 --> @lolbinarycat commented on GitHub (Jul 11, 2025): Similar, but I'm proposing a much simpler solution: just ask the fs for the total used space (like how `df` does), then subtracting the size of named files from that, and displaying that number if it is significant.
Author
Owner

@bootandy commented on GitHub (Aug 13, 2025):

Can you tell me how I can create that situation - I need to be able to create it before I can process it. - Some method of creating and removing files/symlinks ? (I have ext4 and tmpfs).

<!-- gh-comment-id:3184632525 --> @bootandy commented on GitHub (Aug 13, 2025): Can you tell me how I can create that situation - I need to be able to create it before I can process it. - Some method of creating and removing files/symlinks ? (I have ext4 and tmpfs).
Author
Owner

@lolbinarycat commented on GitHub (Aug 13, 2025):

symlinks have nothing to do with this.

you can either use O_TMPFILE, or you can create a file, open it, then delete it while holding the file descriptor. in both cases the file will only stay alive while the fd lives, which means having a process stay running while you're testing.

<!-- gh-comment-id:3184836629 --> @lolbinarycat commented on GitHub (Aug 13, 2025): symlinks have nothing to do with this. you can either use O_TMPFILE, or you can create a file, open it, then delete it while holding the file descriptor. in both cases the file will only stay alive while the fd lives, which means having a process stay running while you're testing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#226