0

psv command has show below output after I removed physical disk. That disk has xfs filesystem and belog to lvm partition. Before I was removing disk, I did unmount filesystem and I ran below command.

echo 1 > /sys/block/sd#/device/delete

how to I delete a disk to no see the warnning below? and How can I get rid of the warning without rebooting

pvs output:
/dev/vg_u02/lv_u02: read failed after 0 of 4096 at 0: Input/output error
/dev/vg_u02/lv_u02: read failed after 0 of 4096 at 53682831360: Input/output error
/dev/vg_u02/lv_u02: read failed after 0 of 4096 at 53682888704: Input/output error
/dev/vg_u02/lv_u02: read failed after 0 of 4096 at 4096: Input/output error
0

how to I delete a disk to no see the warnning below?

  • In order to delete a disk that is part of LVM you need to first make sure that no space is being used. To find out how much space is actually being occupied issue the following command:

    root@bbb01:~# pvs -o +pv_used

  • You should get an output like this:

    PV VG Fmt Attr PSize PFree Used
    /dev/sda2 vgbbb lvm2 a-- 39.52g 0 39.52g
    /dev/sdb1 vgbbb lvm2 a-- 1020.00m 508.00m 512.00m

  • As you can see sdb1 has 512.00m (512MB) occupied, so I need to reallocate this space with the following command (assuming you have 512MB free in another PV):

    root@bbb01:~# pvmove /dev/sdb1

  • LVM will move the 512MB to another PV that has enough room to allocate that space. Now you shoud see the Used column should look like this:

    PV VG Fmt Attr PSize PFree Used
    /dev/sda2 vgbbb lvm2 a-- 39.52g 0 39.52g
    /dev/sdb1 vgbbb lvm2 a-- 1020.00m 1020.00m 0

  • Here you can see it shows 0 and the PSize and PFree columns are now equal 1020.00m (1GB/1024MB). Now we need to reduce de VG like this:

    root@bbb01:~# vgreduce vgbbb /dev/sdb1

  • Finally, you can remove the PV like this:

    root@bbb01:~# pvremove /dev/sdb1

  • To confirm just run the pvs command which output should be similar to this:

    PV VG Fmt Attr PSize PFree
    /dev/sda2 vgbbb lvm2 a-- 39.52g 0

How can I get rid of the warning without rebooting?

  • I did exactly what you did and I just delete de LV involved. In your case would be:

    lvremove /dev/vg_u02/lv_u02

  • Now you should see the removed disk as unknown device in the output of the pvs command:

    PV VG Fmt Attr PSize PFree
    /dev/sda2 vgbbb lvm2 a-- 39.52g 0
    unknown device vgbbb lvm2 a-m 1020.00m 1020.00m

  • Finally tell LVM to remove missing PVs, in your case like this:

    vgreduce vg_u02 --removemissing

  • Now run the pvs command and confirm you have no errors.

Hope this helps.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.