SUSE Support

Here When You Need Us

HOWTO: Add, Resize and Remove LUN without restarting SLES

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

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10

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` and 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.

3. Once the disk is seen by the OS, execute `multipath` or `multipath -v4` (verbose) to build the new MPIO map.
4. On SLES 10 execute `udevtrigger`. (On SLES 11 and above, 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.
 a) On SLES 11,12,or 15 use `multipathd -k'resize map <MPIO_MAP_NAME>'`  
 b) If the resize command fails to resize the LUN or if running SLES 10, restart the multipathd daemon using `/sbin/multipathd restart`
 
NOTE - There is no space between the -k and 'resize in the multipathd command.

4. 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 without "user_friendly_names" being enabled:
 
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.
 
7. Ensure the LUNs have disappeared from the output of `lsscsi`.
8. Remove the stale block device entries.  On SLES 11 and above use `multipathd reconfigure`.  SLES 10 requires an additional `udevtrigger`.
9. Hide the LUNs on the storage side.
 
Removing a LUN when "user_friendly_names" is enabled:

Steps are similar as per the above, except step 5. and 6. needs to be adjusted as follows;

5. Remove the user friendly path using (lets assume the name is "mpathb") `dmsetup remove -f mpathb`.
6. Remove the multipath device from ALL paths, run `echo 1 > /sys/block/<path_associated_with_mpath>/device/delete`
 
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 WWID aka 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 WWID or MPIO map name is 36006016073c01400a0c14ebcd9bfde11.

Disclaimer

This Support Knowledgebase provides a valuable tool for 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-2012
  • Modified Date:27-Jun-2024
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

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

tick icon

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.

tick icon

Open an Incident

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