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 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
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:
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:
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:
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
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.
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`
Additional Information
# 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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com