Thank you Dima and Greg,
Finally got it working. I didn't noticed that first total sectors have to be changed in disklabel, then disklable -e let me resize disk.
For the record:
1. Resize disk in DomU/XCP-NG
2. check new total sectors from dmesg
3. Alter total sectors in disklabel -e /dev/xbd3
4. Alter partitions in disklabel -e /dev/xbd3
5. lvm pvresize /dev/rxbd3a
6. lvm lvextend -L+200G /dev/mapper/varmailvg-virtuallv
7. umount /var/mail/virtual/
8. fsck -y /dev/mapper/varmailvg-virtuallv
9. resize_ffs /dev/mapper/varmailvg-virtuallv
10. mount /dev/mapper/varmailvg-virtuallv /var/mail/virtual/
Result:
/dev/mapper/varmailvg-virtuallv 1.2T 860G 261G
76% /var/mail/virtual
On 03.08.2020 12:10, Bartosz Maciejewski wrote:
I got logical volume for mailboxes on LVM for easy expanding as mailboxes are growing. However I can't really resize it, or I don't know how to do it on NetBSD.
Actually it is done the same anywhere. You have to enlarge every device
in the chain.
Filesystem Size Used Avail %Cap Mounted on
/dev/mapper/varmailvg-virtuallv 984G 860G 74G 92% /var/mail/virtual
xbd3: 1200 GB, 512 bytes/sect x 2516582400 sectors
# lvm pvresize /dev/rxbd3a
It seems your PV is located on NetBSD slice of xbd3, not on xbd3 itself. That means you have to enlarge slice using disklabel(8) first.
which looks good, but lvm pvs still shows 1000GB instead of 1200GB
# lvm pvs
PV VG Fmt Attr PSize PFree
/dev/rxbd3a varmailvg lvm2 a- 1000.00g 1020.00m
Probably I should "resize in place" with disklabel or fstab after extending in Xen but I don't know exactly how. There is also resize_ffs somewhere in a process I think.
Is there any guide for NetBSD how to properly extend lvm volume?
This job is always very local, I don't think one can create sufficient
documentation to cover all the possible options. However big document
can be found here https://www.netbsd.org/docs/guide/en/chap-lvm.html