Hot(un)plugging LVM volumes

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

 



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

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux