Thursday, September 27, 2012

Ubuntu PDF merge one liner

These are always the best

$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output_file.pdf  `ls -x *pdf | sort`

The ls -x incantation ensures everything is on one line to be feed to gs. This really handy when scanning multipage documents so if it jams along the way your entire pdf isn't lost.

Friday, August 10, 2012

Getting Started with Hand Loading

So my first kit is on the way, after about a week of research I settled on something so simple, I didn't think it existed. Hand Loading.

http://leeprecision.com/lee-loader-38-spl.html

All you need is a rubber mallet and the supplies: powder and slugs.

The die set itself costs $26 from midwayusa, a box of 50 38S new runs about $21 here. Initial estimates put the reloading costs at about $10/50, probably cheaper if I use lead rounds. I also purchased associated hand tools for case prepping and a Lee manual. Overall, including shipping the cost to date is $78.

It's about as dirty as cleaning a gun, if not less and I can do it anywhere. Still being an apartment dweller space is a premium.

In the meanwhile I'll get lots of experience with something before I go spend a couple hundred bucks on a fancy press and associated gadgets. Even gathering brass will be easy as I can dump it straight from the gun into the brass bucket. Keep you posted, hope I don't burn my eyebrows off :)

Monday, August 6, 2012

Automating FC SAN failover using pexpect

The code is on github and is fairly straight forward. One of these days I'll figure out how to do this using SMI-S or other XML magic pixie dust. The Cisco MDS is a little obnoxious in that it requires you to entire config mode to toggle vsans. The switch is already configured for pubkey authentication. Here it is in action,

ppetraki@mark21:~/Sandbox/cisco-automation$ ./cisco_pexpect.py 
logging in...
logged in
entered config mode
enable both vsans, wait 30 secs
disable vsan 10, wait 60 secs
enable vsan 10
exit config mode
exit fc switch
terminated True
In a separate window I have 'watch -d multipath -ll' on the client and confirm during the 60 sec sleep that the path group did indeed go out of service and then return.
$ git clone git://github.com/ppetraki/cisco-fc-failover.git
and enjoy!

Wednesday, July 18, 2012

Determine Linux "sd" names for debugging

The way the Linux SD driver works is it reserves 16 minor 'slots' per block device, the first minor represents the whole disk, and the remaining 15 are reserved for partitions. Knowing this offset one can write a little python code to create an index table that aids debugging, mapping minor numbers back to block device names. This of course presumes that names are being recycled.


# python -c "print zip(range(0,443,16), map(chr, range(97, 123)))" [(0, 'a'), (16, 'b'), (32, 'c'), (48, 'd'), (64, 'e'), (80, 'f'), (96, 'g'), (112, 'h'), (128, 'i'), (144, 'j'), (160, 'k'), (176, 'l'), (192, 'm'), (208, 'n'), (224, 'o'), (240, 'p'), (256, 'q'), (272, 'r'), (288, 's'), (304, 't'), (320, 'u'), (336, 'v'), (352, 'w'), (368, 'x'), (384, 'y'), (400, 'z')]
So sdb would be 8,16 and sdm would be 8,192, sdm1 is 8,193. Now the next time you see something awful like this:
Jul 10 15:08:25 | checker failed path 8:144 in map mpath2 Jul 10 15:08:25 | libdevmapper: ioctl/libdm-iface.c(1740): dm message mpath2 NF fail_path 8:144 [16384]
You can say with confidence that this is device sdj.

Monday, February 27, 2012

A frantic plea for help right on my doorstep

It was Saturday morning, 2/25, around 10 AM. I had been awake for about an hour now, had my morning coffee and was going through the motions of beginning my weekend, relaxing, no real plan but to fix my car later. Still in my sweatpants, I heard a frantic knocking on my apartment door, a woman yelling for help. Not knowing what to expect I ran to the closet and grabbed my pistol, put it behind my back and under my sweater, and opened the door. To my right was an Indian woman, frantic and in tears, telling me that her husband was hurting her. The husband there just behind her, stammering that there wasn't a problem. I asked the woman if she would like to come in and call the police, she agreed and I let her in my home, I then closed and locked the door.

I never said a word to the man though from the look on his face, I could tell that he understood that I was taking this seriously. Perhaps  it was the awkward way I had opened the door, with my left hand since my right was behind my back. I never said a word to anyone that I was armed, it was clear that I was prepared. The man continued to knock on my door for some time, then it stopped, that's when I knew the police had arrived.

It had taken them about 7-10 mins to arrive at my apartment, the woman now in my home is my neighbor from directly across the hall.

I didn't ask for this, I wasn't looking for trouble, I was sitting in my home and reading my email when this event came to my doorstep. Later after reflecting upon these events, it occurred to me what it is that truly makes a neighborhood "safe". It's not the average income, the distance to the nearest police station, how nice the houses are, or the cars in your driveway. It's whether your neighbor is willing to stand up for himself and the people around him.

Monday, September 20, 2010

Introducing the Disk Puller

A cheap and effective way to hotplug disks automatically that I pioneered at Stratus while working on internal storage.

The basic idea is instead of letting the backplane or computer power  the drive, we do instead with our external power supply. According  to the storage controller's firmware, phy down == hotplug removed, which can be achieved by removing power to the target. This is 100% authentic and equal to walking up to a system and pulling/reinserting the disk by hand.

Parts list:
Great way to beat on MD, LVM, and the twisty maze that is the removal  path of the SCSI mid-layer.

It's pretty inexpensive, with a nice managed PDU and all the parts to automate 1 disk amounts to $80 per port. You can use the PDU for  other neat things too like say inserting and removing an external
USB hub, and it's connected peripherals, by controlling it's power source.

The equivalent functionality as part of an actual SAS/SATA target  emulator could cost you between 15-20K. The vendor whom I have the most experience with this product, who will remain nameless out of respect; required an exceptional amount of upkeep and would break for seemingly no reason at all. Instead of purchasing additional target emulators for fault injection, we instead installed disk pullers
everywhere for a fraction of the cost and with virtually no maintenance.