Wednesday, 9 July 2014

Adding new LUN with multipath on Linux

So you have need to add another LUN to your server. Here is procedure how to do it if you use multipath on your server!

First your storage admin has to assign new LUN to you server. You may see this in you log when LUN is added from storage side

kernel: sd 1:0:0:10: [sdbb] Warning! Received an indication that the LUN assignments on this target have changed. The Linux SCSI layer does not automatically remap LUN assignments.
After this is done, you can proceed.
List your current multipath status

server# multipath -ll
|-+- policy='round-robin 0' prio=4 status=active
| |- 1:0:1:9  sdau 66:224 active ready running
| `- 2:0:1:9  sdan 66:112 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  |- 1:0:0:9  sdk  8:160  active ready running
  `- 2:0:0:9  sdai 66:32  active ready running

Go to /sys/class/fc_host folder.

server# cd /sys/class/fc_host/
server:/sys/class/fc_host # ls
host1  host2 


From multipath -ll you can see that we are using host1 and host2 (this is important in case that you have more than two fc single port card or some dual port card- every fc port will be represented as hostX). In this case we have two single port cards and ports are represented as host1 and host2.

First we would like to restart port on host1!

server#cd host1
server#echo 1 >issue_lip

In you /var/log/messages something like this should appear

kernel: qla2xxx [0000:0a:00.7]-801c:5: Abort command issued xxxxx 
kernel: scsi 1:0:0:10: Direct-Access     DGC      VRAID            0532 PQ: 0 ANSI: 4
kernel: scsi 1:0:0:10: alua: supports implicit and explicit TPGS
This means FC port detected newly added LUN.

Now rescan scsi host host1!

server# cd /sys/class/scsi_host/host1
server# echo "- - -" >scan

This will add that new LUN to the system as scsi devices!
In your log something like this should appear

.
sd 1:0:0:10: [sdbb] Attached SCSI disk
.
.

Now if you check your multipath
server#multipath -ll
|-+- policy='round-robin 0' prio=4 status=active
| |- 1:0:1:9  sdau 66:224 active ready running
| `- 2:0:1:9  sdan 66:112 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  |- 1:0:0:9  sdk  8:160  active ready running
  `- 2:0:0:9  sdai 66:32  active ready running




|-+- policy='round-robin 0' prio=4 status=active
| `- 1:0:1:10  sdbb 67:80 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 1:0:0:10  sdbb 67:16  active ready running



As you can see old LUN has 4 paths and new LUN has only 2 paths. Other two paths will appear when you do rescan on host2.

Don't be confused on my server I see 4 paths for every LUN because I have two FC ports connected to two FC switch. From single FC switch to storage, we have two connection because of redundancy. So in total, we have  4 paths from server to storage.


No comments: