RHEL 6 – ISCSI Administration Series – ISCSI Lun resize

This is second post from the ISCSI administration series ( you can refer the first post here RHEL 6 – ISCSI Administration Series – Configuring ISCSI Server and Client ) . In this post, I will be showing you an hands-on exercise to expand a ISCSI LUN which is already configured from the client and actively in use.

 

ISCSI LUN RESIZE

 

Before going for Actual Task,  Just want to show my current configuration both from server side and client side:

 

Current Configuration at ISCSI server ( i.e. gurkulsan)

[root@gurkulsan ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
lvdisk1 iscsivg -wi-ao– 1.00g
lvdisk2 iscsivg -wi-ao– 1.00g
lv_root vg_gurkulrhel2 -wi-ao– 11.57g
lv_swap vg_gurkulrhel2 -wi-ao– 3.94g

 

 

[root@gurkulsan rules.d]# tgtadm –lld iscsi –mode target –op show
Target 1: iqn.2013-04.com.unixadminschool:target1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 2
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb
Backing store flags:
LUN: 2
Type: disk
SCSI ID: IET 00010002
SCSI SN: beaf12
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdc
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
192.168.1.35
Target 2: iqn.2013-04.com.unixadminschool:target2
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00020000
SCSI SN: beaf20
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00020001
SCSI SN: beaf21
Size: 1074 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/iscsivg/lvdisk1
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
Target 3: iqn.2013-04.com.unixadminschool:target3
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 3
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00030000
SCSI SN: beaf30
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00030001
SCSI SN: beaf31
Size: 1074 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/iscsivg/lvdisk2
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34

 

Current Client Side Configuration ( i.e. gurkulrhel4)

 

[root@gurkulrhel4 ~]# fdisk -l|grep -i Disk
Disk /dev/sdb: 2147 MB, 2147483648 bytes
Disk identifier: 0x00000000
Disk /dev/sda: 17.2 GB, 17179869184 bytes
Disk identifier: 0x000ae2a8
Disk /dev/sdc: 2147 MB, 2147483648 bytes
Disk identifier: 0xd480d9c7
Disk /dev/mapper/vg_gurkulrhel2-lv_root: 12.4 GB, 12423528448 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-lv_swap: 4227 MB, 4227858432 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data1: 2147 MB, 2147483648 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data2: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data3: 524 MB, 524288000 bytes
Disk identifier: 0x00000000
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/sde: 2147 MB, 2147483648 bytes
Disk identifier: 0xaed24ed6
Disk /dev/sdf: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/sdg: 2147 MB, 2147483648 bytes
Disk identifier: 0xe9787a94
Disk /dev/mapper/sanvg-sanvol1: 943 MB, 943718400 bytes
Disk identifier: 0x00000000

 

If you want to see the LUN to Disk mapping refer the following output

[root@gurkulrhel4 by-path]# ls -altr /dev/disk/by-path/
total 0
drwxr-xr-x 5 root root 100 Apr 15 11:30 ..
lrwxrwxrwx 1 root root 9 Apr 15 11:30 pci-0000:00:01.1-scsi-1:0:0:0 -> ../../sr0
lrwxrwxrwx 1 root root 9 Apr 15 11:30 pci-0000:00:0d.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Apr 15 11:30 pci-0000:00:0d.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Apr 15 11:30 pci-0000:00:0d.0-scsi-1:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Apr 15 11:30 pci-0000:00:0d.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 9 Apr 15 12:59 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target1-lun-1 -> ../../sde
lrwxrwxrwx 1 root root 9 Apr 15 12:59 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target1-lun-2 -> ../../sdg
lrwxrwxrwx 1 root root 9 Apr 15 12:59 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target2-lun-1 -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 15 12:59 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target1-lun-2-part1 -> ../../sdg1
lrwxrwxrwx 1 root root 10 Apr 15 12:59 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target1-lun-1-part1 -> ../../sde1
lrwxrwxrwx 1 root root 9 Apr 15 13:10 pci-0000:00:0d.0-scsi-2:0:0:0 -> ../../sdc
lrwxrwxrwx 1 root root 10 Apr 15 13:10 pci-0000:00:0d.0-scsi-2:0:0:0-part1 -> ../../sdc1
lrwxrwxrwx 1 root root 9 Apr 15 13:11 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target3-lun-1 -> ../../sdf
lrwxrwxrwx 1 root root 10 Apr 15 13:12 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target3-lun-1-part1 -> ../../sdf1
[root@gurkulrhel4 by-path]#

And in this scenario we talking about the resize of  below device

lrwxrwxrwx 1 root root 9 Apr 15 13:11 ip-192.168.1.30:3260-iscsi-iqn.2013-04.com.unixadminschool:target3-lun-1 -> ../../sdf

At client Side, we did configured the  /dev/sdf in LVM, and create a  volume as shown below

 

[root@gurkulrhel4 ~]# pvcreate /dev/sdf
Writing physical volume data to disk “/dev/sdf”
Physical volume “/dev/sdf” successfully created
[root@gurkulrhel4 ~]# pvs
Couldn’t find device with uuid P5I7xf-EvXg-nFnJ-XYH2-MxDi-ftf0-dwLfOU.
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_gurkulrhel2 lvm2 a– 15.51g 0
/dev/sdb vg_gurkulrhel2 lvm2 a– 2.00g 0
/dev/sdf lvm2 a– 1.00g 1.00g
unknown device vg_gurkulrhel2 lvm2 a-m 2.00g 516.00m

[root@gurkulrhel4 ~]# vgcreate sanvg /dev/sdf
Volume group “sanvg” successfully created

[root@gurkulrhel4 ~]# lvcreate sanvg -n sanvol1 -L 900M
Logical volume “sanvol1” created

[root@gurkulrhel4 ~]# lvs
Couldn’t find device with uuid P5I7xf-EvXg-nFnJ-XYH2-MxDi-ftf0-dwLfOU.
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
sanvol1 sanvg -wi-a— 900.00m
data1 vg_gurkulrhel2 -wi-a— 2.00g
data2 vg_gurkulrhel2 -wi-a— 1.00g
data3 vg_gurkulrhel2 -wi-a— 500.00m
lv_root vg_gurkulrhel2 -wi-ao– 11.57g
lv_swap vg_gurkulrhel2 -wi-ao– 3.94g

[root@gurkulrhel4 ~]# mkfs.ext3 /dev/sanvg/sanvol1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
57600 inodes, 230400 blocks
11520 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=239075328
8 block groups
32768 blocks per group, 32768 fragments per group
7200 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@gurkulrhel4 ~]# mount /dev/sanvg/sanvol1 /test-data/

