diskinfo

Get a list of all disks and show the serial numbers 1 2 3 4 5 6 7 8 9 10 #!/bin/bash if [ ! -x /usr/sbin/hdparm ] ; then echo "Missing hdparm" exit 1 fi for disk in /dev/sd?; do echo "$disk: `hdparm -I $disk | grep "Serial Number:" | awk '{ print $3 }'`" done

July 27, 2014 · 1 min · 57 words · christian

idle3 wrapper

Another wrapper (like mdstat), that’ll look through my Western Digital disks and fix any disk not having the head parking timeout set to a configured value. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #!/bin/bash FIRMWARE_TIMEOUT_SH=138 if [ ! -x /usr/sbin/idle3ctl ] ; then echo "idle3-tools is missing." exit 1 fi for disk in /dev/sd?; do # idle time should be set to: 138 (300s) # 138-128=10 # 10x30=300 seconds FIRMWARE_TIMEOUT_IS="$( /usr/sbin/idle3ctl -g $disk | awk '{ print $5 }' )" if [ "$FIRMWARE_TIMEOUT_IS" -ne "$FIRMWARE_TIMEOUT_SH" ]; then /usr/sbin/idle3ctl -s$FIRMWARE_TIMEOUT_SH $disk fi done

July 27, 2014 · 1 min · 104 words · christian

mdstat

Well, I needed a way to watch the mdstat progress (because a disk just failed …). 1 2 3 #!/bin/bash watch -n1 cat /proc/mdstat

July 27, 2014 · 1 min · 24 words · christian

XBMC thumbnail generation

Well, I have a few movies and series that ain’t represented in TMDB/TVDB. So here’s a little script, that will parse over any video files, check if a thumb file is already present, and if not generate one using ffmpegthumbnailer… 1 2 3 4 5 6 7 8 #!/bin/bash find /srv/smb/tv/ -name "*.wmv" -o -name "*.avi" -o -name "*.mp4" \ -o -name "*.mkv" | while read file; do if [ ! -f "${file%.*}-thumb.jpg" ] ; then fmpegthumbnailer -i $file -o "${file%.*}-thumb.jpg" -s 0 &>/dev/null fi done

July 19, 2014 · 1 min · 86 words · christian

Linux NAS optimizations

Well, I recently had to flatten my archive NAS (well only the OS part … wheeeh). Since I didn’t have the chance to backup the old settings I had to do everything from scratch … And this time I decided, I wasn’t doing a script but rather the proper way. I spent a while reading through the Internetz about the various settings until I stumbled upon a Frauenhofer Wiki entry. From there I ended up writing those udev-rules and the sysctl configs… ...

July 9, 2014 · 4 min · 685 words · christian

SFdisk - Partition table for 2TB RAID-Disks

So, when I create (or add RAID disks) I have this handy sfdisk template (I created once when I first added the 2TB disks): 1 2 3 4 5 6 7 root:(charon.ka.heimdaheim.de) PWD:~ Wed Jul 09, 15:13:04 [0] > sfdisk -d /dev/sdj > ~/raid-disk-template.sf root:(charon.ka.heimdaheim.de) PWD:~ Wed Jul 09, 15:13:04 [0] > cat ~/raid-disk-template.sf # partition table of /dev/sdj unit: sectors /dev/sdj1 : start= 2048, size=3906793472, Id=da So, if I wanted to add more disks, I’d just have to run the following: ...

July 9, 2014 · 1 min · 100 words · christian

Nexus 5000: Configure CEST

Since I’m living and working in Germany, most of my hardware is using timezone configuration for CEST (or Europe/Berlin). This here is the simple configuration for our Nexus 5000’s: 1 2 3 4 5 conf t clock timezone CET 1 0 clock summer-time CEST 5 Sun Mar 02:00 5 Sun Oct 03:00 60 exit copy running-config startup-config

June 24, 2014 · 1 min · 57 words · christian

UCS 5108 power redundancy lost

Well, another day - another UCS error. Out of the blue, one of our chassis started displaying that one PSU had failed, however the UCS was showing no PSU had failed 🤷 Well, as it turns out - this is yet another known bug in 2.0.2(r). You’ll either have to unplug and plug all the power cables (that’s four) in a maintainance window - or simply change the Equipment Power Policy (found in the Root of your UCS, tab Policy) ...

June 22, 2014 · 1 min · 108 words · christian

sa-learn, dovecot virtual users and virtual user configs

Well, I wanted independent SpamAssassin Bayes databases per user (different users, different preferences). For that, RoundCube already set up the Junk folder. However, I wanted the ability (for myself, as well for my other users) to individually mark messages as either Spam or Ham. RoundCube: Inbox view Now, as I said before I wanted a trivial way to mark messages as Spam or Ham (without using the command line each time). ...

December 23, 2013 · 4 min · 746 words · christian

NetApp: Monitoring of SnapVault/SnapMirror/LUN/Snapshot information with Nagios

As I wrote before, we have a bunch of filers (and a ton of volumes w/ luns on them), that I need to monitor. At first, I tried the existing NetApp Nagios-Plugin(s), but they all use SNMP and with that I can either watch all volumes or none. And that didn’t satisfy me. Don’t get me wrong, the existing plugins are okay and I still use them for stuff (like GLOBALSTATUS or FAN/CPU/POWER) which isn’t present in the API or real hard to get at, however I wanted more. So I ended up looking at the NetApp API, and ended up writing a “short” plugin for Nagios using Perl. Maybe if I’m ever bored, I’ll rewrite it using C, but for now the Perl plugin has to suffice. So far the plugin supports the following things: Monitoring FlexVolumes (simply watching the free space) Monitoring LUN space (the allocated space inside a FlexVolume for iSCSI/FC LUNs) Monitoring Snapshot space (the allocated space inside a FlexVolume for Snapshots) Monitoring SnapVault relations (and their age) Monitoring SnapMirror relations (and their age) The plugin will return performance data for most (if not all) of those classes. It needs a user on the filer you wish to monitor - which sadly needs to have the admin role.

December 15, 2013 · 28 min · 5787 words · christian