Welcome to BAFM#
This blog is a collection of thoughts, experiences, and technical insights from a sysadmin’s perspective. Here you’ll find posts about system administration, infrastructure challenges, troubleshooting adventures, and the occasional philosophical rambling about technology and its role in our daily work.
Whether you’re a fellow sysadmin looking for solutions, someone curious about the behind-the-scenes work that keeps systems running, or just stumbled upon this corner of the internet – welcome! Feel free to explore, and don’t hesitate to reach out if you have questions or want to share your own experiences.
Follow me through my journey through life with all it’s neat little tricks, caveats and side-quests.
Quick Links#
Last updated: January 2026
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
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
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
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
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…
...
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:
...
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
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) ...
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).
...
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.