Archive for November, 2007

LCOD 11.14.07 – Quick RAID check script for cron

This is a quick script that will let you run the new raid checks, or repair, or pause a running raid check. It doesn’t do e-mails or anything, and from what I read on this thread it’s something mdadm needs to be set to watch for. I ran the check on a RAID and received no output, so I guess it was ok?

I will update the script as I find out more. I’d like to add a simple escalation from check to rebuild? (I think it does this anyways), and an e-mail status report, or even a syslog call saying I ran all things look good.


#!/bin/bash
###############
# Quick script to use raid functionality
# Author : Jon Zobrist < jon@bluesun.netThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it >
# http://www.bluesun.net/
# License : LGPL
# Version : 1.0
# Date : 11.14.07
# install/notes:
# put it somewhere, /root/bin/ is where I prefer
# put this in your root crontab to run from cron monthly
# @monthly /root/bin/checkraids check > /root/logs/cron.log 2>&1
###############

case "$1" in
check)
for raid in /sys/block/md*/md/sync_action
do
echo check > $raid
done
;;

repair)
for raid in /sys/block/md*/md/sync_action
do
echo repair > $raid
done
;;

pause)
for raid in /sys/block/md*/md/sync_action
do
echo idle > $raid
done
;;

status)
for raid in /sys/block/md*/md/sync_action
do
echo "******************************"
echo $raid `cat $raid`
echo ""
done
;;

*)
echo "Usage : $0 check|repair|pause|status"
;;
esac

, , , , , ,

No Comments

LCOD – 11.9.07 – hald / wtf / .hal-mtab-lock

This isn’t really a Linux Command of the Day, and I’m not sure it really qualifies as a Linux tip…

I run Ubuntu desktop and really like it. At first I hated the auto plugin USB crap a lot of the
desktop distros were pushing, but once I started using it, and realized it actually worked
better than anything like it in the Windows world, and different but as good as the OS X world.

So, fast forward a year or so. All the sudden, certian devices won’t detect when I plug them in.
They *used* to work fine! All of the sudden they’re not auto-plugging or showing up in my nice GUI Nautilus interface.

I did a little looking around and noticed in /media there were 2 files, one was .hal-mtab, and one was .hal-mtab-lock.

The .hal-mtab looked like an mtab (tracks mounted file systems) file, and it had several devices of mine that had ceased to function properly. The .hal-mtab-lock file was weeks old.

I deleted the lines from the .hal-mtab, and deleted the .hal-mtab-lock file, rebooted and was good to go. Now my devices are working again.

I don’t know exactly what happened to cause this mess up, but my guess is something like the power went out and the devices were plugged in, or I unplugged and replugged them too many times in a row.

No Comments

Easy AdSense by Unreal