You are here

How do you scan for new luns on linux?

I always forget this one. How exactly do you find those new fibre channel luns you carved and presented to the host? The zoning is there, but you need to have the OS look for it.

Well, if you have power path or other vendor software it will be different and I'll document that as well some day. Using the native software in RHEL 5.1 or greater, you do this.

1) Find the FC HBAs

ls /sys/class/fc_host/

that will output something like

host3 host4

BONUS HINT: This is how to get the pWWN off the cards (I need to make this it's own entry)

cat /sys/class/fc_host/host[0-9]/port_name
0x500143801209011a
0x500143801209011e

2) Figure out which "host" (HBA) you want to scan. Most shops will just want to run this on both
{insert genius notes here - wow... I really need to revise this stuff}

3) Run the magic command.
For "host3":

echo "- - -" > /sys/class/fc_host/host3/scan

Why does that work? I don't know. I'll have to come back and document that. (what a lazy guy!!)

It also pains me to say this as a linux admin, but (ouch) it's cleaner and better to reboot... but it's not required. I'd especially want to reboot if REMOVING luns. Controlled reboots build confidence that configuration changes are clean and that you shouldn't be woken up in the middle of the night in emergency mode because a system didn't recover from a spontaneous (the on-call windows admin) reboot.

{Ok, this should go in it's own article as well}
While I'm at it, don't forget to make an /etc/multipath.bindings file. This will keep your storage mapping consistent across reboots. PLUS, some strange admins still put var on a separate partition to make sure that big logs don't shut down a host. How quaint! Well, if you do this, /var/lib/multipath/bindings is on a separate partition that is NOT read with root is being mounted and checked by udev. Your multipath devices will not get mounted. If you specify your settings, including that the bindings file is not in where multipath expects it to be but is insead on the file system currently getting mounted, it will deal with the mapping gracefully and consistently. You specify where your bindings file is in /etc/multipath.conf. Here's an example file:

### hostname1:/mount_point (content) {lun 1}
mpath0 3600c0ff000db3ad4cff8ad4c01000000
### hostname2:/mount_point (content) {lun 2}
mpath1 3600c0ff000db3ad4e4fbad4c01000000

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer