How to resize a online storage logical unit(LUN)?
In most cases, fully resizing an online logical unit involves two things:
resizing the logical unit itself
reflecting the size change in the corresponding multipath device (if multipathing is enabled on the system)
To resize the online logical unit, start by modifying the logical unit size through the array management interface of your storage device. This procedure differs with each array; as such, consult your storage array vendor documentation for more information on this.
In order to resize an online file system, the file system must not reside on a partitioned device.
Resizing Fibre Channel Logical Units
After modifying the online logical unit size, re-scan the logical unit to ensure that the system detects the updated size. To do this for Fibre Channel logical units, use the following command:
$ echo 1 > /sys/block/sdX/device/rescan
To re-scan Fibre Channel logical units on a system that uses multipathing, execute the aforementioned command for each sd device (i.e. sd 1, sd 2, and so on) that represents a path for the multipathed logical unit. To determine which devices are paths for a multipath logical unit, use mul ti path -ll ; then, find the entry that matches the logical unit being resized. It is advisable that you refer to the WWID of each entry to make it easier to find which one matches the logical unit being resized.
Resizing an iSCSI Logical Unit
After modifying the online logical unit size, re-scan the logical unit to ensure that the system detects the updated size. To do this for iSCSI devices, use the following command:
# iscsiadm -m node --targetname target_name -R
Replace target_name with the name of the target where the device is located.
You can also re-scan iSCSI logical units using the following command:
# iscsiadm -m node -R -I interface
Replace interface with the corresponding interface name of the resized logical unit (for example, i face0 ). This command performs two operations:
It scans for new devices in the same way that the command
echo "- - -" > /sys/class/scsi_host/host/scan
It re-scans for new/modified logical units the same way that the command does
echo 1 > /sys/block/sdX/device/rescan
Note that this command is the same one used for re-scanning Fibre Channel logical units.
Updating the Size of Your Multipath Device
If multipathing is enabled on your system, you will also need to reflect the change in logical unit size to the logical unit's corresponding multipath device (after resizing the logical unit). This can be done through mul ti pathd . To do so, first ensure that mul ti pathd is running using service multipathd status. Once you've verified that multipathd is operational, run the following command:
# multipathd -k"resize map multipath_device"
The multipath_device variable is the corresponding multipath entry of your device in /dev/mapper. Depending on how multipathing is set up on your system, multipath_device can be either of two formats:
mpathX, where X is the corresponding entry of your device (for example, mpath0 )
a WWID ; for example, 36 0 0 50 8b4 0 0 10 5e210 0 0 0 9 0 0 0 0 0 4 9 0 0 0 0
To determine which multipath entry corresponds to your resized logical unit, run mul ti path -ll . This displays a list of all existing multipath entries in the system, along with the major and minor numbers of their corresponding devices.
Do not use multipathd -k"resize map multipath_device" if there are any commands queued to multipath_device. That is, do not use this command when the no _path_retry parameter (in /etc/multipath. conf) is set to "queue", and there are no active paths to the device.