Count hard links separately when sizing virtual disks (#330055)

This commit is contained in:
misuzu 2024-12-04 21:44:45 +02:00 committed by GitHub
commit 6eac218f2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -473,7 +473,7 @@ let format' = format; in let
additionalSpace=$(( $(numfmt --from=iec '${additionalSpace}') + reservedSpace ))
# Compute required space in filesystem blocks
diskUsage=$(find . ! -type d -print0 | du --files0-from=- --apparent-size --block-size "${blockSize}" | cut -f1 | sum_lines)
diskUsage=$(find . ! -type d -print0 | du --files0-from=- --apparent-size --count-links --block-size "${blockSize}" | cut -f1 | sum_lines)
# Each inode takes space!
numInodes=$(find . | wc -l)
# Convert to bytes, inodes take two blocks each!