[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[linux-lvm] Hot(un)plugging LVM volumes



How is LVM supposed to work for hotpluggable disks?
The best I came up with so far is something like:

   <plug>
   lvchange -a y <lvname>
   mount <lvname> <mountpoint>

and when unplugging, doing the reverse:

   umount <mountpoint>
   lvchange -a n <lvname>
   <plug>

But it's rather inconvenient, and brittle.  If I just unplug while the
volume is mounted, I can still unmount the volume afterwards, but LVM
seems to keep some info about the volume, so I get errors and subsequent
hotplugging does not bring me back the volume (probably because the old
instance is still left around and in an inconsistent state).

More specifically, after unplugging and unmounting, I get errors like:

# pvs
  /dev/dm-3: read failed after 0 of 4096 at 0: Input/output error
  PV         VG      Fmt  Attr PSize  PFree
  /dev/hda3  Toto    lvm2 a-   26.39G    0 
# ~-0# ~-0# lvchange -a n /dev/Titi/tata
  /dev/dm-3: read failed after 0 of 4096 at 0: Input/output error
  /dev/dm-3: read failed after 0 of 4096 at 300647645184: Input/output error
  /dev/dm-3: read failed after 0 of 4096 at 300647702528: Input/output error
  /dev/dm-3: read failed after 0 of 4096 at 0: Input/output error
  /dev/dm-3: read failed after 0 of 4096 at 4096: Input/output error
  /dev/dm-3: read failed after 0 of 4096 at 0: Input/output error
  Volume group "Titi" not found
# l /dev/mapper/Titi-tata
brw-rw---- 1 root disk 254, 3 2008-09-29 13:39 /dev/mapper/Titi-tata
# 

I did find a workaround, tho: after unplugging "uncleanly", I need to
unmount all the volumes, the plug the disk back in, then deactivate all
the volumes with "lvchange -a n <lvname>" (which signals the same
errors as above, except for the last line, and which does deactivate
the volume this time), and then reactive them with "lvchange -a y <lvname>".


        Stefan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]