On 4/29/2019 4:36 AM, David Ellenberger wrote: > Dear maintainers > > I understand that admins have become accustomed to see 4096 in directories > as it's consistent with the ls command and the technicality behind it. > --- Except that it isn't 4096 on all file systems. For empty directories, I usually see 0 bytes allocated. And for very large directories, it may be megabytes of space in the directory. The directory takes real space on linux/unix and different depending on what filesystem you use. On windows in NTFS, directories, I think can be virtual since the meta info and names are in a file control block. In that single case, the directories may really take zero space in the file system, but that's a quirk of how NTFS works in windows. If the real intent is to measure used disk space, including directories seems advisable as they can take real space on most file systems that is counted against a user quota if it exists.
Confusingly, depending on the file-allocation block size on the source and target (they are often 4k, but don't have to be) and on the amount of ***fragmentation*** in the free space, of the source and target. If free space is heavily fragmented, a directory may need to be spread out into several areas, making it larger than necessary if free space wasn't so fragmented. That's why you often hear people say you should keep about 15-25% of your disk space free -- thats so large contiguous areas won't entirely disappear and storage will be more efficient. Anyway, just my opinion, but not sure if du should exclude directories entirely, but I wouldn't be against separate subtotal lines for directories and files -- that would make it even more helpful!