Skip to contentSkip to conversation

VG refresh: remove disk and reinsert disk, VG not refresh

QEUSTION Wu Guanghao 2 participants 3 messages Nov 16, 2020 – Nov 17, 2020

lore
Share & tools
lore
#0 lore raw

We use LVM2.02.187 to create a logical volume on the disk, and then remove the disk and reinsert it. When reading and writing the logical volume, IO error occurred. But LVM2.02.181 version can be used normally.

If remove disk and reinsert disk, drive letter has changed. Maybe /dev/sda -> /dev/sdc

LVM 2.02.181: (vg autoactivate and refresh)

# lsblk

/dev/sda (8:16) /dev/sdc (8:32)

   |		---->      |
   |----vg-lv		   |----vg-lv
# dmsetup table

vg-lv: 0 20963328 linear 8:16 2048 -----> vg-lv: 0 20963328 linear 8:32 2048

_pvscan_autoactivate

	|
	|----_pvscan_autoactivate_single
			|
			|----vg_refresh_visible
				  |
				  |----lv_refresh ( refresh lv table, change dm-target)

LVM 2.02.187 and later (vg autoactivate but not refresh)

#lsblk

/dev/sda (8:16) /dev/sdc (8:32)

   |		---->      |
   |----vg-lv		   |---- nothing

#dmsetup table

vg-lv: 0 20963328 linear 8:16 2048 (not change, so read/write lv failed.)

_pvscan_autoactivate

	|
	|----_pvscan_autoactivate_single
			|
			|---- vg_refresh_visible ( skip, so lv not refresh)

and later version, _pvscan_autoactivate_single has deleted.

So I want to know how to add vg refresh function in the 2.02.187 and later to keep it the same as 2.02.181, and why delete vg refresh function?

Thanks.

#1 lore raw
Quoted 3 lines · Wu Guanghao

So I want to know how to add vg refresh function in the 2.02.187 and later to keep it the same as 2.02.181, and why delete vg refresh function?

Sorry, I don't think I quite knew what a proper use of that looked like when removing it. All the cases I saw were unnecessary or were causing problems. The motivation was numerous problems reported about failed activation during boot, some involving unwanted refreshes. A better fix might have found a way to preserve it in the stable branch.

If you're compiling your own lvm it would be simple to restore, enable the if 0 section in pvscan.c.

More generally, refresh didn't fit correctly where it was implemented. It depended on lvmetad (now removed), and was not really related to autoactivation. If an automatic refresh feature is warranted, it should be designed and implemented to stand on its own.

Dave

#2 lore raw

Thank you for your answer, we will solve this problem in our own way.

? 2020/11/17 0:41, David Teigland ??:

Quoted 21 lines · Wu Guanghao
Quoted 3 lines

So I want to know how to add vg refresh function in the 2.02.187 and later to keep it the same as 2.02.181, and why delete vg refresh function?

Sorry, I don't think I quite knew what a proper use of that looked like when removing it. All the cases I saw were unnecessary or were causing problems. The motivation was numerous problems reported about failed activation during boot, some involving unwanted refreshes. A better fix might have found a way to preserve it in the stable branch.

If you're compiling your own lvm it would be simple to restore, enable the if 0 section in pvscan.c.

More generally, refresh didn't fit correctly where it was implemented. It depended on lvmetad (now removed), and was not really related to autoactivation. If an automatic refresh feature is warranted, it should be designed and implemented to stand on its own.

Dave