[CentOS] LVM and hotswap (USB/iSCSI) devices?

Simen Timian Thoresen simentt at dolphinics.no
Sun Aug 31 15:51:23 UTC 2008


nate wrote:
> Simen Timian Thoresen wrote:
> 
>> So - with the LV unmounted, I power my USB-device down, and then back up;
> 

Hi Nate,

> I believe your problem is you didn't deactivate the logical
> volume, and export the volume group before disconnecting.

Yes! Thank you - exporting and then importing again after replugging worked.

I'll have to read up on what actually happens here .-)

Still - say that the USB (or iSCSI) PV is not exported before being 
unplugged (cables tripped over, internet connection going down, etc) - 
how do I recover from an unplugged but not exported PV/VG? It seems that 
vg[im/ex]port only fiddle with the off-PV metadata. Is this correct?

I think I'm looking for a force-import that allows me to bring a VG with 
associated LVs up provided that the PVs are present - affectively a 
'assemble' ala mdadm.

Thank you for pointing me in the right way ;-)

-S

> lvchange -a n <path to lvm>
> vgexport -a (don't worry it will only export groups that are
> ready to be exported)
> 
> Now you can safely power the device down(provided the VG was
> successfully exported, all logical volumes must be unmounted
> and deactivated before it will succeed).
> 
> when you power it back up run
> 
> pvscan
> vgimport -a
> lvchange -a y <path to lvm>
> 
> LVM is very useful for volumes that change device names, but you
> must use it properly otherwise bad things will happen as you
> saw.
> 
> If you want to have USB mount automatically it may be better
> to put a label on the file system, at least in Debian(don't
> have a CentOS system with a USB disk handy here) the volume
> is mounted as /media/<disk label> if there is a disk label.
> You can use the e2label command to label the device. I'd
> expect CentOS to likely behave similarly to debian in this
> respect.
> 
> nate
> 
> 
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
> 


-- 
Simen Thoresen, Dolphin ICS
Systems Administration and Wulfkit Support


More information about the CentOS mailing list