Adding, resizing or removing LUN on a machine that can be rebootedis typically not a difficult task. (Hardware level changes are pickedup on the server reboot, and the filesystem can then be created orresized using filesystem specific tools.) However, dynamic storagechanges are dependent upon the hardware and software (specificallyfilesystem) in use. Also, the process varies slightly depending onwhich SLES version the server is running.
The general processis to add or resize the LUN on the SAN, rescan the servers' SCSIlayer to detect the changes, rebuild the MPIO maps, and then add ormodify the filesystem. More specific steps are as follows:
Addinga LUN:
-
Create the LUN on the SAN, andassign it to the server.
-
On the server, execute` rescan-scsi-bus.sh`. Use ` lsscsi` to confirm the LUN is seen by theOS. If the disk is not seen, repeat this step using differentcommand line parameters to scan for all devices (i.e. -w -c -l). Ifthe LUN is still not seen, a reboot may be required.
NOTE- VMware environments may require the -w or --ids=XX parameter inorder to detect new disks properly.
-
Once the disk is seen by the OS, execute `multipathreconfigure` to build the new MPIO map.
-
On SLES 10 execute `udevtrigger`. (On SLES11udevadm triggeris executed automatically)
其中,文件rescan-scsi-bus.sh在包sg3_utils中。
Resizing a LUN:
-
Increase the size of the LUN onthe SAN.
-
On the server, execute `echo 1 >/sys/block/sdX/device/rescan`.
-
Resize the MPIO map using`multipathd -k'resize map <MPIO_MAP_NAME>` (SLES 10), orrestart the multipathd daemon using `/etc/multipathd restart` (workson SLES 10 and SLES 11).
NOTE - There is no space betweenthe -k and 'resize in themultipathd command. -
After confirming the MPIO mapreflects the correct size, resize the filesystem using theappropriate filesystem specific tool. (i.e. resize2fs,resize_reiserfs, pvresize, lvresize, nssmu, etc.).
NOTE: The above procedure is suitable when zero system downtime isrequired, but doesn't apply for zero application downtime. When anapplication is actively using a LUN that is being resized, it shouldbe stopped. To keep application running may lead to unpredictableresults.
Removing a LUN:
-
Stop all file access to the LUN tobe removed and umount the filesystem if applicable.
-
Check in the output of `multipath-ll` for the WWID of the LUN to be deleted.
-
Remove the WWID using `multipath-f <WWID>`.
-
Remove the multipath device fromall paths to the LUN. Run `echo 1 >/sys/bus/scsi/devices/${SCSI-ID}/delete`.
NOTE – If any process would stillaccess the removed LUN, system crash can occur. Double check that allprocesses and applications have been stopped and there's nothingaccessing the device.
-
Ensure the LUNs have disappeared from the output of lsscsi.
-
Remove the stale block device entries. On SLES 11 use`multipathd reconfigure`, SLES 10 requires additional `udevtrigger`
-
Hide the LUNs on the storage side.
If the above steps do not work, the hardware may not supportdynamic storage changes. If a server restart is not possible, pleasecontact Novell/SUSE Technical Support for further investigation.
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 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.