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?
Tilman
# ./test.sh
+ set -o errexit
+ truncate -s 100M image
++ losetup --show -f image
+ LOOP=/dev/loop0
+ echo 'LOOP /dev/loop0'
LOOP /dev/loop0
+ pvcreate /dev/loop0
Physical volume "/dev/loop0" successfully created.
Not creating system devices file due to existing VGs.
+ vgcreate test /dev/loop0
Not creating system devices file due to existing VGs.
Volume group "test" successfully created
+ pvdisplay --units b /dev/loop0
--- Physical volume ---
PV Name /dev/loop0
VG Name test
PV Size 104857600 B / not usable 4194304 B
Allocatable yes
PE Size 4194304 B
Total PE 24
Free PE 24
Allocated PE 0
PV UUID zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT
+ pvs --units b -o pv_all /dev/loop0
Fmt PV UUID DevSize PV Maj Min PMdaFree PMdaSize PExtVsn 1st PE PSize PFree Used Attr Allocatable Exported Missing PE Alloc PV Tags #PMda #PMdaUse BA Start BA Size PInUse Duplicate DeviceID DeviceIDType
lvm2 zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT 104857600B /dev/loop0 7 0 520704B 1044480B 2 1048576B 100663296B 100663296B 0B a-- allocatable 24 0 1 1 0B 0B used
+ echo RESIZE
RESIZE
+ pvresize /dev/loop0
Physical volume "/dev/loop0" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
+ pvdisplay --units b /dev/loop0
--- Physical volume ---
PV Name /dev/loop0
VG Name test
PV Size 103809024 B / not usable 3145728 B
Allocatable yes
PE Size 4194304 B
Total PE 24
Free PE 24
Allocated PE 0
PV UUID zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT
+ pvs --units b -o pv_all /dev/loop0
Fmt PV UUID DevSize PV Maj Min PMdaFree PMdaSize PExtVsn 1st PE PSize PFree Used Attr Allocatable Exported Missing PE Alloc PV Tags #PMda #PMdaUse BA Start BA Size PInUse Duplicate DeviceID DeviceIDType
lvm2 zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT 104857600B /dev/loop0 7 0 520704B 1044480B 2 1048576B 100663296B 100663296B 0B a-- allocatable 24 0 1 1 0B 0B used
+ echo CLEANUP
CLEANUP
+ vgremove test
Volume group "test" successfully removed
+ pvremove /dev/loop0
Labels on physical volume "/dev/loop0" successfully wiped.
+ losetup -d /dev/loop0
+ set -o errexit
+ truncate -s 100M image
++ losetup --show -f image
+ LOOP=/dev/loop0
+ echo 'LOOP /dev/loop0'
LOOP /dev/loop0
+ pvcreate /dev/loop0
Physical volume "/dev/loop0" successfully created.
Not creating system devices file due to existing VGs.
+ vgcreate test /dev/loop0
Not creating system devices file due to existing VGs.
Volume group "test" successfully created
+ pvdisplay --units b /dev/loop0
--- Physical volume ---
PV Name /dev/loop0
VG Name test
PV Size 104857600 B / not usable 4194304 B
Allocatable yes
PE Size 4194304 B
Total PE 24
Free PE 24
Allocated PE 0
PV UUID zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT
+ pvs --units b -o pv_all /dev/loop0
Fmt PV UUID DevSize PV Maj Min PMdaFree PMdaSize PExtVsn 1st PE PSize PFree Used Attr Allocatable Exported Missing PE Alloc PV Tags #PMda #PMdaUse BA Start BA Size PInUse Duplicate DeviceID DeviceIDType
lvm2 zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT 104857600B /dev/loop0 7 0 520704B 1044480B 2 1048576B 100663296B 100663296B 0B a-- allocatable 24 0 1 1 0B 0B used
+ echo RESIZE
RESIZE
+ pvresize /dev/loop0
Physical volume "/dev/loop0" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
+ pvdisplay --units b /dev/loop0
--- Physical volume ---
PV Name /dev/loop0
VG Name test
PV Size 103809024 B / not usable 3145728 B
Allocatable yes
PE Size 4194304 B
Total PE 24
Free PE 24
Allocated PE 0
PV UUID zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT
+ pvs --units b -o pv_all /dev/loop0
Fmt PV UUID DevSize PV Maj Min PMdaFree PMdaSize PExtVsn 1st PE PSize PFree Used Attr Allocatable Exported Missing PE Alloc PV Tags #PMda #PMdaUse BA Start BA Size PInUse Duplicate DeviceID DeviceIDType
lvm2 zNLgIe-S8Zq-1DF5-0BhR-oGGS-q9Vy-FzNnoT 104857600B /dev/loop0 7 0 520704B 1044480B 2 1048576B 100663296B 100663296B 0B a-- allocatable 24 0 1 1 0B 0B used
+ echo CLEANUP
CLEANUP
+ vgremove test
Volume group "test" successfully removed
+ pvremove /dev/loop0
Labels on physical volume "/dev/loop0" successfully wiped.
+ losetup -d /dev/loop0
Attachment:
test.sh
Description: application/shellscript