lvmteam / lvm2

Mirror of upstream LVM2 repository
https://gitlab.com/lvmteam/lvm2
GNU General Public License v2.0
133 stars 73 forks source link

I can't replace the disk, during auto memory expansion #157

Open UserAlexUser opened 2 months ago

UserAlexUser commented 2 months ago

Hello, version:

uname -r
6.1.77

lvm version
LVM version:     2.03.22(2) (2023-08-02)
Library version: 1.02.196 (2023-08-02)
Driver version:  4.47.0

I create a thin volume on top of the raid with this command:

pvcreate -f /dev/sdb /dev/sdc /dev/sdd /dev/sdf
vgcreate lpol /dev/sdb /dev/sdc /dev/sdd /dev/sdf

lvcreate --type raid5 -L 20G -I 64K -n thin_vg_meta lpol -y
lvcreate --type raid5 -L 20G -I 64K -n thin_vg lpol -y

lvconvert --type thin-pool --poolmetadataspare n --poolmetadata lpol/thin_vg_meta lpol/thin_vg -y

lvcreate -y -V5T -T lpol/thin_vg -n t1

The volume has 20G size and expands automatically as more data written to. I want to replace the disk while the volume is expanding, I do this with the following commands:

pvcreate -f /dev/sde
vgextend lpol /dev/sde
pvmove /dev/sdc /dev/sde
vgreduce lpol /dev/sdc
pvremove /dev/sdc

But after pvmove i can't vgreduce old disk. I get this message Physical volume "/dev/sdc" still in use

I think it's because of lvextend thin volume, can you tell me how I can solve this problem, I need to replace disk while writing to it?