Resize ASM LUN

This blog post explains how to resize an ASM LUN backed with a sparse flie online with no downtime. In this example, the SCST iSCSI Linux SAN is being used, and the LUNs are backed by sparse files created with dd. This post here explains how to increase the size of a sparse file. The post by Jarneil gives the overall procedure for extending a LUN online. Since partitions are not being used on these LUNs, in accordance with Violin Memory Oracle Best Practices, it should be possible to extend the ASM LUN online with no downtime.

Resize the Sparse File

These LUNs are sparse files on the filesystem. The sparse file for the file-backed LUN is resized as shown below.

[root@oracle651 scst_oracle632]# dd if=/dev/zero of=/scst_oracle632/AsmRec632_01.img bs=512 count=0 seek=2M

Update 2019-04-02

Alternatively, you can use the "qemu-img" command to enlarge or shrink your sparse file (e.g. your "*.img" file). This command is kind of nice because the argument it takes is the amount you want to increase or shrink the sparse file, not the total size of the sparse file. For example here we are adding 2G to a sparse file that is currently 5G to make it a total size of 7G as shown below.

ubuntu@ubuntu-ThinkPad-P72:~/Downloads$ cd /asm0

ubuntu@ubuntu-ThinkPad-P72:/asm0$ ls -lrt

total 68157456

-rw-r--r-- 1 root root 5368709120 Mar 30 10:16 asm_sysd_1_00.img

-rw-r--r-- 1 root root 16106127360 Mar 30 10:16 asm_data_1_00.img

-rw-r--r-- 1 root root 16106127360 Mar 30 10:16 asm_reco_1_00.img

-rw-r--r-- 1 root root 42949672960 Apr 1 08:40 asm_mgmt_1_00.img

ubuntu@ubuntu-ThinkPad-P72:/asm0$ history | grep qemu

285 history | grep qemu

ubuntu@ubuntu-ThinkPad-P72:/asm0$ sudo qemu-img resize asm_sysd_1_00.img +2G

WARNING: Image format was not specified for 'asm_sysd_1_00.img' and probing guessed raw.

Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.

Specify the 'raw' format explicitly to remove the restrictions.

Image resized.

ubuntu@ubuntu-ThinkPad-P72:/asm0$ ls -lrt

total 68157456

-rw-r--r-- 1 root root 16106127360 Mar 30 10:16 asm_data_1_00.img

-rw-r--r-- 1 root root 16106127360 Mar 30 10:16 asm_reco_1_00.img

-rw-r--r-- 1 root root 42949672960 Apr 1 08:40 asm_mgmt_1_00.img

-rw-r--r-- 1 root root 7516192768 Apr 2 09:40 asm_sysd_1_00.img

ubuntu@ubuntu-ThinkPad-P72:/asm0$

Update SCST iSCSI Linux SAN

Run the command on the oracle651 machine (the SCST iSCSI Linux SAN) as shown below. This updates the SCST iSCSI Linux SAN with the new LUN size.

[root@oracle651 scst_oracle632]# scstadmin -resync_dev AsmRec632_01

Collecting current configuration: done.

-> Making requested changes.

-> Setting device attribute 'resync_size' to value '1' for device 'AsmRec632_01': done.

-> Done.

All done.

[root@oracle651 scst_oracle632]#

Resize iSCSI Client Device

The iSCSI device is resized using the iscsiadm command as described here and shown below.

[root@oracle632 ~]# iscsiadm -m node -R

Rescanning session [sid: 1, target: iqn.2014-08.org.vmem:oracle651.san.asm.luns, portal: 10.207.40.74,3260]

Rescanning session [sid: 2, target: iqn.2014-08.org.vmem:oracle651.san.asm.luns, portal: 10.207.41.74,3260]

[root@oracle632 ~]#

Resize Multipath Client Device

Resize the multipath client device as shown below.

[root@oracle632 ~]# multipathd -k"resize map ASM_RECO1"

ok

[root@oracle632 ~]#

Check LUN Client Device Size

The LUN should now be resized as shown below. The LUN originally 512 MB is now 1073 MB.

[root@oracle632 ~]# fdisk -l /dev/mapper/ASM_RECO1

Note: sector size is 4096 (not 512)

Disk /dev/mapper/ASM_RECO1: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 16 cylinders

Units = cylinders of 16065 * 4096 = 65802240 bytes

Sector size (logical/physical): 4096 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 524288 bytes

Disk identifier: 0x00000000

[root@oracle632 ~]#

Resize the LUN in ASM

The previous size of LUN is shown in bold below.

SQL> select name, label, path, total_mb, header_status, mount_status, mode_status from v$asm_disk;

NAME LABEL PATH TOTAL_MB HEADER_STATU MOUNT_S MODE_ST

------------------------------ ------------------------------- ---------------------------------------- ---------- ------------ ------- -------

ASM_DATA1 ASM_DATA1 ORCL:ASM_DATA1 512 MEMBER CACHED ONLINE

ASM_DATA2 ASM_DATA2 ORCL:ASM_DATA2 512 MEMBER CACHED ONLINE

