Category Archives: Technology junk

I’m a SAN administrator. Stuff relating to system/network/storage administration goes here.

Backing up an IMAP Mailbox using imapsync

A client of mine uses GoDaddy’s unlimited IMAP service to host their E-mail. This has been in place since before Gmail was the obvious solution so don’t give me crap about that. The client in question has a pretty high turnover rate and some of the turnovered are higher profile individuals for whom we need to keep their E-mail in case it needs to be later referenced.

For a long time the solution was to just not delete their accounts. Eventually I felt we had too many dangling unreferenced accounts though and wanted to find a way to clean things up. I picked an employee that was unlikely to turnover and explained to her that some new folders were going to show up in her top-level mailbox on her account. No need for alarm, it’s just the archives of the old employees. Enter the 1-liner:

imapsync --host1 imap.secureserver.net --user1 oldemployee@mail.com --password1 supersecretpass --user2 remainingemployee@mail.com --password2 supersecretpass2 --host2 imap.secureserver.net --regextrans2 's#(.*)#user_ark/$1#' 2>&1

This uses a tool called imapsync which is a yum installable on RedHat like systems using EPEL. Obviously some values need to be substituted. The interesting thing that took some figuring out was the regular expression to put in so that the user’s E-mail all ended up in a sub-folder of the remaining user’s account. I discovered I couldn’t put a period within the “user_ark” part which disappointed me. The imapsync program doesn’t seem to behave very well with regards to RegExs, I just took it in stride and achieved what I was able to. Before actually running the command it should be tested with a “–dry” flag so that no changes are made, the output is useful to find out if anything bad or harmful will come of the operation, or if it will even be successful.

On your production system you may find that the server uses a different seperator and/or prefix. This will cause your RegEx to change somewhat. Imapsync is self-documented well when ran without arguments, it just doesn’t behave very well, so experiment with that “–dry” flag before mangling your users’ Inboxes.

XIV <--> VMware LUN ID mapping

I have to dig far too hard to find this information anytime I want it, so I’m putting it here. I just one-lined a CSV file in PowerCLI to list all of my attached LUNs across my entire VMware environment (only 1 vCenter  makes it easy). Each LUN “CanonicalName” that is attached to an XIV array starts with “eui.00173800″ regardless of which array the LUN actually lives on. There are 8 hex digits remaining, of them it appears that first 4 are used to identify the array and the last 4 used to identify the LUN serial number.

Verifying that succeeds. I can see that the serial number of the XIV for which I have the most LUNs presented on shows up as the 4 hex digits numbered 9-12 in the euis in my list.

The last 4 don’t jive up initially when I look at LUN serial numbers, but that’s because I chose the very first one to look at, which is 0000 for digits 13-16. It appears that ESXi must create some sort of dummy LUN 0 for each array, all the following arrays make sense. It’s also worth noting that my RDMs show up in this list.

So the final number looks like this:

[00000000][1111][2222]
[IBM-XIV!][ARSN][LUN#]

In the real world if I have a LUN Conanic eui.0017380035bc001d it’s referencing an XIV array S/N 13756 (35bc hex -> dec) and the LUN S/N 29 (001d hex -> dec).

Last note, if you need this reference you probably already are aware of this and even noticed it in the example above, but in VMware land we typically use hexadecimal to reference storage addresses, by default though XIV GUI lists everyting (including array S/N) in decimal. It all has to be converted. The LUN Serial Numbers can be done right in the GUI under Tools>Management, but you’ll have to convert array S/N either by hand or in your head if you can hex like a boss.

Puppet for Polo Shirters, but not really

At VMworld it occurred to me that system automation was absolutely the ticket and something every person should have on their resume – probably a year ago. Being a year behind and with plenty of flight time remaining on my trip as well as Labor Day weekend I thought a good way to get caught up would be the Kindle book Puppet 3 Beginner’s Guide by John Arundel.

My reasoning for choosing this book (over other related options) is because it’s based on the most current version of Puppet which matters to me as some of the features I’ll be using in my day to day depend on some newer features – namely AIX support. In addition to that I wanted something not overly complicated as it was unlikely that I’d be at a shell during most of the time that I’d be reading the book. I needed more of a primer than a reference so to speak.

I don’t mean to bash this book heavily, it does come with some benefit. If you have no clue how puppet does what it does then it’s a good place to start. I already had a good foundation of what puppet is and how it works, I was looking for something that would help make it work for me. It does a nice job covering manifests, modules, classes and templates.

The annoyance comes in the remainder of stuff in the book. There is a wealth of information about how to set up ssh key authentication on *NIX systems, modifying crontabs and configuring and using git. While some people who wish to use puppet may need these skills explained, I don’t. That’s fine, we could just say that this book isn’t for me and is more suited for the point & click crowd. The irony though is that it’s not suited for them either as it’s void of anything cross-platform.

One thing that I will have great need for in my puppet playground is an understanding of the best ways to make your manifests and modules usable cross-platform. I can figure it out with enough digging around online, but I was hoping to get a glimpse, or at least more of a glimpse than the book offers. Their are some implications about cross-platform usage in the logic section of the book, but I definitely think given the actual use-case of system automation that more examples and explanation are merited. Additionally, I don’t think there is even a single mention of differences between using the toolset on Windows as opposed to *NIX systems.

I think the book is well written and there is a reasonable amount of useful content. Sometimes in the days of digital books it’s hard to tell if you’re getting your money’s worth… in the past if the book seemed 20% useful, but weighed 27 pounds you could still feel like you got a bargain. I did digest enough useful information about puppet to make it seem like the Kindle-edition price I paid was fair, but I still feel like I bought more useless/redundant knowledge than useful information. Worse, I don’t know who a good audience for this book would be.