Unix tools for the SVC and Storwize masses: a 12 year journey

So it turns out the only thing harder than writing blog posts is keeping up with other people’s blog posts  (actually it’s easy to write blog posts….  it’s just hard to write good and useful ones).   So when I ranted last week about the lack of Unix tools in the SVC/Storwize rbash shell, it turns out I had missed the memo…  they have finally arrived!    Barry Whyte revealed all here:


It has been an interesting journey to watch the SVC code base mature and expand its horizons as it has gone from a straight storage virtualization platform to a storage controller platform as well.   In the process the effective user base for this platform has increased dramatically, I suspect well in excess of 10x fold.    And with that increase comes much more pressure on usability.     In the CLI space, the first big thing to change was that IBM dropped the requirement to use private/public keys to login to the CLI shell.   The fact of the matter is that many storage admins are not UNIX experts…  they don’t use PuTTY in their daily lives and running PuttyGen to generate keys felt positively strange to them.   They just wanted to type a username and password and be logged in….  and that is precisely what they got.

The need to preface info and task types commands with svcinfo and svctask also went by the wayside, which made things simpler as well (although I usually leave them in sample scripts for the ultimate backwards compatibility).

But in the opposite direction was the restricted bash shell that the CLI user gets to live in. Unix users (particularly those power users who know how to bash out a complex awk command in 40 keystrokes), were all a little stunned that they had to run all the cool commands outside the SSH command.    Telling them it has been that way for 12 years didn’t make them feel any better.

So with the 7.5 release (which is still fairly steaming new), you get 11 Unix shell commands that are all very very sweet:


So for a simple example, if I want to grab just the VDisk IDs for all VDisks I would normally use a command like this one:   lsvdisk -delim , -nohdr | cut -d”,” -f1

Run on a pre 7.5 machine I get:

IBM_Storwize:anthonyv>  lsvdisk -delim , -nohdr | cut -d"," -f1
rbash: grep: command not found

On a 7.5 machine I get:

IBM_Storwize:anthonyv>lsvdisk -delim , -nohdr | cut -d"," -f1

What’s nice is that a Windows admin firing commands with plink can now get unix commands run on the remote side with just a Windows plink command on the local side.

My only complaint is lack of floating point support.   Bash by default does not handle floating point.   To prove this, here is an amusing example where we get bash to perform some division:

IBM_Storwize:anthonyv>echo "4 divided by 2 equals $(( 4/2 ))"
4 divided by 2 equals 2

IBM_Storwize:anthonyv>echo "2 divided by 4 equals $(( 2/4 ))"
2 divided by 4 equals 0

I normally use awk to handle floating point calculations, so if you were to sum the size in bytes of a number of MDisks and then divide by 1024 to get GiB you may want to get a result to say three decimal places, but with bash built ins and the tools so far exposed to the rbash user, you cannot do this.  The bc command can also handle floating point, so next time you see your IBM rep, say ‘nice try but you missed floating point’.

Let me know what they say.    #;-)


About Anthony Vandewerdt

I am an IT Professional who lives and works in Melbourne Australia. This blog is totally my own work. It does not represent the views of any corporation. Constructive and useful comments are very very welcome.
This entry was posted in IBM, IBM Storage, Storwize V3700, Storwize V7000, SVC. Bookmark the permalink.

One Response to Unix tools for the SVC and Storwize masses: a 12 year journey

  1. Chris H says:

    It’s been a couple years since I had the pleasure of using SVC, and one of the things I loved about it the best was the rbash command line. While many storage appliances had some sort of hideous, limited CLI, giving us rbash access in the SVC was wonderful, especially to a guy who’s been coding in shell since the early 90s. Great to see that they’ve finally added some basic commands, but few folks realize how incredibly powerful shell can be, even without those. I had functions that I could load which emulated most of the commands that they’ve finally added. For instance – I was able to do your cut example like so:

    lsvdisk -delim , -nohdr | while IFS=, read a b; do echo $a; done

    Even the lack of floating point match can be faked around in some situations. Need three decimal points in your output?

    out=$((x*1000/y)); l=${#x}; echo ${x:0:$((l-3))}.${x:0-3}

    (this isn’t perfect, if you get a result under 1.0 that code won’t work so well – but gives an idea of what can be done.

    I had a bunch of examples on my wiki a couple years back, but my favorite was from Dan Rumney (who was with IBM at the time) — after I showed him the things that you could do with the rbash shell, he wrote a pretty hefty function which gathered data and outputted it in a format that could be turned into an Excel pivot table. Pretty amazing stuff.

    The biggest thing that was missing – and I see still hasn’t been addressed – is the “sleep” command. For something so basic, I was pretty shocked to find out that it wasn’t a shell builtin. Without having that, it wasn’t possible to issue a command and then enter a loop which checks the status of the command, moving on after it completed. Well – you could just issue the check without the sleep, but then you run the possibility of hammering on the SVC node, which isn’t polite.

    Mind you, floating point math and sleep as a shell builtin are available in ksh93, and it’s got a restricted mode… ^_^

    I resurrected one of my old Wiki pages and posted it on my blog:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s