Fix LVM Input/Output Error Caused by Node Change

Tags: April 13, 2014 8:42 AM

I have LVM partition reside on my external hard drive which connected trough USB. Here's the output before I unplug the device.

$ pvs
  PV               VG    Fmt  Attr PSize   PFree  
  /dev/maxtor1-40g       lvm2 a-    37.27g  37.27g
  /dev/sde5        XENVG lvm2 a-   125.78g 121.78g
When I unplug and plug the device I always got I/O error like this:
$ pvs
  /dev/dm-0: read failed after 0 of 4096 at 0: Input/output error
  /dev/dm-0: read failed after 0 of 4096 at 4294901760: Input/output error
  /dev/dm-0: read failed after 0 of 4096 at 4294959104: Input/output error
  /dev/dm-0: read failed after 0 of 4096 at 4096: Input/output error
  PV               VG    Fmt  Attr PSize   PFree  
  /dev/maxtor1-40g       lvm2 a-    37.27g  37.27g
  /dev/sdd5        XENVG lvm2 a-   125.78g 121.78g
Well that sucks since it would become unmountable. The LVM still pointing to the old /dev/sde5 that's why the error comes.

The Solution

The solution is very simple, you could reboot your computer or tell LVM to deactivate/activate so it get reference for the new physical volume. We could use vgchange or lvchange to accomplished that task.
$ vgchange --refresh
Now the logical volume would point to the correct physical volume and the error should gone.

Reference

Share on Facebook Twitter

0 comments:

Post a Comment