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 Enterprise Linux version 5, 6 or 7 and it’s variants like CentOS, Oracle Linux or Scientific Linux. Below steps can be followed for 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 for now, our LUN id will be 32a7d0050202a7d00000226, note down all the paths of the multipath device. To know about the devices run “multipath -ll” and make a note on device name such as “SDAS, SDAR“.
Step 1: Unmounting Filesystem:
First, we need to unmount the file system we are about to release.
Once unmount the filesystem by following we need to remove the Logical volume, Volume group and Physical volume. Moreover, we have to delete the partition which used by the Physical volume.
Still yet not completed with removing disk information, we need to clear the Alias information from multipath.conf.
Step 2: Removing disks from the multipath configuration:
Remove entries from multipath configuration under alias and blacklist exceptions.
# vi /etc/multipath.conf
Ahead we need to remove from the wwids file by editing or using the “multipath -w” command.
# vi /etc/multipath/wwids # multipath -w 32a7d0050202a7d00000226
Flush the DM device name using -f option. To get the dm device name we can run “multipath -ll” command.
# multipath -ll # multipath -f dm-35
Steps 3: Removing SAN paths by nulling the devices.
Remove the device paths as shown below, need more care while doing the below steps.
Remove the devices got from “multipath -ll” or can 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 and variants.
This guide will help us to remove SAN disks from Linux servers. To avoid any I/O error in messages log file we need to follow the above steps while removing with any SAN disks. Hope this guide straightforward for you to know about removing SAN disks from text-based operating systems.