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 (somefile.zip), then run…

split -b 10m somefile.zip someprefix-

That will take somefile.zip, 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 ... > somefile.zip

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 (192.168.130.103).

On ESXi, I removed the old send targets and entered the new IPs (192.168.130.101 & 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.

Copy Files To Your iPhone

Andy Ihnatko has a review of the Air Sharing iPhone app at the My Digital Life Podcast & Blog.

Of particular interest to me… Andy says:

“Music and video are both formats that the iPhone OS can simply view outside of the iPod app. If I just copy it into my Air Share, I can play it with just a tap. I often put whole albums on the iPhone, if I don’t yet know if I want to throw them into my big iTunes soup. That’s a particularly big plus when it’s a 700 meg movie file and I don’t know if I want to burn up that much space on my notebook’s little hard drive by actually importing it into iTunes.”

Only $4.99. Go read the review… good stuff.

Jawbone Charger Can Destroy Your Jawbone Headset

The original Jawbone headset by Aliph provides excellent noise reduction.

However, the unit has a design flaw; the charger fits too tight around the back of the unit. In fact, as I recently found out, it is SO tight that it can easily destroy the headset when removing it.

When I contacted Aliph customer service, they were cordial, but unwilling to help since I couldn’t find my receipt.

After some additional research, I found a video tutorial showing the best way to remove the charger. Apparently, this is known issue.

It’s really lame of Aliph to not stand behind their product. I definitely WILL NOT be buying my replacement headset from them.

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.

Solution

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

Your Linux Boot Disk Full?

While trying to run a YUM update on a CentOS server today, I got an error message about my /boot partition being full. I ran a df -h and sure enough, there was only 100k left. (My standard install uses 100MB for the boot partition.)

Here’s what I did to fix it.

rpm -q kernel

That returns a list of installed kernel updates. In my case I had more than 25…

kernel-2.6.9-22.EL
kernel-2.6.9-42.0.8.EL
kernel-2.6.9-42.0.8.plus.c4
kernel-2.6.9-42.0.10.plus.c4

kernel-2.6.9-67.plus.c4
kernel-2.6.9-67.0.1.EL
kernel-2.6.9-67.0.1.EL.plus.c4
kernel-2.6.9-67.0.4.plus.c4
kernel-2.6.9-67.0.7.plus.c4
kernel-2.6.9-67.0.15.plus.c4
kernel-2.6.9-67.0.20.EL

To remove some of the older ones, run:

yum remove kernel-2.6.9-42.0.10.plus.c4

or to get several at one time:

yum remove kernel-2.6.9-42.*

I recommend leaving a few of the older ones in case you need to revert one day.

Speed Up Mail.app

Mail.app seems to get slower and slower. Plus it crashes at least once a week. As I started looking around the web to find a solution I ran across this post from Tim Gaden at his blog: http://www.hawkwings.net/2007/03/01/a-faster-way-to-speed-up-mailapp/

He describes this solution:

Open Terminal, then run these three commands:

ls -lah ~/Library/Mail/Envelope\ Index
sqlite3 ~/Library/Mail/Envelope\ Index vacuum
ls -lah ~/Library/Mail/Envelope\ Index

I’ve just ran it myself and it only dropped the size of my index from 73MB to 60MB, but it DID speed up Mail considerably. I’ll have to wait and see if it helps the crashing.

Using Linux Tail to Trim Your Files

This tip is for my friend Scarb. For years I’ve used the Linux command “tail -f” for watching logs… but only recently did I discover its versatility for extracting parts of files.

Need to grab only the last 25 lines of a file?

tail -n 25 somefile.txt

How about the last 200000 bytes redirected to another file?

tail -c 200000 somefile.txt > newfile.txt