CentOS 7.x adding or removing FC multipath disks without reboot
From Notes_Wiki
Home > CentOS > CentOS 7.x > System Administration > File system management > CentOS 7.x adding or removing FC multipath disks without reboot
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
Related article to get WWN of FC card at: CentOS 8.x Get FC HBA wwn for san zoning
Additionally refer:
- http://www.learnitguide.net/2016/02/scan-newly-added-fc-luns-and-scsi-disks.html
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/removing_devices
- https://elkano.org/blog/removing-multipath-device/
- https://www.novell.com/coolsolutions/appnote/19386.html
- https://serverfault.com/questions/421776/removing-vg-and-lv-after-physical-drive-has-been-removed
Very good reference for Suse for above is available at https://www.suse.com/support/kb/doc/?id=7009660
Home > CentOS > CentOS 7.x > System Administration > File system management > CentOS 7.x adding or removing FC multipath disks without reboot