RHEL: Extending a multipath LUN

# Tested on RHEL 6


# This procedure may be carried out to make visible the new size of a LUN that is already
# presented and used by the OS and that has been extended at SAN storage level.

# Whenever possible I recommend to create a new LUN at SAN level instead of doing an
# extension. In some situations we may experience some trouble when trying to recognize
# the new size of a disk that has been extended so a reboot may be necessary.


# Find the paths to the LUN:

multipath -ll
[...]
   my_lun_01 (200255c3a11080003) dm-38 NEC,DISK ARRAY
   size=120G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
   |-+- policy='round-robin 0' prio=50 status=active
   | |- 1:0:2:0 sdm 65:32 active ready running
   | `- 2:0:2:0 sdo 65:64 active ready running
   `-+- policy='round-robin 0' prio=10 status=enabled
     |- 1:0:3:0 sdn 65:16 active ready running
     `- 2:0:3:0 sdp 65:48 active ready running



# Rescan the paths:

echo 1 > /sys/block/sdm/device/rescan
echo 1 > /sys/block/sdo/device/rescan
echo 1 > /sys/block/sdn/device/rescan
echo 1 > /sys/block/sdp/device/rescan




# Resize the multipath device:

multipathd -k'resize map my_lun_01'
   ok

# or, in interactive mode:
# multipathd -k
# multipathd> resize map my_lun_01
# ok
# multipathd> exit



# Check

multipath -ll
[...]
   my_lun_01 (200255c3a11080003) dm-38 NEC,DISK ARRAY
   size=120G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
   |-+- policy='round-robin 0' prio=50 status=active
   | |- 1:0:2:0 sdm 65:32 active ready running
   | `- 2:0:2:0 sdo 65:64 active ready running
   `-+- policy='round-robin 0' prio=10 status=enabled
     |- 1:0:3:0 sdn 65:16 active ready running
     `- 2:0:3:0 sdp 65:48 active ready running




# At this point, physical volume size shown by 'pvdisplay' and 'fdisk' should be different.


# If existing physical volume was created directly on the whole disk, without partition,
# a 'pvresize' should be enough for the new size to be taken into account

pvresize /dev/$SD

# If, on the other hand, disk is already partitioned, this is, we are using devices in the
# form /dev/sdx1, /dev/sdx2, we have to create a new partition with 'fdisk' tool

fdisk /dev/$SD

   The number of cylinders for this disk is set to 2480.
   There is nothing wrong with that, but this is larger than 1024,
   and could in certain setups cause problems with:
   1) software that runs at boot time (e.g., old versions of LILO)
   2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) 
 
   Command (m for help): p
 
   Disk /dev/sdc: 20.4 GB, 20401094656 bytes
   255 heads, 63 sectors/track, 2480 cylinders
   Units = cylinders of 16065 * 512 = 8225280 bytes   
 
   Device Boot      Start         End      Blocks   Id  System
   /dev/sdc1   *           1          33      265041   83  Linux
   /dev/sdc2              34        1958    15462562+  8e  Linux LVM


# Let's create a new partition. In our case, we'll create partition # 3
# (primary Linux LVM partition). For the first and last cylinder usually default values
# will be ok; if not, choose carefully the beginning and the end of the new partition to
# avoid

   Command (m for help): n
   Command action   
   e   extended   
   p   primary partition (1-4)
   p
   Partition number (1-4): 3
   First cylinder (1959-2480, default 1959):
   Using default value 1959
   Last cylinder or +size or +sizeM or +sizeK (1959-2480, default 2480):
   Using default value 2480 
 
   Command (m for help): t
   Partition number (1-4): 3
   Hex code (type L to list codes): 8e
   Changed system type of partition 3 to 8e (Linux LVM) 
 
   Command (m for help): w
   The partition table has been altered!
 
   Calling ioctl() to re-read partition table.
 
   WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
   The kernel still uses the old table.
   The new table will be used at the next reboot.
   Syncing disks.

# Rescan disks

partprobe -s

# It may be that we have an error like following on (usually on RHEL 6):

Warning: WARNING: the kernel failed to re-read the partition table on /dev/sdc (Device or resource busy).
As a result, it may not reflect all of your changes until after reboot.

# The use following command instead:

partx -a /dev/$SD
 

# New partition is ready to be used ('pvcreate', etc)

brw-r----- 1 root disk 8, 33 Nov  3 15:15 /dev/sdc1

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Configuring VLAN interfaces in Linux
Viewed 5340 times since Mon, May 21, 2018
Check a Website Availability from the Linux Command Line
Viewed 6402 times since Mon, Feb 18, 2019
Linux Health Check Commands
Viewed 2983 times since Fri, Jun 8, 2018
How to deal with dmesg timestamps
Viewed 3315 times since Wed, Oct 3, 2018
YUM CRON RHEL7: Configure automatic updates.
Viewed 1900 times since Fri, Oct 26, 2018
Red Hat ADDING SWAP SPACE
Viewed 1958 times since Fri, Jun 8, 2018
CONFIGURE FOR ASM Linux
Viewed 5441 times since Sat, Jun 2, 2018
Linux - How to monitor memory usage
Viewed 2984 times since Fri, Jun 8, 2018
Enabling automatic updates in Centos 7 and RHEL 7
Viewed 2393 times since Wed, Oct 17, 2018
RHEL: Allowing users to ’su’ to "root" / Allowing ’root’ to login directly to the system using ’ssh’
Viewed 2749 times since Sat, Jun 2, 2018