[root@gurkulrhel4 test-data]# cp /etc/* /test-data/

[root@gurkulrhel4 test-data]# df -k /test-data
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/sanvg-sanvol1
907096 19640 841376 3% /test-data

 

Now Go to The Actual task of Expanding LUN from the Server Side

 

Step 1: Increase the LUN i.e. /dev/iscsivg/lvdisk2 size by 900 MB

[root@gurkulsan ]# lvextend -L +900MB /dev/iscsivg/lvdisk2
Extending logical volume lvdisk2 to 1.88 GiB
Logical volume lvdisk2 successfully resized
[root@gurkulsan rules.d]#
[root@gurkulsan rules.d]#
[root@gurkulsan rules.d]#
[root@gurkulsan rules.d]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
lvdisk1 iscsivg -wi-ao– 2.00g
lvdisk2 iscsivg -wi-ao– 1.88g
sanvol1 sanvg -wi—– 900.00m
lv_root vg_gurkulrhel2 -wi-ao– 11.57g
lv_swap vg_gurkulrhel2 -wi-ao– 3.94g

But, the tgtd ( ISCSI server side daemon) not yet relized the new size of the LUN.

[root@gurkulsan ]# tgtadm –lld iscsi –mode target –op show
Target 1: iqn.2013-04.com.unixadminschool:target1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 2
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb
Backing store flags:
LUN: 2
Type: disk
SCSI ID: IET 00010002
SCSI SN: beaf12
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdc
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
192.168.1.35
Target 2: iqn.2013-04.com.unixadminschool:target2
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00020000
SCSI SN: beaf20
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00020001
SCSI SN: beaf21
Size: 1074 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/iscsivg/lvdisk1
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
Target 3: iqn.2013-04.com.unixadminschool:target3
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 3
Initiator: iqn.1994-05.co
m.redhat:8a9068e4acb2

Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00030000
SCSI SN: beaf30
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00030001
SCSI SN: beaf31
Size: 1074 MB, Block size: 512 <== New LUN size not yet reflecting here
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/iscsivg/lvdisk2
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34

