Grep Through Files Recursively

Need to find a string nestled somewhere in a ton of subdirectories? First cd to the lowest common denominator, then run:

grep -lir “something” *

Create Multipart Zip Files In Linux

Need to transfer a really large file but are worried that it will fail before completing?

Create a multi-part file using the split command, then join it on the remote server after it transfers. Example: Start with a zipped file (, then run…

split -b 10m someprefix-

That will take, chop it into 10MB pieces and name them “someprefix-aa, someprefix-ab, etc.” Run “man split” for all the options:

split -b number[ k|m ] [-a suffixlength] [filename [prefix] ]

If your file will be split into more than 52 pieces, you’ll need to change the number of suffix length. The default is 2 (a-z, twice).

After transferring the pieces to the remote server, re-assemble them with cat…

cat someprefix-aa someprefix-ab ... >

ESXi & MD3000i: No LUNs after adding VMkernel switch for iSCSI

Having problems getting iSCSI LUNs to appear in ESXi after enabling a second VMkernel switch on a separate subnet? Make sure you disable/re-enable the ESXi iSCSI Initiator AFTER adding the new vSwitch on the isolated network. I think iSCSI discovery only occurs on the Vswitches enabled at the time the initiator is enabled. Here is my scenario:

I recently setup an MD3000i SAN to connect to our VMware ESXi hosts via iSCSI on our internal LAN. My test server only has two NICs, but I only enabled eth0 with an IP of and left eth1 unused. I enabled iSCSI on the host, set send targets, config’d host access, created host-to-virt disk map, etc. and rescanned HBA. The test worked fine. After scan completed, I was able to see the LUNs in ESXi.

Next, I wanted to enable eth1 and move the iSCSI traffic off to dedicated, isolated, switches.

So I physically moved the MD iSCSI cables to 2 standalone switches, edited the MD Host Ports, setting them back to the defaults (192.168.130.x & 131.x). I left the two MD management ports in the LAN.

I enabled ESXi eth1 as VMkernel and set to IP in same range as one of the segments (

On ESXi, I removed the old send targets and entered the new IPs ( & 102).

Rebooted everything for good measure. Rescanned HBA, but the LUNS did NOT show up in ESXi.

The solution? After enabling the VMKernel switch on the different subnet, disable ESXi iSCSI Initiator and reboot (maybe not needed, but I find ESXi likes a reboot for many things). When it returns (5+ minutes for mine), ENABLE the ESXi iSCSI Initiator and rescan HBA. I think iSCSI discovery only occurs on the Vswitches enabled at the time the initiator is enabled.

Starting Ensim Pro For Linux SSL Tunnel [FAILED]

At work, I was unable to access my Ensim control panel (on RHEL4); the browser kept timing out. So I thought I’d restart it to see if that would fix it. I did the usual:

/etc/init.d/epld restart

And got this error

Stopping Ensim Pro For Linux Control Panel [ OK ]
Stopping Ensim Pro For Linux SSL Tunnel [FAILED]
Starting Ensim Pro For Linux Control Panel [ OK ]
Starting Ensim Pro For Linux SSL Tunnel [FAILED]

I checked the log file and see this:

cat /usr/lib/ensim/frontend/httpd/logs/error_log

…No space left on device: mod_rewrite: could not create rewrite_log_lock

Problem Found

A quick google search told me it was a semaphore problem. So I ran the ipcs command to check my config:

ipcs -l

—— Semaphore Limits ——–
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

Then ran the ipcs command to see how many were semaphores were left:

service httpd stop
ipcs -s | grep apache | wc -l

It showed 110. Not 128, but maybe enough to cause problems. PLUS, it “should” be zero with apache stopped.


With apache and epld stopped, I ran this command

ipcs -s | grep apache | gawk ‘{ print $2 }’ | xargs -n 1 ipcrm sem

Then started apache/epld again. All is fine.

service httpd start
/etc/init.d/epld start