ASM_DATA3 ASM_DATA3 ORCL:ASM_DATA3 512 MEMBER CACHED ONLINE

ASM_DATA4 ASM_DATA4 ORCL:ASM_DATA4 512 MEMBER CACHED ONLINE

ASM_DATA5 ASM_DATA5 ORCL:ASM_DATA5 512 MEMBER CACHED ONLINE

ASM_DATA6 ASM_DATA6 ORCL:ASM_DATA6 512 MEMBER CACHED ONLINE

ASM_DATA7 ASM_DATA7 ORCL:ASM_DATA7 512 MEMBER CACHED ONLINE

ASM_DATA8 ASM_DATA8 ORCL:ASM_DATA8 512 MEMBER CACHED ONLINE

ASM_RECO1 ASM_RECO1 ORCL:ASM_RECO1 512 MEMBER CACHED ONLINE

ASM_RECO2 ASM_RECO2 ORCL:ASM_RECO2 512 MEMBER CACHED ONLINE

ASM_RECO3 ASM_RECO3 ORCL:ASM_RECO3 512 MEMBER CACHED ONLINE

NAME LABEL PATH TOTAL_MB HEADER_STATU MOUNT_S MODE_ST

------------------------------ ------------------------------- ---------------------------------------- ---------- ------------ ------- -------

ASM_RECO4 ASM_RECO4 ORCL:ASM_RECO4 512 MEMBER CACHED ONLINE

ASM_RECO5 ASM_RECO5 ORCL:ASM_RECO5 512 MEMBER CACHED ONLINE

ASM_RECO6 ASM_RECO6 ORCL:ASM_RECO6 512 MEMBER CACHED ONLINE

ASM_RECO7 ASM_RECO7 ORCL:ASM_RECO7 512 MEMBER CACHED ONLINE

ASM_RECO8 ASM_RECO8 ORCL:ASM_RECO8 512 MEMBER CACHED ONLINE

ASM_SLOB1 ASM_SLOB1 ORCL:ASM_SLOB1 1024 MEMBER CACHED ONLINE

ASM_SLOB2 ASM_SLOB2 ORCL:ASM_SLOB2 1024 MEMBER CACHED ONLINE

ASM_SLOB3 ASM_SLOB3 ORCL:ASM_SLOB3 1024 MEMBER CACHED ONLINE

ASM_SLOB4 ASM_SLOB4 ORCL:ASM_SLOB4 1024 MEMBER CACHED ONLINE

ASM_SLOB5 ASM_SLOB5 ORCL:ASM_SLOB5 1024 MEMBER CACHED ONLINE

ASM_SLOB6 ASM_SLOB6 ORCL:ASM_SLOB6 1024 MEMBER CACHED ONLINE

NAME LABEL PATH TOTAL_MB HEADER_STATU MOUNT_S MODE_ST

------------------------------ ------------------------------- ---------------------------------------- ---------- ------------ ------- -------

ASM_SLOB7 ASM_SLOB7 ORCL:ASM_SLOB7 1024 MEMBER CACHED ONLINE

ASM_SLOB8 ASM_SLOB8 ORCL:ASM_SLOB8 1024 MEMBER CACHED ONLINE

ASM_T5121 ASM_T5121 ORCL:ASM_T5121 1024 MEMBER CACHED ONLINE

ASM_T5122 ASM_T5122 ORCL:ASM_T5122 1024 MEMBER CACHED ONLINE

ASM_T5123 ASM_T5123 ORCL:ASM_T5123 1024 MEMBER CACHED ONLINE

ASM_T5124 ASM_T5124 ORCL:ASM_T5124 1024 MEMBER CACHED ONLINE

ASM_T5125 ASM_T5125 ORCL:ASM_T5125 1024 MEMBER CACHED ONLINE

ASM_T5126 ASM_T5126 ORCL:ASM_T5126 1024 MEMBER CACHED ONLINE

ASM_T5127 ASM_T5127 ORCL:ASM_T5127 1024 MEMBER CACHED ONLINE

ASM_T5128 ASM_T5128 ORCL:ASM_T5128 1024 MEMBER CACHED ONLINE

SYSTEMDG SYSTEMDG ORCL:SYSTEMDG 512 MEMBER CACHED ONLINE

33 rows selected.

SQL> /

Now resize the LUN in SQL while connected to the ASM instance and recheck the LUN size.

SQL> alter diskgroup RECO resize disk ASM_RECO1;

Diskgroup altered.

SQL> select name, label, path, total_mb, header_status, mount_status, mode_status from v$asm_disk;

NAME LABEL PATH TOTAL_MB HEADER_STATU MOUNT_S MODE_ST

------------------------------ ------------------------------- ---------------------------------------- ---------- ------------ ------- -------

ASM_DATA1 ASM_DATA1 ORCL:ASM_DATA1 512 MEMBER CACHED ONLINE

ASM_DATA2 ASM_DATA2 ORCL:ASM_DATA2 512 MEMBER CACHED ONLINE