Step 2:  To Let tgtd aware of new lun size we have to remove the LUN entry and reattached it to Same Taget.

Please be aware this is non destructive task, you wont miss any data from the client side if it is already in use.

[root@gurkulsan ~]# tgtadm –lld iscsi –mode logicalunit –op delete –tid 3 –lun 1

Just checking the client for any filesystem issues related to the lun i am working, all found good.

root@gurkulrhel4 test-data]# df -k /test-data
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/sanvg-sanvol1 907096 17548 843468 3% /test-data

 Now from the Server I have reattached the LUN to the target, as below

[root@gurkulsan rules.d]# tgtadm –lld iscsi –mode logicalunit –op new –tid 3 –lun 1 –backing-store /dev/iscsivg/lvdisk2
[root@gurkulsan rules.d]# tgtadm –lld iscsi –mode target –op show
Target 1: iqn.2013-04.com.unixadminschool:target1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 2
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb
Backing store flags:
LUN: 2
Type: disk
SCSI ID: IET 00010002
SCSI SN: beaf12
Size: 2147 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdc
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
192.168.1.35
Target 2: iqn.2013-04.com.unixadminschool:target2
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 1
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00020000
SCSI SN: beaf20
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00020001
SCSI SN: beaf21
Size: 1074 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/iscsivg/lvdisk1
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
Target 3: iqn.2013-04.com.unixadminschool:target3
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 3
Initiator: iqn.1994-05.com.redhat:8a9068e4acb2
Connection: 0
IP Address: 192.168.1.34
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00030000
SCSI SN: beaf30
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00030001
SCSI SN: beaf31
Size: 2017 MB, Block size: 512 <== New LUN size was reflected here
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/iscsivg/lvdisk2
Backing store flags:
Account information:
sanclient
ACL information:
192.168.1.34
[root@gurkulsan rules.d]#

 

Client Side configuration to Resize the corresponding Filesystem, related to the resized LUN

 

Step 1 :  Check if there is any size difference  for the disk /dev/sdf ( i.e. the lun we resized). but, we see no increase in size.

[root@gurkulrhel4 test-data]# fdisk -l|grep -i Disk
Disk /dev/sdb: 2147 MB, 2147483648 bytes
Disk identifier: 0x00000000
Disk /dev/sda: 17.2 GB, 17179869184 bytes
Disk identifier: 0x000ae2a8
Disk /dev/sdc: 2147 MB, 2147483648 bytes
Disk identifier: 0xd480d9c7
Disk /dev/mapper/vg_gurkulrhel2-lv_root: 12.4 GB, 12423528448 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-lv_swap: 4227 MB, 4227858432 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data1: 2147 MB, 2147483648 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data2: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data3: 524 MB, 524288000 bytes
Disk identifier: 0x00000000
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/sde: 2147 MB, 2147483648 bytes
Disk identifier: 0xaed24ed6
Disk /dev/sdf: 1073 MB, 1073741824 bytes <== Still showing old size of 1GB
Disk identifier: 0x00000000
Disk /dev/sdg: 2147 MB, 2147483648 bytes
Disk identifier: 0xe9787a94

 

Step 2: Do the manual rescan for the target related to the  /dev/sdf

Do you remember how can get that related target information ?
It’s simple just do the “ls -l /dev/disk/by-path/” you will see all the LUN to disk mappings there

Ok. let’s rescan the target

