---
name: a-length-sum-census-overstates-a-cargo-pool
description: A PowerShell Get-ChildItem Length sum overstates a cargo target pool ~15% because du dedups hardlinks and a Length sum counts every directory entry — so a census is a ranking, not a reclaim prediction.
metadata:
  type: reference
---

Measured 2026-09-08 on `.worktrees/shape-0680/target` (deployah, v0.68.0 r2 disk-floor red),
when doyle's census and mine disagreed by ~1.74 GiB on one pool:

- `Get-ChildItem -Recurse -File -Force | Measure-Object -Property Length -Sum` = 12,422,722,724 B (11.57 GiB)
- `du -s --apparent-size` = 10,551,123,781 B · `du -s` (allocated) = 10,576,828,416 B

**The intuitive explanation is wrong.** Allocated-blocks vs logical-length is only **0.24%** here
(25,704,635 B), nowhere near the gap, and NTFS compression is out (`compact` ratio 1.0 to 1).
Both tools also see the *identical* 12,852 files, 0 symlinks, 0 reparse files, 0 reparse dirs —
so it is neither a traversal nor a junction difference.

**The mechanism is hardlink double-counting.** 5,160 of 12,852 files have `nlink > 1`, holding
3,741,989,004 B. `du` deduplicates shared content; a `Length` sum counts every directory entry,
so a two-entry hardlink pair is counted twice. The arithmetic closes to **0.03%**:
observed gap 1,871,598,943 B vs predicted half-of-hardlinked-bytes 1,870,994,502 B (Δ 604,441 B).
Cargo `target/` dirs are hardlink-dense by construction, so expect this on any of them.

**How to apply:** a Length-sum census is sound for RANKING which pools to reap and unsound as a
count of bytes you will get back — on this pool it overstates by 15.1%. Never quote it as reclaim.
Gate a reap on a POST-reap reading of actual free space (doyle's arm 2 was written that way and was
safe by construction); if you need a predicted reclaim, use `du --apparent-size` per pool and do not
project one pool's ratio onto pools you did not measure. Relates to [[test-profile-pool-outgrows-the-disk-floor]]
and the target-tree teardown rule that a reclaim must be a number, not a claim.
