My Favorites

Close

Please to see your favorites.

  • Bookmark
  • Email Document
  • Printer Friendly
  • Favorite
  • Rating:

HOWTO: Add, Resize and Remove LUN without restarting SLES or OES Linux

This document (7009660) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10
Novell Open Enterprise Server 11 (OES 11) Linux
Novell Open Enterprise Server 2 (OES 2) Linux
SUSE Linux Enterprise Server 12 (SLES 12)
SUSE Linux Enterprise Server 12 Service Pack 1 (SLES 12 SP1)

Situation

A LUN on an attached storage device (typically a SAN) needs to be added, resized or removed - without rebooting the server itself.

Resolution

Adding, resizing or removing LUN on a machine that can be rebooted is typically not a difficult task. (Hardware level changes are picked up on the server reboot, and the filesystem can then be created or resized using filesystem specific tools.) However, dynamic storage changes are dependent upon the hardware and software (specifically filesystem) in use. Also, the process varies slightly depending on which SLES version the server is running.

The general process is to add or resize the LUN on the SAN, rescan the servers' SCSI layer to detect the changes, rebuild the MPIO maps, and then add or modify the filesystem. More specific steps are as follows:

Adding a LUN:

  1. Create the LUN on the SAN, and assign it to the server.
  2. On the server, execute `rescan-scsi-bus.sh`. Use `lsscsi` to confirm the LUN is seen by the OS. If the disk is not seen, repeat this step using different command line parameters to scan for all devices (i.e. -w -c -l). If the LUN is still not seen, a reboot may be required.
NOTE - VMware environments may require the -a or --alltargets parameter in order to detect new disks properly.
  1. Once the disk is seen by the OS, execute `multipath` or `multipath -v4` (verbose) to build the new MPIO map.
  2. On SLES 10 execute `udevtrigger`. (On SLES11 udevadm trigger is executed automatically)

Resizing a LUN:

  1. Increase the size of the LUN on the SAN.
  2. On the server, execute `echo 1 > /sys/block/sdX/device/rescan`.
  3. Resize the MPIO map using `multipathd -k'resize map <MPIO_MAP_NAME>`  (SLES 11), or restart the multipathd daemon using `/sbin/multipathd restart` (works on SLES 10 and SLES 11).
NOTE - There is no space between the -k and 'resize in the multipathd command.
  1. After confirming the MPIO map reflects the correct size, resize the filesystem using the appropriate filesystem specific tool. (i.e. resize2fs, resize_reiserfs, pvresize, lvresize, nssmu, etc.).

NOTE: The above procedure is suitable when zero system downtime is required, but doesn't apply for zero application downtime. When an application is actively using a LUN that is being resized, it should be stopped. To keep applications running may lead to unpredictable results.

Removing a LUN:

  1. Stop all file access to the LUN to be removed and umount the filesystem if applicable.
  2. If LVM was used on the device(s) to be removed, make sure that no Logical Volumes, Volume Groups or Physical Volumes are still present / in use on the relevant device(s). For more information see “man lvremove”, “man vgremove” and “man pvremove”.
  3. To verify there are no open files left for the device(s) use “lsof /dev/device_name
  4. Check in the output of `multipath -ll` for the WWID of the LUN to be deleted.
  5. Remove the WWID using `multipath -f <WWID>`.
  6. Remove the multipath device from ALL paths to the LUN, run `echo 1 > /sys/bus/scsi/devices/${H:B:T:L}/delete`  (Where H = host:B = bus:T = target:L = lun) For example, 4:0:0:1
NOTE – If any process should still access the removed LUN, a system crash can occur. Make sure that all processes and applications have been stopped and there's nothing accessing the device.
  1. Ensure the LUNs have disappeared from the output of `lsscsi`.
  2. Remove the stale block device entries, on SLES 11 use `multipathd reconfigure`, SLES 10 requires an additional `udevtrigger`
  3. Hide the LUNs on the storage side.

If the above steps do not work, the hardware may not support dynamic storage changes. If a server restart is not possible, please contact Technical Support for further investigation.

Additional Information

Locating the LUN number is best accomplished using the output of `lsscsi`. The beginning of each device line contains 4 numbers separated by colons. These numbers represent the Host:Bus:Target:LUN of each SCSI device. For example:

# lsscsi
[4:0:0:0]    disk    DGC      RAID 5           0216  /dev/sdb
[4:0:0:1]    disk    DGC      RAID 5           0216  /dev/sdf
[4:0:0:2]    disk    DGC      RAID 5           0216  /dev/sdc
[4:0:1:0]    disk    DGC      RAID 5           0216  /dev/sdd
[4:0:1:1]    disk    DGC      RAID 5           0216  /dev/sdg
[4:0:1:2]    disk    DGC      RAID 5           0216  /dev/sde


In the above output, the LUN number for /dev/sdc and /dev/sde (two individual paths) is 2.

Locating the MPIO map name is best accomplished using the `multipath -ll` output. The following example shows the multipath map for the two devices shown above:

# multipath -ll
36006016073c01400a0c14ebcd9bfde11 dm-6 DGC,RAID 5
size=100G features='1 queue_if_no_path' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=4 status=active
| `- 4:0:0:2 sdc 8:32 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
  `- 4:0:1:2 sde 8:64 active ready running


In this example, the MPIO map name is 36006016073c01400a0c14ebcd9bfde11.

Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7009660
  • Creation Date:21-JUN-12
  • Modified Date:24-FEB-16
    • SUSESUSE Linux Enterprise Server

Did this document solve your problem? Provide Feedback

< Back to Support Search

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center