Calculate new usable capacity after growing or shrinking a filesystem or partition.
Growing a filesystem is almost always safe and often possible online (ext4, XFS and Btrfs all support online growth once the underlying block device has more space). Shrinking is riskier: XFS cannot shrink at all — only ext4 and Btrfs (and, at the block-device level, LVM) support it, and it must never take the filesystem below its currently used space. For LVM-backed filesystems, remember the correct order matters: grow the LV before growing the filesystem, but shrink the filesystem before shrinking the LV, or you risk truncating live data.
New size
new_size = current_size + delta (delta negative for shrink)
XFS's on-disk allocation group layout is fixed at creation time and doesn't support relocating data to free space at the end of the device, which shrinking requires. The only reliable path to a smaller XFS filesystem is backup, reformat at the new size, and restore.
When growing: extend the LV first (lvextend), then grow the filesystem (resize2fs/xfs_growfs) to fill it. When shrinking: shrink the filesystem first to a size at or below the target, then shrink the LV (lvreduce) — doing it in the wrong order on a shrink can truncate live data.
Growing ext4, XFS and Btrfs can all be done online (mounted). Shrinking ext4 requires unmounting; Btrfs can shrink online in most cases; XFS cannot shrink under any circumstance.