How To Add LUN to Linux Server From Netapp | Arkit

In this article your going to learn how to add new LUN in Linux from Netapp storage to increase/extend existing volume group space and logical volume space. Assuming you already created a volume and LUN in Netapp Cluster mode and mapped to Linux host using igroup with FC WWN.

Check Existing Disk space

Existing disk space for /d02 mount point is mentioned below, Your going to increase this disk space by 50GB

[user1@oracle-production ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VGD2-D02 394G 337G 38G 90% /d02

Detect New LUNs in Linux

Check the status before you echo scan for new LUN in linux. As per command output you could see one lun which is 400GB exists with multiple paths. sanlun lun show command only works with Netapp utility

[user1@oracle-production ~]$ sudo -s
[root@oracle-production ~]# sanlun lun show
controller(7mode)/ device host lun
vserver(Cmode) lun-pathname filename adapter protocol size mode
----------------------------------------------------------------------------------------------------
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdf host7 FCP 400.0g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdk host7 FCP 400.0g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdp host8 FCP 400.0g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdu host8 FCP 400.0g C

Scan Linux for New LUNs

Using below command you can scan for newly added FC Luns

[root@oracle-production ~]# ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done
[root@oracle-production ~]# sanlun lun show
controller(7mode)/ device host lun
vserver(Cmode) lun-pathname filename adapter protocol size mode
------------------------------------------------------------------------------------------------------
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02_1 /dev/sdy host7 FCP 100g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02_1 /dev/sdz host7 FCP 100g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02_1 /dev/sdab host8 FCP 100g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02_1 /dev/sdaa host8 FCP 100g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdf host7 FCP 400.0g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdk host7 FCP 400.0g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdp host8 FCP 400.0g C
SVM_NETAPP /vol/ORACLE_PRODUCTION/VG_D02 /dev/sdu host8 FCP 400.0g C

Let’s check multipath WW ID for configuring friendly name for paths

[root@oracle-production ~]# multipath -ll

mpath14 (4600a09803840357a545b483562736631) dm-21 NETAPP,LUN C-Mode
[size=100G][features=3 queue_if_no_path pg_init_retries 50][hwhandler=0][rw]
\_ round-robin 0 [prio=4][active]
\_ 7:0:3:4 sdz 65:144 [active][ready]
\_ 8:0:1:4 sdab 65:176 [active][ready]
\_ round-robin 0 [prio=1][enabled]
\_ 7:0:2:4 sdy 65:128 [active][ready]
\_ 8:0:0:4 sdaa 65:160 [active][ready]

Edit /etc/multipath.conf file and add mpath definition (Example: below)

[root@oracle-production ~]# vi /etc/multipath.conf

multipath {
wwid 4600a09803840357a545b483562736631
alias NETAPP-DB02-1
path_grouping_policy failover
}
:wq

Check modification of friendly name took effect

[root@oracle-production ~]# multipath -v2
4600a09803840357a545b483562736631: rename mpath14 to NETAPP-DB02-1
: NETAPP-DB02-1 (4600a09803840357a545b483562736631) NETAPP,LUN C-Mode
[size=100G][features=3 queue_if_no_path pg_init_retries 50][hwhandler=0][n/a]

...Output Truncated

Verify device mapper path, you could able to see new path

[root@oracle-production ~]# ls -al /dev/mapper/
total 0
drwxr-xr-x 2 root root 500 Mar 5 23:35 .
drwxr-xr-x 18 root root 5840 Mar 5 23:35 ..
brw-rw---- 1 root disk 253, 21 Mar 5 23:26 NETAPP-DB02-1

How to Add New LUN in Linux – Create Partition using mpath

You can now go ahead and create new partition inside new LUN using fdisk. If LUN size is more than 2 TB Guide here

[root@oracle-production ~]# fdisk /dev/mapper/NETAPP-DB02-1

Command (m for help): p

Disk /dev/mapper/NETAPP-DB02-1: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x512b0d88

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-13054, default 13054):
Using default value 13054

Command (m for help): p

Disk /dev/mapper/NETAPP-DB02-1: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x512b0d88

Device Boot Start End Blocks Id System
/dev/mapper/NETAPP-DB02-1p1 1 13054 104856223+ 83 Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/mapper/NETAPP-DB02-1: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x512b0d88

Device Boot Start End Blocks Id System
/dev/mapper/NETAPP-DB02-1p1 1 13054 104856223+ 8e Linux LVM

Command (m for help): wq
The partition table has been altered!

Add partition information to Kernel update

[root@oracle-production ~]# kpartx -a /dev/mapper/NETAPP-DB02-1

Create Physical Volume, Expand volume group and extend Logical volume

[root@oracle-production ~]# ls -al /dev/mapper/
total 0
drwxr-xr-x 2 root root 520 Mar 5 23:37 .
drwxr-xr-x 18 root root 5860 Mar 5 23:37 ..
brw-rw---- 1 root disk 253, 22 Mar 5 23:37 NETAPP-DB02-1p1

Creating PV and extend VG

[root@oracle-production ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VGD2 1 1 0 wz--n- 400.02G 0
VG00 1 6 0 wz--n- 278.38G 160.97G

[root@oracle-production ~]# pvcreate /dev/mapper/NETAPP-DB02-1p1
Writing physical volume data to disk "/dev/mpath/NETAPP-DB02-1p1"
Physical volume "/dev/mpath/NETAPP-DB02-1p1" successfully created

[root@oracle-production ~]# vgextend VGD2 /dev/mpath/NETAPP-DB02-1p1
Volume group "VGD2" successfully extended

[root@oracle-production ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VGD2 2 1 0 wz--n- 500.01G 100.00G
VG00 1 6 0 wz--n- 278.38G 160.97G

Increase file system size and check final step. Syntax: lvextend -L SIZE LV-PATH

[root@oracle-production ~]# lvextend -L +50g /dev/VGD2/D02
Extending logical volume D02 to 450.02 GB
Logical volume D02 successfully resized

[root@oracle-production ~]# resize2fs /dev/VGD2/D02
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VGD2/D02 is mounted on /d02; on-line resizing required
Performing an on-line resize of /dev/VGD2/D02 to 117968896 (4k) blocks.
The filesystem on /dev/VGD2/D02 is now 117968896 blocks long.

[root@oracle-production ~]# df -h /d02
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VGD2-D02 443G 337G 85G 80% /d02

That’s it. Add New LUN in Linux and extend File system size

Related Articles

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published. Required fields are marked *