Re: pvresize after pvcreate changes PV size: expected?
Zdenek Kabelac <[email protected]> Mon, 13 Jan 2025 14:46:53 +0100
| Newsgroups | gmane.linux.lvm.general |
|---|---|
| Message-ID | <[email protected]> |
Dne 11. 01. 25 v 23:21 Tilman Vogel napsal(a): > Hi! > > I just encountered the following and do not understand it. The confusing part > is that when I run pvresize without size parameter directly after pvcreate, > the size still seems to change even though pvcreate of course also uses the > underlying device size just as pvresize should. > > I am attaching the test.sh for your reference. > > What am I missing? > Hi You are missing that the actual size of usable count of PV extents is not changed by a single bit. The surrounding accounting changes with the lvm2 metadata content size accounting. For a user of a PV it's important there is 24 free extents of 4MiB each in this case and this gives a usable size for LVs. Rest is either unused alignment space or space dedicated to PV header & lvm2 metadata. This space is accounted a bit differently when you create a new PV or you work with already existing PV with already existing lvm2 metadata area. Yeah - it might be possibly 'addressed' better and PV could be readjusted after initial create - but it's not a bug - so it avoids 'extra' clutering of PV header space when it's not really necessary (as unlike lvm2 metadata, PV header space is not using any backups - so the less it's touched, the better....) Regards Zdenek PS: for small PV sizes like in this case - using smaller extent size (i.e. 256K, and reducing metadata size to i.e. 192K) may 'boost' usable space for LVs.