[root@gurkulrhel4 test-data]# iscsiadm -m node –targetname iqn.2013-04.com.unixadminschool:target3 -R
Rescanning session [sid: 21, target: iqn.2013-04.com.unixadminschool:target3, portal: 192.168.1.30,3260]
[root@gurkulrhel4 test-data]# fdisk -l|grep -i Disk
Disk /dev/sdb: 2147 MB, 2147483648 bytes
Disk identifier: 0x00000000
Disk /dev/sda: 17.2 GB, 17179869184 bytes
Disk identifier: 0x000ae2a8
Disk /dev/sdc: 2147 MB, 2147483648 bytes
Disk identifier: 0xd480d9c7
Disk /dev/mapper/vg_gurkulrhel2-lv_root: 12.4 GB, 12423528448 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-lv_swap: 4227 MB, 4227858432 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data1: 2147 MB, 2147483648 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data2: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_gurkulrhel2-data3: 524 MB, 524288000 bytes
Disk identifier: 0x00000000
Disk /dev/sdd: 1073 MB, 1073741824 bytes
Disk identifier: 0x00000000
Disk /dev/sde: 2147 MB, 2147483648 bytes
Disk identifier: 0xaed24ed6
Disk /dev/sdf: 2017 MB, 2017460224 bytes <– Now , we can see the new lun size.
Disk identifier: 0x00000000
Disk /dev/sdg: 2147 MB, 2147483648 bytes
Disk identifier: 0xe9787a94

 You can check Client side system log, for more confirmation

[root@gurkulrhel4 test-data]# tail -f /var/log/messages
Apr 15 14:31:47 gurkulrhel4 kernel: sd 25:0:0:1: [sdf] Sense Key : Illegal Request [current]
Apr 15 14:31:47 gurkulrhel4 kernel: sd 25:0:0:1: [sdf] Add. Sense: Logical unit not supported
Apr 15 14:31:47 gurkulrhel4 kernel: sd 25:0:0:1: [sdf] CDB: Write(10): 2a 00 00 08 16 20 00 00 08 00
Apr 15 14:31:47 gurkulrhel4 kernel: Buffer I/O error on device dm-5, logical block 65988
Apr 15 14:31:47 gurkulrhel4 kernel: lost page write due to I/O error on dm-5
Apr 15 14:31:47 gurkulrhel4 kernel: JBD: I/O error detected when updating journal superblock for dm-5.
Apr 15 14:32:36 gurkulrhel4 kernel: sd 25:0:0:1: [sdf] Warning! Received an indication that the LUN assignments on this target have changed. The Linux S CSI layer does not automatically remap LUN assignments.
Apr 15 14:33:51 gurkulrhel4 kernel: sd 25:0:0:1: [sdf] 3940352 512-byte logical blocks: (2.01 GB/1.87 GiB)
Apr 15 14:33:51 gurkulrhel4 kernel: sdf: detected capacity change from 1073741824 to 2017460224
Apr 15 14:33:55 gurkulrhel4 kernel: sdf: unknown partition table

Step 3 : Now, Inform the LVM about the LUN size change, and resize the filesystem as required

[root@gurkulrhel4 test-data]# pvresize /dev/sdf
Physical volume “/dev/sdf” changed
1 physical volume(s) resized / 0 physical volume(s) not resized

[root@gurkulrhel4 test-data]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_gurkulrhel2 lvm2 a– 15.51g 0
/dev/sdb vg_gurkulrhel2 lvm2 a– 2.00g 0
/dev/sdf sanvg lvm2 a– 1.88g 1020.00m <– now, LVM knows about the new size

But the filesystem not yet realized the new size

[root@gurkulrhel4 test-data]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_gurkulrhel2-lv_root   12G 6.1G 4.8G 56% /
tmpfs 1003M 88K 1003M 1% /dev/shm     /dev/sda1 485M 37M 423M 9% /boot
/dev/sde1 2.0G 35M 1.9G 2% /shared-data
/dev/mapper/sanvg-sanvol1 886M 20M 822M 3% /test-data   <== Size as same as earlier

Resize /test-data to expand the filesystem. 

[root@gurkulrhel4 test-data]# lvresize /dev/sanvg/sanvol1 -L +900M
Extending logical volume sanvol1 to 1.76 GiB
Logical volume sanvol1 successfully resized

Note: my Linux server doesn’t have latest resize2fs , so I cannot expand the ext3 filesystem online. And that is the reason you see me doing offline resize here. But you can go for online resize if you have updated “e2fsprogs” 

[root@gurkulrhel4 test-data]# resize2fs /dev/sanvg/sanvol1
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/sanvg/sanvol1 is mounted on /test-data; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
resize2fs: Input/output error While checking for on-line resizing support

