How To Remove SAN Attached LUNs from RHEL 5 Servers Using powermt
Introduction
It is one of those rare occasions where you get to reclaim SAN attached storage instead of giving more. From the EMC side of it you would think no problem. Remove the host from the storage group and un-mount and re-scan on the host and all is good, right? Well no, up rises device in use or not found and powermt check command won’t work. So how do we do it? Read on and see.
Steps
Several steps are needed to disconnect the storage from RHEL 5 / 6 server.
First edit /etc/fstab and comment out the related storage. Save the file.
Now we need to un-mount the storage. the is done using the umount command.
$ sudo umount /oracle/arch
Now that we have un-mounted the storage we need to remove the logical volume, volume group and physical group for the SAN attached storage.
First find the logical volumes using the lvs command
$ lvs LV VG Attr LSize lvoraarch vg_lp59_oraarch -wi-ao 145.00G lvoradata vg_lp59_oradata -wi-ao 169.00G lvoradata2 vg_lp59_oradata2 -wi-ao 175.00G
Now using the lvremove command we can delete the logical volume.
$ sudo lvremove lvoraarch
Now that the logical volume we can delete the associated volume group. This is done with the vgremove command. From the previous step and the output from lvs command we know the volume group name, but before we remove the volume group we need to get the physical device name. We can get this running the pvs command.
$pvs PV VG Fmt Attr PSize PFree /dev/cciss/c0d0p3 vg00 lvm2 a-- 278.25G 191.75G /dev/emcpowerb vg_lp59_oraarch lvm2 a-- 50.00G 0
From the output we see /dev/emcpowerb is the physical device for volume group vg_lp59_oraarch. So now we can delete the volume group
$ sudo vgremove vg_lp59_oraarch
Now we can remove the physical device. This is completed with the pvremove command.
$ sudo pvremove /dev/emcpowerb
So we are now clean on the host side. Login to the storage server (VNX, VMAX) and remove the host from the storage group or the LUN in the storage group. Once completed log back into the server.
Run
powermt check
to clean all dead paths on the system to complete the process.
Conclusion
An issue has been averted and storage reclaimed in a few easy steps on RHEL. Hope this little tip helps you in your endeavors.
Leave a Reply