For adding LVM on top of FC we do following:
- Rescan fc devices using
ls /sys/class/fc_host
- and then for each host
- echo "1" > /sys/class/fc_host/host0/issue_lip
- echo "- - -" > /sys/class/scsi_host/host0/scan
- Check for device with lun ID in /dev/disk/by-id/
- See if multipath is working (multipath -ll or service multipathd reload)
- Create partition on multipath device (Fdisk or parted)
- If partition is not appearing in /dev/mapper do partprobe
- Create physical volution (pvcreate)
- Add physical volume to volumegroup (vgcreate etc.)
- Create Logical volume (lvmcreate, etc.)
- Activate volume group (vgchange -a y <volgroup>)
- Mount the device using /dev/mapper/<volgroup>-<logvol>
For removal we need to do the opposite which is at least:
- Get device name from /dev/disk/by-id using LUN ID
- Get multipath name from multipath -ll using device names
- Get vg and lv names from "vgdisplay -v" using multipath name
- Make sure that device is not mounted ( mount | grep <device>), otherwise umount
- No open files (not possible after umount but just in cases), lsof | grep <device>
- Device is not listed in activated volumegroups (vgdisplay -v), else deactivate using "vgchange -a n <volgroup-name>"
- Once not listed in volumegroups remove multipath device using (multipath -f /dev/mapper/mpath<dev>
- Now remove using "echo 1 > /sys/block/<device-name>/device/delete" for each device-name such as sda, sdb which need to be removed
- If everything is fine following commands should finish within 1-2 seconds without any error display
- fdisk -l
- multipath -ll
- vgscan
- vgdisplay -v
- pvscan
- lvmdiskscan