SUBSCRIBE via RSS

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/scan
The 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_utils
The 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.

SG3 Known Issues

So far this tool has helped me avoid reboots and incurring the corresponding downtime. I hope it helps you as well.

FUN: Dear Salary..

Work is also having fun.. If you don't enjoy your work, you will not have fun.. and, most importantly, your passion will not be in it.

This photo I grabbed from Facebook. Credits to the original poster. No pun intended.

Dear Salary

Hope you had fun with the picture. I had a good laugh when I first glanced at it. Again, no pun intended.

TWEAK: Fix Java 7 Update 51 Errors

At work, I get to manage and play around with EMC storage arrays. It doesn't need or require that you login often, but sometimes you would have to do it to check the health of the system, create new LUNs or expand existing ones. Its management interface runs on a Java plugin from a browser.

Lately, the helpdesk where I work pushed updates. The Java Runtime Environment 7 Update 51 got included in the push and installed itself on my notebook. I really have no choice on this matter -- as updates are mandatory. This is a nightmare since most of the time updates like this break a lot of things more than fix what it's supposed to. This time it broke my administrative tools to the storage.

The error is weird and it is only now that I have encountered it. The screenshot is below:


Missing required Permissions manifest attribute in main jar: ..

First, I thought it could be that Firefox just blocked the plugin. So I followed the procedure found in this FAQ entry on the support site. The procedure is outlined below.

  1. Open new Tab
  2. Navigate to about:config
  3. Accept security warning
  4. Change extensions.blocklist.enabled to false
  5. Restart browser

This did not solve the problem. I decided to phone a friend, who is also a system administrator (he wishes not to be named).

He suggested that I open the Java Control Panel. And under "Security" tab, lower the Security Level from High (default setting) to Medium. See screenshot below.


After a browser restart, viola! my administrative tools are back to its original functionality.

I hope by sharing my experience, it will help somebody who experiences the same dilemma.

DISCLAIMER: Lowering the security settings of Java is exposing your system to risk. Be warned. I will not be liable for any of your actions or its results. I only wish to restore the functionality to the administrative tools that Java broke.


HOW-TO: Execute the evasi0n iOS7 Jailbreak

The long awaited jailbreak for iOS7 is out. If you have held back from upgrades due to the missing ability to jailbreak, then you'd probably jump the gun and download the jailbreak. Just to warn iPhone5 users out there, if you own a 64-bit phone (iPhone 5s and iPhone 5c) the current release of the evasi0n7 jailbreak will not work. You just have to wait a bit more for the 64-bit mobile substrate to be available then execute the jailbreak.

First of all, you need to download a copy of the evasi0n7 jailbreak. And, if you don't have a recent backup of your phone, hook it up to iTunes and do a backup. Be aware as this is more mandatory than optional. But if you want to risk it, you may proceed without one. It's your phone afterall.

If you are restoring to iOS7 from iOS6 or even iOS5, the backup is required. It will wipe your phone!

For me, I upgraded to iOS 7.0.4 from iOS 5.1.1. This was Apple closing its doors to any restores to iOS6 when they released iOS7. But it's not too late. I have an iPhone4S so this 32-bit phone was safe to "hack" using evasi0n7 jailbreak. I used the v1.0.2 from their website to jailbreak my iPhone4S.

Having the requirements above, upgrade to iOS 7.0.4 via iTunes. Jailbreak on "over the air upgrades" have been reported to fail so I didn't want to experience what others already did.

(I'm assuming that since you we're able to upgrade to iOS 7.0.4 -- like I did -- that you have an internet connection. The evasi0n7 jailbreak needs to connect to the internet to download some binaries.)

Once iOS7 is installed on the device, fireup the evasi0n7 jailbreak executable and follow the on-screen instructions. It will look similar to this:

Uploading Jailbreak Data

Uploading evasi0n App

The device will reboot three times -- first to inject the jailbreak, next after executing the evasi0n7 application and lastly after Cydia upacks.

Rebooting Device

All these take less than 30minutes to execute.

Lastly, restore your phone's latest backup after the jailbreak. Enjoy.

ERROR: This Host or Cluster is not Valid Selection

Title of this article is an error message encountered whenever a template gets converted back or deployed to a Virtual Machine. This is on the VMware side of things, of course. Deploying templates is the fastest way to commission a virtual machine for whatever purpose it may serve. Compared to the conventional way of deploying bare-metal machines which could take hours, virtual machine templates can deploy in a matter of minutes, sometimes seconds on top tier hardware. However, depending on how the templates got built out, you will soon discover they may not deploy back as virtual machines.

One of those situations is described by the error on this article. Whenever you deploy or convert a template back to virtual machine, the error ""This Host or Cluster is not Valid Selection" is encountered. The error in itself doesn't really give you a clue what mechanism is involved which caused it. In the VMware world, you will be getting this screenshot.

Error Message

This error is actually caused by a missing resource on the host server. It could be an ISO on a datastore that was used by the virtual machine prior to its conversion to a template. This is more often the likely cause of the error. I used to throw the template away since I didn't know what else to do. But as you will soon see, that goes back to the conventional way of deploying bare-metal machines. The advantage of using templates on the virtual world is defeated.

(DISCLAIMER: Read and understand the procedure first prior to execution. I will not be responsible for the outcome of your actions.)

First, remove the template from inventory. Just remove from inventory, do not remove from disk. Otherwise, the template could no longer be imported back to the virtual infrastructure.

Then, open a terminal session to the ESXi host and look for the files related to the template. This is where a backdoor to the ESXi host comes in really handy.

Locate the datastore where the template is stored. The virtual machine template files are usually stored in a directory under the same name as the original virtual machine prior to conversion. The file with extension .vmtx is the file you are after. Do a listing of the contents of the directory and if you see a file with .vmtx on the filename, then you are on the right track.

Use an editor to view and edit this .vmtx template file. For brevity, I downloaded the .vmtx file to my notebook and opened it on notepad. The screenshot is below:

Edit Template File

The lines to remove are related to the virtual CD-ROM (resource ide1:0, as shown in the picture). Create a backup of the .vmtx file. Remove the three lines with ide1:0 from the .vmtx file. Then, import the template back to the virtual infrastructure. In the VMware lingo, this action is to "Add to Inventory".

If this procedure is done right, Virtual Machines could be deployed from the template without the earlier errors encountered. This was what I did and the templates I have are again usable.