General
cancel
Showing results for 
Search instead for 
Did you mean: 

LUN Clear Host residuals in Red Hat linux

SOLVED
Go to solution
vijay alur alur
Frequent Advisor

LUN Clear Host residuals in Red Hat linux

Hello All,

 

I have a Red hat linux server running 6.3 version OS. And below is the problem description.

 

I assign a LUN to the server today with LUN ID as 4 from SAN. I scan that LUN and use it for my applications using LVM. i use that LUN for couple of months. After few days i do not need that LUN anymore, so i remove that LUN from LVM and release it to the storage pool.

 

After few days, there is one more requirement for LUN, and i assign the same LUN with LUN ID 4 to the server again. And it still hold the old information from the last time it was assigned to the server.

 

How can i clear the Old LUN information from the server before assigning the same LUN again to the server?

 

In HPUX there is a command scsimgr replace_wwid option to achieve this.

 

 

Thanks,

VJ

Lead Engineer, IMS.
iGATE
3 REPLIES
Matti_Kurkela
Honored Contributor
Solution

Re: LUN Clear Host residuals in Red Hat linux

This is related to Linux hot-plugging: once the kernel has seen a particular device, it tries to make sure that the device can keep the same device name(s) whenever possible, even after it is temporarily disconnected. To make the kernel completely forget a particular device, you will need to tell it that the removal is intentional.

 

The full RedHat-recommended procedure can be found in the RHEL 6 Storage Administration Guide:

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/removing_devices.html

 

In a nutshell:

  • unmount filesystems, reduce disk out of LVM and/or otherwise stop applications from using it
  • if you use dm-multipath, identify the individual /dev/sd* devices with "multipath -l", then remove the multipath device with "multipath -f <multipathname>"
  • run "blockdev --flushbufs /dev/sdX" for the devices that will be removed (= component paths of the multipath device that was removed in the previous step). This ensures that all forms of disk I/O have been completed for the device(s).
  • finally tell the kernel to forget the /dev/sdX device(s): 
echo 1 > /sys/block/sdX/device/delete

 

If the LUN was already unmounted, removed from the LVM and un-presented, you'll only need the "multipath -f" and "echo 1 > /sys/block/sdX/device/delete" steps. The "blockdev --flushbufs" step won't do any good if the disk/LUN is no longer accessible.

 

You may also want to remove the WWID of the LUN from /etc/multipath.conf, if you used a custom multipath alias for the device, or from /etc/multipath/bindings, if you used the user_friendly_names feature of dm-multipath.

MK
vijay alur alur
Frequent Advisor

Re: LUN Clear Host residuals in Red Hat linux

Hi Matti,

 

Thanks for the reply!

 

I will try these steps.

 

Regards,

VJ

Lead Engineer, IMS.
iGATE
vijay alur alur
Frequent Advisor

Re: LUN Clear Host residuals in Red Hat linux

Accepted your post as  a solution to my problem, a well deserved kudos given!!!

 

Thankyou!!

 

VJ

Lead Engineer, IMS.
iGATE