Resizing iSCSI LUNs on Linux Client

The following procedures explain how to expand your iSCSI storage volume on CentOS:

  1. Discovering iSCSI targets
  2. Creating File System
  3. Unmounting the file system and logging out the iSCSI targets
  4. Editing Quota Size (in ElastiCenter)
  5. LUN expansion and resizing file system (on CentOS Console)

Discovering iSCSI targets

Perform the following procedures to discover the iSCSI targets and log in to them:

Step Task Command Example Details
1 Discover the iSCSI targets. iscsiadm -m discovery -t st -p <Target IP Address> iscsiadm -m discovery -t st -p 11.11.11.11 Outputs the complete target name.
2 Log in to the iSCSI target. iscsiadm -m node -T <Complete Target Name> -l iscsiadm -m node -T iqn.2014-02.FCAcc.Test:FCAcciscsivol1 -l
3 Display the current partitions on the hard disk. fdisk –l The partition is displayed in the output.

Creating File System

In the CentOS console, run the commands provided in the table in sequence to create a file system on the iSCSI LUN and mount it on the Linux Client:

Step Task Command Example Details
1 Create a file system on the hard disk drive. For ext3:
mkfs.ext3 <Partition name>

For XFS:
mkfs.xfs <Partition name>
mkfs.ext3 /dev/sdc





mkfs.xfs /dev/sdc
At prompt, confirm by typing y as shown in the following example: /dev/sdc is entire device, not just one partition! Proceed anyway? (y,n) y
2 Create a directory. mkdir <Directory name> mkdir /mnt/cbdata
3 Mount the partition into your directory. mount <Partition name> <Directory name> mount /dev/sdc /mnt/cbdata -o sync  
4 (Optional) Retrieve the current size of the mounted LUN. df –kh
5 (Optional) Copy some data to the directory /mnt/cbdata. cp

Unmounting the file system and logging out the iSCSI targets

Step Task Command Example
1 Unmount directory from the disk. umount <Directory name> umount /mnt/cbdata
2 Log out of iSCSI target. iscsiadm -m node -u -T <Complete target name> -p <Target IP Address> iscsiadm -m node -u -T iqn.2014-02.Acc1.TSM3:TSM3TSM3ISCSI11 -p 11.11.11.11

Editing Quota Size (in ElastiCenter)

    1. In the ElastiCenter, select Storage Volumes.
    2. In the Storage Volumes page, click Settings > Edit.
    3. Increase the Quota size of the LUN and then click Save.

resizing iSCSI LUN

LUN expansion and resizing the file system (on CentOS Console)

Ensure that you have performed all the steps in the section “Unmounting the file system and logging out the iSCSI targets” before proceeding further.

In the CentOS console, run the commands provided in the table in sequence to expand the LUN and resize the file system:

Step Task Command Example Details
1 Log in to iSCSI target. iscsiadm -m node -T <Complete target name> -p <Target IP Address> –l iscsiadm -m node -T iqn.2014-02.Acc1.TSM3:TSM3TSM3ISCSI11 -p 16.10.10.3 –l
2 Display current partitions on the hard disk. fdisk –l Check the output to see if the disk size has increased.
3 Mount the partition into the directory. mount partition name <Directory name> -o sync mount /dev/sdb /mnt/cbdata/ -o sync
4 Resize the expanded volume.

For ext3:
resize2fs /dev/sdb/ total space of volume

For XFS:

xfs_growfs mount_point
or

xfs_growfs mount_point -D new_block_size

 

resize2fs /dev/sdb/ 5G




xfs_growfs /mnt/cbdata
or
xfs_growfs /mnt/cbdata -D 23593680

In this example, 5G is the total space on the resized Volume.



XFS file system expands to the maximum available space on the iSCSI LUN.

Using this command, you can specify the total space on the resized volume.
5 Retrieve the current size of the resized LUN. df –kh