Recently, I offlined a bunch of LUNs that had belonged to a SteelFusion Core in the lab that I had forgotten about. Needless to say, I had some unhappy users. The good news though is that I was able to get the LUNs back up and connected to the Core within minutes. This is how I did it.
The first thing I needed to do was find out which LUNs the Core was using. I did this by logging into the Core via SSH and running the following commands:
enable
conf t
terminal length 0
show storage luns iscsi
I output this to a file /tmp/core30luns.txt. An entry looks like this:
Total LUNs: 9
Locally Assigned Serial: P3PdB/-GFigd
Configuration status : Ready
Alias : avamar_restore
LUN Size : 150.00 GB
LUN Type : iscsi
Online : yes
IOPs acceleration : Enabled
Failover Enabled : yes
Prefetch : Enabled
Edge mapping : pod3-3100b
Target mapping : iqn.2003-10.com.riverbed:oh1mt0017065c.000
Origin portal : 10.33.192.174, 10.33.192.175
Origin target : iqn.1992-08.com.netapp:sn.135037602
Backend session status : Connected
Use iSCSI Reservation : Yes
LUN Edge data session : Connected
Client type : other
Original LUN vendor : NetApp
Original LUN serial : P3PdB/-GFigd
Pinned : no
Prepop : Disabled
Smart prepop : Enabled
Prepop status : N/A
MPIO policy : roundrobin
iSCSI Reservation status : LUN reserved
Prepop schedules:
Mapped igroups:
all
Mapped initiators:
The next thing was to find out what LUNs are on the NetApp to do some matching. You can do that by running this command:
lun show -v
I output this to a file /tmp/netapp_luns.txt. An entry looks like this:
/vol/NewYork_rvbd_d_e7cc5c29_f400_4c52_b1d4_f87da1b62652_1451278801/lun_RDM 10g (10737418240) (r/w, offline)
Serial#: P3PdB/9ytT31
Share: none
Space Reservation: disabled
Multiprotocol Type: vmware
Now with the 2 files, I could do some matching. I first want to extract the serial numbers from the LUNs. I do this by running:
grep serial /tmp/core30luns.txt | cut -f2 -d: > /tmp/core30lunlist.txt
From that, I would just get a list of serial numbers like this:
P3PdB/-GFigd
Next, I will loop through my list of LUNs to find the volumes I will need to put back online. I do this by running:
for i in `cat /tmp/core30lunlist.txt`; do grep -2 $i /tmp/netapp_luns.txt
>> /tmp/netappvolumes.txt; done
This would give me a list like this:
/vol/NewYork_rvbd_d_8f3a7b69_05f7_4be8_b3a6_14a689c2b3b0_1452834001/lunC11 60.0g (64445480960) (r/w, offline)
Comment: “Cdrive”
Serial#: P3PdB/-KWreM
Share: none
Space Reservation: disabled
With that list, I can cut the volumes out with the following command:
grep -v : /tmp/netappvolumes.txt | cut -f1 -d' ' > /tmp/volumes.txt
This would give me a list like this:
/vol/NewYork_rvbd_d_8f3a7b69_05f7_4be8_b3a6_14a689c2b3b0_1452834001/lunC11
Now that I have a list of volume names from the NetApp, I can just put them all online with a loop:
for i in `cat /tmp/volumes.txt`; do echo "lun online" $i >> /tmp/online_vols.txt ; done
You can just take the /tmp/online_vols.txt file now and just paste it into your NetApp SSH session and you’ll have all of your LUNs online again.