Posts Tagged ‘script’


Monday, July 14th, 2008

Linux works perfectly well with multiple storage links using dm-multipath. Not only that, but HP has released their own spawn of dm-multipath, which is optimized (or so claimed, but, anyhow, well configured) to work with EVA and MSA storage devices.

This is great, however, what do you do when mapping volume snapshots through dm-multipath? For each new snapshot, you enjoy a new WWID, which will remap to a new “mpath” name, or raw wwid (if “user_friendly_name” is not set). This can, and will set chaos to remote scripts. On each reboot, the new and shiny snapshot will aquire a new name, thus making scripting a hellish experience.

For the time being I have not tested ext3 labels. I suspect that using labels will fail, as the dm-multipath over layer device does not hide the under layered sd devices, and thus – the system might detect the same label more than once – once for each under layered device, and once for the dm-multipath over layer.

A solution which is both elegant and useful is to fixate the snapshots’ WWID through a small alteration to SSSU command. Append a string such as this to the snap create command:


Don’t use the numbers supplied here. “invent” your own 🙂

Mind you that you must use dashes, else the command will fail.

Doing so will allow you to always use the same WWID for the snapshots, and thus – save tons of hassle after system reboot when accessing snapshots through dm-multipath.

Linux inetd and shell input redirection

Friday, July 11th, 2008

I was required to write a small listener. This listener doesn’t have to do anything fancy – it has to process input from a network source (over TCP) and shove it into a file with random name.

The quick and dirty solution is to use netcat (nc). A short command such as this would do the trick easily:

nc -l -p 10025 > /tmp/file.$$

This, however, will not allow multiple sessions, and, netcat tends to close when the session ends, which will require me to hack some weird workaround. Not the best method.

Well, then, to inetd we aim. I have decided to aim at inetd and not the more modern xinetd, since the previous is somewhat quicker to setup, and above all, it doesn’t really matter. You are most invited to transform the line supplied here to any other supersever you like 🙂

The script is located inside /usr/local/bin and it is called tcp_script . It is a very simple script:

dd status=noxfer of=/tmp/out.$$

I have used ‘dd‘ because it worked well. I am sure other solutions are available as well.

inetd will redirect the standard input to the script, which will redirect it, in turn, to the file /tmp/out.$$

10025 stream tcp nowait root /usr/local/bin/tcp_script tcp_script

Reload (HUP, whatever) inetd, and you’re set.

A nice dial-up script

Tuesday, July 1st, 2008

It’s either me, or NetworkManager sux. This is the most incomplete and incompetent piece of software I have ever seen. The only reason I actually use it is that there is no better alternative which does whatever NetworkManager manages, somehow, to do.

My initial thought was to setup NetworkManager as the dial-up component. What should be more obvious than that? Well, it just won’t connect, and its logs are horrific at best. So back to gksudo script for us, then…

You can put this script in /usr/local/sbin/ and change its permissions to eXecutable (by root, of course), and then add a nice menu item called “Cellular Internet” in your Gnome Menu. It should run ‘gksudo /usr/local/sbin/

That’s all.

Sierra AirCard 880E on Ubuntu

Tuesday, July 1st, 2008

To get your newly purchased Sierra AirCard 880E on your Ubuntu Hardy, you should follow these simple steps:

  1. Make sure you have GCC on your computer: ‘sudo apt-get install gcc
  2. Make sure you have kernel sources installed on your computer: ‘sudo apt-get install linux-headers-2.6.24-19-generic
  3. Download the driver from Sierra Wireless site
  4. Extract and compile (‘make‘, ‘sudo make install‘)
  5. Add to /etc/modprobe.d/blacklist-modem the line: ‘blacklist ehci_hcd’
  6. Insert the device into the laptop. When everything is OK, you should see that a USB device is registered using ‘dmesg‘ shortly afterwards, or ‘lsusb
  7. Configure /etc/wvdial.conf using the attached config file wvdial.conf
  8. Add to /etc/ppp/peers the file wvdial

Done. To connect, you need to run ‘sudo wvdial &

I will add in the future a nice gksudo with a nice-looking connect/disconnect script

HP EVA bug – Snapshot removed through sssu is still there

Friday, May 2nd, 2008

This is an interesting bug I have encountered:

The output of an sssu command should look like this:



It still leaves the snapshot (SNAP_ORACLE in this case) visible, until the web interface is used to press on “Ok”.

This happened to me on HP EVA with HP StorageWorks Command View EVA 7.0 build 17.

When sequential delete command is given, it looks like this:


Error: Error cannot get object properties. [ Deletion completed]


When this command is given for a non-existing snapshot, it looks like this:


Error: Virtual DisksLinuxoracleSNAP_ORACLE not found

So I run the removal command twice (scripted) on an sssu session without “halt_on_errors”. This removes the snapshots correctly.