Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

1.13. Online Logical Units

This chapter will cover resizing online logical units, including resizing fibre channel logical units, resizing an iSCSI logical units, and updating the size of a multipath device, as well as changing the read/write state of onlin logical units.

1.13.1. Resizing an Online Logical Unit

In most cases, fully resizing an online logical unit involves two things: resizing the logical unit itself and 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.

Note

In order to resize an online file system, the file system must not reside on a partitioned device.

1.13.1.1. 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

Important

To re-scan fibre channel logical units on a system that uses multipathing, execute the aforementioned command for each sd device (i.e. sd1, sd2, and so on) that represents a path for the multipathed logical unit. To determine which devices are paths for a multipath logical unit, use multipath -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.

1.13.1.2. 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[1]
Replace target_name with the name of the target where the device is located.

Note

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, iface0). This command performs two operations:
  • It scans for new devices in the same way that the command echo "- - -" > /sys/class/scsi_host/host/scan does (refer to Section 1.11, “Scanning iSCSI Interconnects”).
  • It re-scans for new/modified logical units the same way that the command echo 1 > /sys/block/sdX/device/rescan does. Note that this command is the same one used for re-scanning fibre-channel logical units.

1.13.1.3. 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). For Red Hat Enterprise Linux 5.3 (or later), you can do this through multipathd. To do so, first ensure that multipathd 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, 3600508b400105e210000900000490000
To determine which multipath entry corresponds to your resized logical unit, run multipath -ll. This displays a list of all existing multipath entries in the system, along with the major and minor numbers of their corresponding devices.

Important

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.
If your system is using Red Hat Enterprise Linux 5.0-5.2, you will need to perform the following procedure to instruct the multipathd daemon to recognize (and adjust to) the changes you made to the resized logical unit:

Procedure 1.4. Resizing the Corresponding Multipath Device (Required for Red Hat Enterprise Linux 5.0 - 5.2)

  1. Dump the device mapper table for the multipathed device using:
    dmsetup table multipath_device
  2. Save the dumped device mapper table as table_name. This table will be re-loaded and edited later.
  3. Examine the device mapper table. Note that the first two numbers in each line correspond to the start and end sectors of the disk, respectively.
  4. Suspend the device mapper target:
    dmsetup suspend multipath_device
  5. Open the device mapper table you saved earlier (i.e. table_name). Change the second number (i.e. the disk end sector) to reflect the new number of 512 byte sectors in the disk. For example, if the new disk size is 2GB, change the second number to 4194304.
  6. Reload the modified device mapper table:
    dmsetup reload multipath_device table_name
  7. Resume the device mapper target:
    dmsetup resume multipath_device
For more information about multipathing, refer to the Using Device-Mapper Multipath guide (in http://www.redhat.com/docs/manuals/enterprise/).