Linux XFS filesystem development
 help / color / mirror / Atom feed
* [RFE] xfs_growfs: option to clamp growth to an AG boundary
@ 2026-02-25  8:21 Lukas Herbolt
  0 siblings, 0 replies; 12+ messages in thread
From: Lukas Herbolt @ 2026-02-25  8:21 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: socketpair, Linux Xfs

> I like your proposal.  This is actually a relatively east project,
> and I've happy to mentor whomever wants to take it up.  Although
I like the idea and can take a look at it, but I will leave it to
the author if they will pick it up.

Just for the LVM extent size, LVM does not expose it unless you look
at the metadata, afaik.

> I think json output while generally useful is probably a separate
> issue and should be addressed separately and in a more general
> fashion.

I guess json output could be also added to mkfs.xfs, xfs_admin (xfs_db)


-- 
-lhe

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [RFE] xfs_growfs: option to clamp growth to an AG boundary
@ 2026-02-23  9:48 Марк Коренберг
  2026-02-23 16:23 ` Darrick J. Wong
  2026-02-24 15:02 ` Christoph Hellwig
  0 siblings, 2 replies; 12+ messages in thread
From: Марк Коренберг @ 2026-02-23  9:48 UTC (permalink / raw)
  To: linux-xfs

Hi,

I ran into an issue after growing an XFS filesystem where the final
allocation group (last AG) ended up very small. Most workloads were
fine, but large reflink-heavy copies started failing. In my case,
copying a ClickHouse data directory with:

`cp -a --reflink=always ...`

fails on a filesystem with a tiny last AG. Using --reflink=auto
doesn’t help either, because `cp` doesn’t fall back to a non-reflink
copy if the reflink attempt fails.

To work around this, I had to write scripts that compute a “safe”
target size before running xfs_growfs. The alignment I needed is a bit
awkward:

1. Round the LV size up to the next multiple of the filesystem AG
size, so the grown filesystem ends exactly on an AG boundary (no
partial/tiny last AG).

2. Then round the LV size down to the LVM extents size (4 MiB in my
case). Rounding up to the LVM granularity can reintroduce a tiny last
AG.
If the automatically chosen AG size were aligned to that granularity,
step (2) wouldn’t be necessary.

This feels like something xfsprogs could support directly. My proposals:

1. xfs_growfs: add an option to print an “optimal grow target size”:
the current(new) block device size rounded **down** to a multiple of
the AG size.
A --json output mode would make this easy to consume from scripts.

2. AG size calculation/alignment: when choosing an automatic AG size,
always round it down to an alignment such as 4 MiB, or (preferably)
consider the underlying device/LVM extent size when it can be
detected, instead of using a constant.

3. Docs (mkfs + AG sizing): when specifying AG size manually,
recommend: choosing filesystem sizing so the final size is an integer
multiple of AG size (i.e., no partial last AG), and aligning the AG
size to the underlying allocation granularity (e.g., LVM
extent/segment size) when applicable.

4. Docs (xfs_growfs): add a note that it’s highly preferable to grow
the filesystem in multiples of the existing AG size, to avoid a tiny
last AG.

5. Optional grow mode: add a xfs_growfs mode/switch that grows “as
much as possible”, but clamps the resulting filesystem size **down**
to an AG boundary, and reports how much space is left unused (e.g., “X
bytes left unallocated to avoid a partial final AG”).

This might sound like a corner case, but it’s easy to hit in practice
when the block device is resized to just arbitrary chosen size then
xfs_growfs expands to consume the whole device.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-02-25 14:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25  8:21 [RFE] xfs_growfs: option to clamp growth to an AG boundary Lukas Herbolt
  -- strict thread matches above, loose matches on Subject: below --
2026-02-23  9:48 Марк Коренберг
2026-02-23 16:23 ` Darrick J. Wong
2026-02-23 19:29   ` Марк Коренберг
2026-02-23 23:08     ` Darrick J. Wong
2026-02-24  6:17       ` Марк Коренберг
2026-02-24 15:01       ` Christoph Hellwig
2026-02-24 19:44         ` Darrick J. Wong
2026-02-24 22:25           ` Darrick J. Wong
2026-02-25 14:21             ` Christoph Hellwig
2026-02-24 15:02 ` Christoph Hellwig
2026-02-24 19:49   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox