How to remove a SAN disk or Storage device (LUN) from Linux server
In this guide let us see how to safely remove a SAN disk (LUN) from Red Hat Linux and it’s variants. Below steps can be followed by removing one or two disks. To remove the bulk number of disk we have another safe way.
Assume we are about to remove only one disk now, our LUN id will be 32a7d0050202a7d00000226, note down all the paths of the multipath device.
First, we need to unmount the mount point we are about to release.
Remove from Logical volume, Volume group and Physical volume.
Once done with removing physical volume remove disk information form multipath.conf.
Remove entries from multipath configuration under alias, blacklist exceptions.
# vi /etc/multipath.conf
Remove from wwids file by editing or using the command.
# vi /etc/multipath/wwids
# multipath -w 32a7d0050202a7d00000226
Find the dm device number and remove it using -f ( flush).
# multipath -ll
# multipath -f dm-35
Flush any outstanding I/O on all paths of the device. This step needed for the RAW device was umounted, vgreduce not available.
# blockdev -flushbufs dm-35
Remove the device paths as shown below, need more care while doing the below steps.
Find the device name from below location.
# ls -lthr /dev/disk/by-id/*226
# echo 1 > /sys/block/sdas/device/delete
# echo 1 > /sys/block/sdar/device/delete
This will remove the Storage device (LUN) from RHEL, Centos, Oracle Servers.