ASM_DATA3 ASM_DATA3 ORCL:ASM_DATA3 512 MEMBER CACHED ONLINE

ASM_DATA4 ASM_DATA4 ORCL:ASM_DATA4 512 MEMBER CACHED ONLINE

ASM_DATA5 ASM_DATA5 ORCL:ASM_DATA5 512 MEMBER CACHED ONLINE

ASM_DATA6 ASM_DATA6 ORCL:ASM_DATA6 512 MEMBER CACHED ONLINE

ASM_DATA7 ASM_DATA7 ORCL:ASM_DATA7 512 MEMBER CACHED ONLINE

ASM_DATA8 ASM_DATA8 ORCL:ASM_DATA8 512 MEMBER CACHED ONLINE

ASM_RECO1 ASM_RECO1 ORCL:ASM_RECO1 1024 MEMBER CACHED ONLINE

ASM_RECO2 ASM_RECO2 ORCL:ASM_RECO2 512 MEMBER CACHED ONLINE

ASM_RECO3 ASM_RECO3 ORCL:ASM_RECO3 512 MEMBER CACHED ONLINE

NAME LABEL PATH TOTAL_MB HEADER_STATU MOUNT_S MODE_ST

------------------------------ ------------------------------- ---------------------------------------- ---------- ------------ ------- -------

ASM_RECO4 ASM_RECO4 ORCL:ASM_RECO4 512 MEMBER CACHED ONLINE

ASM_RECO5 ASM_RECO5 ORCL:ASM_RECO5 512 MEMBER CACHED ONLINE

ASM_RECO6 ASM_RECO6 ORCL:ASM_RECO6 512 MEMBER CACHED ONLINE

ASM_RECO7 ASM_RECO7 ORCL:ASM_RECO7 512 MEMBER CACHED ONLINE

ASM_RECO8 ASM_RECO8 ORCL:ASM_RECO8 512 MEMBER CACHED ONLINE

ASM_SLOB1 ASM_SLOB1 ORCL:ASM_SLOB1 1024 MEMBER CACHED ONLINE

ASM_SLOB2 ASM_SLOB2 ORCL:ASM_SLOB2 1024 MEMBER CACHED ONLINE

ASM_SLOB3 ASM_SLOB3 ORCL:ASM_SLOB3 1024 MEMBER CACHED ONLINE

ASM_SLOB4 ASM_SLOB4 ORCL:ASM_SLOB4 1024 MEMBER CACHED ONLINE

ASM_SLOB5 ASM_SLOB5 ORCL:ASM_SLOB5 1024 MEMBER CACHED ONLINE

ASM_SLOB6 ASM_SLOB6 ORCL:ASM_SLOB6 1024 MEMBER CACHED ONLINE

NAME LABEL PATH TOTAL_MB HEADER_STATU MOUNT_S MODE_ST

------------------------------ ------------------------------- ---------------------------------------- ---------- ------------ ------- -------

ASM_SLOB7 ASM_SLOB7 ORCL:ASM_SLOB7 1024 MEMBER CACHED ONLINE

ASM_SLOB8 ASM_SLOB8 ORCL:ASM_SLOB8 1024 MEMBER CACHED ONLINE

ASM_T5121 ASM_T5121 ORCL:ASM_T5121 1024 MEMBER CACHED ONLINE

ASM_T5122 ASM_T5122 ORCL:ASM_T5122 1024 MEMBER CACHED ONLINE

ASM_T5123 ASM_T5123 ORCL:ASM_T5123 1024 MEMBER CACHED ONLINE

ASM_T5124 ASM_T5124 ORCL:ASM_T5124 1024 MEMBER CACHED ONLINE

ASM_T5125 ASM_T5125 ORCL:ASM_T5125 1024 MEMBER CACHED ONLINE

ASM_T5126 ASM_T5126 ORCL:ASM_T5126 1024 MEMBER CACHED ONLINE

ASM_T5127 ASM_T5127 ORCL:ASM_T5127 1024 MEMBER CACHED ONLINE

ASM_T5128 ASM_T5128 ORCL:ASM_T5128 1024 MEMBER CACHED ONLINE

SYSTEMDG SYSTEMDG ORCL:SYSTEMDG 512 MEMBER CACHED ONLINE

33 rows selected.

SQL>

The ASM_RECO1 LUN has been successfully resized online with no downtime. Note that online LUN resize is only possible with UNPARTITIONED LUN. The Violin Memory Oracle on Flash Best Practice document RECOMMENDS that Oracle ASM LUNs be UNPARTITIONED for this and other important reasons, which include that unpartitioned LUNs are automatically 4K aligned.

Note About Batch Commands

If there are multiple LUNs to be resized, command line batch commands can be used. Some examples are shown below.

for lun in `echo 1 2 3 4 5 6 7 8`; do multipathd -k"resize map ASM_DATA${lun}"; done

for lun in `echo 1 2 3 4 5 6 7 8`; do scstadmin -resync_dev AsmDat632_0${lun}; done