We are going to configure Oracle Linux for NetApp iSCSI storage use.
Software
Software used in this article:
- Oracle Linux 6.6
- device-mapper-multipath 0.4.9
- iscsi-initiator-utils 6.2
Note that NetApp configuration is not covered in this article.
Installation
Install device mapper multipath and iSCSI utils:
# yum install device-mapper-multipath iscsi-initiator-utils
Optionally, install lsscsi:
# yum install lsscsi
Configuration
Check for any SCSI devices:
# lsscsi [0:0:0:0] disk HP LOGICAL VOLUME 2.14 /dev/sda [0:3:0:0] storage HP P244br 2.14 -
No SCSI devices found just yet, this is expected.
Configure Device Mapper Multipath
Open /etc/multipath.conf
and configure multipath. You most likely want to blacklist all local devices.
# grep -ve "^#" -ve "^$" /etc/multipath.conf blacklist { devnode "sda" devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^hd[a-z]" devnode "^cciss!c[0-9]d[0-9].*" } defaults { user_friendly_names yes } devices { device { vendor "Netapp" product "NewFiler" path_grouping_policy multibus path_selector "round-robin 0" failback immediate } }
Start multipathd:
# service multipathd start
Configure multipathd to start at boot:
# chkconfig multipathd on
Configure iSCSI NICs
Our iSCSI NIC on /etc/sysconfig/network-scripts/ifcfg-eth4
is configured as follows:
# iSCSI1 DEVICE="eth4" BOOTPROTO="static" NM_CONTROLLED="yes" ONBOOT=yes DEFROUTE=no PEERDNS=no PEERROUTES=no TYPE="Ethernet" IPADDR=10.20.0.10 NETMASK=255.255.255.0
Our iSCSI NIC on /etc/sysconfig/network-scripts/ifcfg-eth5
is configured as follows:
# iSCSI2 DEVICE="eth5" BOOTPROTO="static" NM_CONTROLLED="yes" ONBOOT=yes DEFROUTE=no PEERDNS=no PEERROUTES=no TYPE="Ethernet" IPADDR=10.21.0.10 NETMASK=255.255.255.0
Configure iSCSI
Set up an iSCSI initiator’s name (IQN). The name must be unique to the iSCSI device we are connecting to.
Open /etc/iscsi/initiatorname.iscsi
and modify the line similar to:
InitiatorName=iqn.1988-12.com.oracle:sql01.vb.local
The sql01.vb.local is a fully qualified domain name (FQDN) of our server.
There is no need to modify /etc/iscsi/iscsid.conf
for login credentials as our NetApp is configured to allow access per VLAN basis.
Start iSCSI:
# service iscsi start
Configure iSCSI to start at boot:
# chkconfig iscsi on
Our NetApp IPs are as follows:
- 10.20.0.80
- 10.21.0.80
If your iSCSI NICs are configured properly, at this point you should be able to ping the NetApp IPs assuming no firewall is blocking ICMP traffic.
Discover the targets:
# iscsiadm -m discovery -t sendtargets -p 10.20.0.80:3260
# iscsiadm -m discovery -t sendtargets -p 10.21.0.80:3260
In case you get the following error:
iscsiadm: cannot make connection to 10.20.0.80: No route to host
Make sure you get your IPs on iSCSI eth4/eth5 NICs right. You may have mixed vlans and/or interfaces.
Set the logon as automatic:
# iscsiadm -m node -L automatic
When the LUN is ready, rescan iSCSI sessions to pic up the new LUN:
# iscsiadm -m session --rescan
Or restart iSCSI to pic up the new LUN:
# service iscsi restart
Check active iSCSI sessions:
# iscsiadm -m session tcp: [1] 10.20.0.80:3260,2003 iqn.1992-08.com.netapp:sn.315:vf... tcp: [2] 10.21.0.80:3260,2001 iqn.1992-08.com.netapp:sn.315:vf...
Chec the current multipath topology:
# multipath -ll mpathb (4c355bafa5e8442dc5fb6e6577c6c92e) dm-4 NETAPP,LUN size=250G features='4 queue_if_no_path pg_init_retries 50 retain_attached_hw_handle' hwhandler='0' wp=rw `-+- policy='round-robin 0' prio=2 status=active |- 1:0:0:0 sdb 8:16 active ready running `- 2:0:0:0 sdc 8:32 active ready running
List iSCSI devices:
# lsscsi [0:0:0:0] disk HP LOGICAL VOLUME 2.14 /dev/sda [0:3:0:0] storage HP P244br 2.14 - [3:0:0:0] disk NETAPP LUN 820a /dev/sdb [3:0:0:1] disk NETAPP LUN 820a /dev/sdd
We can now use /dev/mapper/mpathb
for partitioning and then add to fstab (_netdev).
Example for how to create a logical 200GB ext4 formatted volume and mounted on /fra
is below.
# pvresize /dev/mapper/mpathb # vgcreate vg_fra-lun /dev/mapper/mpathb # lvcreate --size 200G --name lv_fra vg_fra-lun # mkfs.ext4 -m1 /dev/mapper/vg_fra--lun-lv_fra # mkdir /fra # mount -o defaults,_netdev /dev/mapper/vg_fra--lun-lv_fra /fra
Do not forget to add mounts to fstab /etc/fstab
.
References
https://kb.wisc.edu/page.php?id=15607