- — HOW-TO: Make Windows 7 Boot Faster
- — TWEAK: Filter Unread Emails in Gmail
- — TIP: Linux Virtual Machine Performance Tweaks
- — HOW-TO: Automated TV Series Downloads Using Raspberry-PI
- — FAQ: Mouse Randomly Freezing in Windows 7
- — TWEAK: Make Torrents Download Faster
HOW-TO: Add LUNs to a Linux Host Without Reboot
Abstraction between the operating system and the hardware is key to being able to modify running systems without having to reboot. Reboot is often associated with the dreaded word "downtime". This short downtime could cost some hundreds of dollars while for some, it could be in the magnitude of hundreds of thousands of dollars.
One of the major reasons for downtime is adding hardware to the host. And, more often than not, it is storage that is being added. Abstraction between the operating system and the hardware layer is key to planning and playing it out without causing or even costing the company downtime.
On the hardware layer, adding LUNs is a simple introduction or mapping of the drive to the host. This is the conventional way of doing it. Sad thing, however, it doesn't always work.
By conventional, I mean this method of rescanning the SCSI bus for a particular host.
echo "- - -" > /sys/class/scsi_host/host0/scanThe triple dashes "- - -" are wildcards that rescan every channel, every target, and every LUN on the specificed SCSI host. The above command scans the SCSI bus for new devices and map those drives to new device nodes that could be used by the Linux host. This works about 60-70% of the time. For the remaining 30-40%, I follow a better route that has flawlessly worked for me so far.
The utility or tool I use doesn't get installed by default. It is imperative that you have the original installation media or an internet connection for this to work.
For RHEL, Fedora and CentOS hosts, the command to run is:
yum -y install sg3_utilsThe above command will likewise install dependent packages that it requires. The sg3_utils package contains a script named rescan-scsi-bus.sh. This is what is needed for the addition of LUNs or drives.
To detect or rescan new devices, invoke the script via "rescan-scsi-bus.sh -l". For SAN LUNs, what I found to have worked perfectly is "rescan-scsi-bus.sh --forcerescan". To get colored output the addition of "--color" makes all that possible.
This works for me whether the host is bare-metal or virtual.
RedHat warns about caveats for using sg3_utils scripts.
So far this tool has helped me avoid reboots and incurring the corresponding downtime. I hope it helps you as well.