If you are curious how to get the package name related the resize2fs , you can use the below command

[root@gurkulrhel4 test-data]# yum provides /sbin/resize2fs
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
e2fsprogs-1.41.12-3.el6.x86_64 : Utilities for managing ext2, ext3, and ext4 filesystems
Repo : ol6_latest
Matched from:
Filename : /sbin/resize2fs

Now, we do the offline resize for the /test-data

 

[root@gurkulrhel4 ~]# umount /dev/sanvg/sanvol1
[root@gurkulrhel4 ~]# resize2fs /dev/sanvg/sanvol1

resize2fs 1.41.12 (17-May-2010)Please run ‘e2fsck -f /dev/sanvg/sanvol1’ first.

[root@gurkulrhel4 ~]# e2fsck -f /dev/sanvg/sanvol1

e2fsck 1.41.12 (17-May-2010)
/dev/sanvg/sanvol1: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sanvg/sanvol1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sanvg/sanvol1: 151/57600 files (0.0% non-contiguous), 8536/230400 blocks

[root@gurkulrhel4 ~]# resize2fs /dev/sanvg/sanvol1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/sanvg/sanvol1 to 460800 (4k) blocks.
The filesystem on /dev/sanvg/sanvol1 is now 460800 blocks long.

[root@gurkulrhel4 ~]# mount /dev/sanvg/sanvol1 /test-data/
[root@gurkulrhel4 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_gurkulrhel2-lv_root
12G 6.4G 4.5G 59% /
tmpfs 1003M 88K 1003M 1% /dev/shm
/dev/sda1 485M 37M 423M 9% /boot
/dev/sde1 2.0G 35M 1.9G 2% /shared-data
/dev/mapper/sanvg-sanvol1  1.8G 20M 1.7G 2% /test-data <– we can see new size can be reflected here

 

 

We will be discussing about the iscsi configuration for shared storage for Cluster environment  in the next post . Please feel to add your questions and comments to the post

 

 How to Stay Connected to Us ?

You can simply subscribe for our free email posts from here 

We have very active community to answer your questions at any time – Join our Just Facebook’s just-UNIX-no-noise group  or Linked in  Enterprise UNIX administration  group

Join our  Professional network with 2000+ Unix Engineers – LinkedIn

It’s easy to get our updates with our  twitter and Google + social networks

 

 

 

 

 

 

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

You may also like...

8 Responses

  1. Elumalai M says:

    Hi Ramdev,

    Thanks for sharing this steps. I have Question on Step 2.

    You already mention it’s a non destructive task. Still I am thinking, When delete and reattach in tid 3 lun 1, normally the connection will be disappear from server to client for this particular LUN. My Question is how this FS(/test-data) is available while performing this operation ? 

    Thanks in advance for detail.

  2. Ramdev Ramdev says:

    Hi Elumalia,

    I am glad  you asked the question.  The delete option will just remove the in-kernel mappings, but it wont terminate the active  i/o happening between the initiator and the target related to the lun, until the iscsi initiator rediscovers and rebinds to the target as per the new kernel mappings.

    Some people complain this functionality as bug and other’s say it is normal behaviour. I chose to believe it is a normal function:)

  3. Elumalai M says:

    Thanks Ramdev for the explanation.  Now I understood the background action.  

    One more question 
    Any idea ISCSI LUN resize will support from which kernel or RHEL version ?

  4. Alok Kumar says:

    Hi  Dear Ramdev,

    your guide is awesome.
    I hav recently subscribed but while I trying to access some link like- “RHEL 6 – ISCSI Administration Series – Configuring ISCSI Server and Client ” It prompts for user name and password. plz suggest me how to register and get the username & password.

    Thank you for such a great effort….!!

  5. Ramdev Ramdev says:

    Hi alok, there is no user authentication setup for this post. you can access all posts directly, and everything available for public,  please Try the link http://wp.me/p1EO9J-28B

  6. Musab says:

    Hey RAM, glad to see your blog, how come i did not came on this wonderful site, i’m surprise to great stuff here. Thanks for it. Hope you remember me..

    Musab from Kernel

  1. September 17, 2015

    […] Read – ISCSI Lun resize in RHEL 6 […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us