Count hard links when sizing virtual disks

cptofs does not preserve hard links, so each hard link needs to be
accounted for separately when sizing virtual disks
This commit is contained in:
Graham Dennis 2024-07-25 12:35:37 +10:00
parent 0bb31825c5
commit 17555cad79

View file

@ -470,7 +470,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!