CentOS 7.x adding or removing FC multipath disks without reboot

From Notes_Wiki
Revision as of 07:03, 26 February 2020 by Saurabh (talk | contribs)

<yambe:breadcrumb>CentOS_7.x_file_system_management|CentOS 7.x file system management</yambe:breadcrumb>

CentOS 7.x adding or removing FC multipath disks without reboot

For adding LVM on top of FC we do following:

  1. 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
  2. Check for device with lun ID in /dev/disk/by-id/
  3. See if multipath is working (multipath -ll or service multipathd reload)
  4. Create partition on multipath device (Fdisk or parted)
  5. If partition is not appearing in /dev/mapper do partprobe
  6. Create physical volution (pvcreate)
  7. Add physical volume to volumegroup (vgcreate etc.)
  8. Create Logical volume (lvmcreate, etc.)
  9. Activate volume group (vgchange -a y <volgroup>)
  10. Mount the device using /dev/mapper/<volgroup>-<logvol>


For removal we need to do the opposite which is at least:

  1. Get device name from /dev/disk/by-id using LUN ID
  2. Get multipath name from multipath -ll using device names
  3. Get vg and lv names from "vgdisplay -v" using multipath name
  4. Make sure that device is not mounted ( mount | grep <device>), otherwise umount
  5. No open files (not possible after umount but just in cases), lsof | grep <device>
  6. Device is not listed in activated volumegroups (vgdisplay -v), else deactivate using "vgchange -a n <volgroup-name>"
  7. Once not listed in volumegroups remove multipath device using (multipath -f /dev/mapper/mpath<dev>
  8. Now remove using "echo 1 > /sys/block/<device-name>/device/delete" for each device-name such as sda, sdb which need to be removed
  9. 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


Additionally refer:

Very good reference for Suse for above is available at https://www.suse.com/support/kb/doc/?id=7009660


<yambe:breadcrumb>CentOS_7.x_file_system_management|CentOS 7.x file system management</yambe:breadcrumb>