ONTAP Discussions

Resizing LUN - How to get client to recognize the new size?

vroomanjr
8,057 Views

I've resized a LUN and I am wondering how I get the client to realize that the LUN size has changed.

For instance, I have a LUN connected to a client. I haven't partitioned or created a filesystem on the LUN yet. I go to create a partition and see there are 1-40873 cylinders available. I resize the LUN to a larger size on the NetApp. I go to create a partition and there are still 1-40873 cylinders available which makes me believe the client isn't recognizing the change. Once I reboot and go to create a partition there 1-10422 cylinders available (clearly the sector sizes have changed but at least the client realized something had changed). Is there some way to get the client to recognize LUN size changes without a reboot? I'm using CentOS 6.2.

1 ACCEPTED SOLUTION

aborzenkov
8,057 Views

Here is example of LUN resizing (openSUSE 12.1):

bor@opensuse:~> sudo sg_readcap -v /dev/sdc

    read capacity (10) cdb: 25 00 00 00 00 00 00 00 00 00

Read Capacity results:

   Last logical block address=30719 (0x77ff), Number of blocks=30720

   Logical block length=512 bytes

Hence:

   Device size: 15728640 bytes, 15.0 MiB, 0.02 GB

bor@opensuse:~> sudo /usr/sbin/parted /dev/sdc print

Model: NETAPP LUN (scsi)

Disk /dev/sdc: 15,7MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags

1      1049kB  15,7MB  14,7MB  primary               type=83

simsim> lun resize /vol/v1/lv 30m

bor@opensuse:~> sudo sh -c 'echo 1 > /sys/block/sdc/device/rescan'

[12781.207052] sd 6:0:0:1: [sdc] 61440 512-byte logical blocks: (31.4 MB/30.0 MiB)

[12781.248524] sdc: detected capacity change from 15728640 to 31457280

bor@opensuse:~> sudo sg_readcap -v /dev/sdc

    read capacity (10) cdb: 25 00 00 00 00 00 00 00 00 00

Read Capacity results:

   Last logical block address=61439 (0xefff), Number of blocks=61440

   Logical block length=512 bytes

Hence:

   Device size: 31457280 bytes, 30.0 MiB, 0.03 GB

bor@opensuse:~> sudo /usr/sbin/parted /dev/sdc print

Model: NETAPP LUN (scsi)

Disk /dev/sdc: 31,5MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags

1      1049kB  15,7MB  14,7MB  primary               type=83

View solution in original post

6 REPLIES 6

radek_kubka
8,057 Views

Hi Justin and welcome to the Community!

In essence, you need to rescan the disks - I don't know particular steps on CentOS, but am sure Google will know

Regards,

Radek

arunchak
8,057 Views

HI,

You need to rescan the SCSI bus to detect the changes in disk.

see if this would be of any help:

http://lists.centos.org/pipermail/centos/2005-November/013179.html

http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh-1.25

Thanks,

  Arun

vroomanjr
8,057 Views

Thanks, unfortunately the rescan-scsi-bus.sh script didn't do the trick it seems that it only works for adding/removing SCSI devices. Nonetheless, you've given me something to look into.

aborzenkov
8,057 Views

Normally resized LUN should be recognized immediately if whole device is used (e.g., as LVM PV). Are you using partition on this LUN?

aborzenkov
8,058 Views

Here is example of LUN resizing (openSUSE 12.1):

bor@opensuse:~> sudo sg_readcap -v /dev/sdc

    read capacity (10) cdb: 25 00 00 00 00 00 00 00 00 00

Read Capacity results:

   Last logical block address=30719 (0x77ff), Number of blocks=30720

   Logical block length=512 bytes

Hence:

   Device size: 15728640 bytes, 15.0 MiB, 0.02 GB

bor@opensuse:~> sudo /usr/sbin/parted /dev/sdc print

Model: NETAPP LUN (scsi)

Disk /dev/sdc: 15,7MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags

1      1049kB  15,7MB  14,7MB  primary               type=83

simsim> lun resize /vol/v1/lv 30m

bor@opensuse:~> sudo sh -c 'echo 1 > /sys/block/sdc/device/rescan'

[12781.207052] sd 6:0:0:1: [sdc] 61440 512-byte logical blocks: (31.4 MB/30.0 MiB)

[12781.248524] sdc: detected capacity change from 15728640 to 31457280

bor@opensuse:~> sudo sg_readcap -v /dev/sdc

    read capacity (10) cdb: 25 00 00 00 00 00 00 00 00 00

Read Capacity results:

   Last logical block address=61439 (0xefff), Number of blocks=61440

   Logical block length=512 bytes

Hence:

   Device size: 31457280 bytes, 30.0 MiB, 0.03 GB

bor@opensuse:~> sudo /usr/sbin/parted /dev/sdc print

Model: NETAPP LUN (scsi)

Disk /dev/sdc: 31,5MB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags

1      1049kB  15,7MB  14,7MB  primary               type=83

vroomanjr
8,057 Views

Thank you, I found I had to run the following on the client:

iscsiadm -m node -R -I *interface*

Public