Get desktop notification for filesystem usage

Here is a little un-intrusive script that will alert you whenever your filesystem is going above a certain percentage threshold.
This was tested under opensuse 12.3, but should really work on any linux running KDE (or at least having the kdialog binary installed).

You can save it under your user’s bin directory, for example /home/fblaise/bin/ in my case.

[sourcecode language=’bash’]

# Fred Blaise
# Cron this script in order to receive passive alerts about filesystem getting full.
# Set PCT_THRESHOLD to your liking

export DISPLAY=:0

ALERT_TITLE=”WARNING: Filesystem almost full”

df -h |grep ^/dev |awk {‘print $1,$5,$6′} |
while read devfs pctused mntpoint; do
if [[ “${pctnum}” -ge “${PCT_THRESHOLD}” ]]; then
kdialog –title “${ALERT_TITLE}” –passivepopup “${devfs} mounted on ${mntpoint} is at ${pctused}.”

Don’t forget to make this shell script executable.

We could then imagine a crontab looking like this, for checking every 10 minutes:

[sourcecode language=’bash’]-*/10 * * * * fblaise /home/fblaise/bin/[/sourcecode]

Whenever one of your filesystem crosses the threshold, a passive box will be displayed. I have my bar on the right side of the screen, and the result is the following:


It is a very basic script. One could add support for choosing what FS types should be monitored, how often to receive notifications. If you do make this better, please share!

Install NetApp onCommand on Linux 64bits

Linux users wanting to use the NetApp onCommand tool on 64bits are granted with the fact that it is not possible to do so.
Since it is a java application, here is a simple workaround that worked for me (opensuse 12.1 64bits – sun’s java).

– Download the linux rpm package.
– Install rpmrebuild
– Launch the following command:
[sourcecode language=’bash’]rpmrebuild -e -p sysmgr-setup-2-0R1-linux.rpm[/sourcecode]

– Edit around l.3726, comment out the line that says exit, something like:
[sourcecode language=’bash’]
echo “ERROR: NetApp OnCommand System Manager 2.0 is not supported on 64-bit Linux”
echo “OVERRIDING !!”
#exit 1;

– Continue and install the rpm.

Go to /opt/NetApp/on_command_system_manager_2.0. If running KDE, start typing ‘netapp’ in your krunner. You should also find it in your menu.

or launch: [sourcecode language=’bash’]java -jar SystemManager.jar[/sourcecode]

DLNA server with Linux

uShare does a great a simple job in quickly setting up a dlna server under Linux.

Under opensuse 12.1:

Update: ushare is available via

Edit the /etc/ushare.conf file, at least these 2 options:

[sourcecode language=’bash’]

Then, you can try with an dlna application and you should see a ‘uShare’ share that you can browse and play movies from!

Configure Linux for your OSX Time Machine needs

Have a Linux around with some free storage space, and you want to backup your Mac? You can configure your Linux box to just appear in your Mac OSX Time Machine configuration.

I am using Opensuse 12.1 (64bits) here, and the setup is nearly done. Here are just the few extra steps you need to take in order for your Mac to see your storage space and use it as backup. Note that I have done no effort whatsoever to secure the configuration as of now. It functions, but you may want to take it the extra step for added security. This is just a basic setup.

First, let’s tell avahi that you want to advertise a new service. Create a new file, called afpovertcp.service in /etc/avahi/services:

[sourcecode language=’xml’]


_afpovertcp._tcp 548

_device-info._tcp 548 model=PowerMac3,5


Install the netatalk package, and go configure the afpd.conf file. Go to the end of this file, and uncomment the default line. I had to pass it my actual IP address, because it was not advertising on the right one.

[sourcecode language=’bash’]# default:
– -tcp -ipaddr -noddp -uamlist, -nosavepassword

The rest of this file is commented on my box.

Then, go edit the AppleVolumes.default file in that same folder. At the end, I simply added the path where I wanted my Time Machine backups to go:

[sourcecode language=’bash’]/home/fblaise/mnt/WD15/time_machine “tm_backups” options:tm,ea:auto volcharset:UTF8[/sourcecode]

At this point, you can start your netatalk service:

[sourcecode language=’bash’]service netatalk start[/sourcecode]

(Edit /etc/init.d/netatalk at l.71. The -n switch takes mandatory parameters apparently, but we’re not using the atalk stuff)
[sourcecode language=’bash’]
if [ x”${AFPD_RUN}” = x”yes” -a -x /usr/sbin/afpd ] ; then
echo -n ” Starting afpd (”
echo -n ${AFPD_UAMLIST} -g ${AFPD_GUEST}
echo -n “)”
startproc /usr/sbin/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST}
rc_status -v

or just start the afpd daemon with no option, just by typing [sourcecode language=’bash’]afpd[/sourcecode] as root in a terminal.

You may want to reload the avahi configuration as well with [sourcecode language=’bash’]avahi-daemon -r[/sourcecode]

Then, go to your Time Machine preferences, and your Linux box should now show up as an option with the path defined above!

btrfs consuming lots of sys cpu time

fblaise@snowball ~ $ ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
7.4 2591 root [flush-btrfs-1]
5.9 905 root [btrfs-endio-0]
4.4 2907 root [btrfs-endio-wri]
4.3 1314 root /usr/bin/X :0 vt7 -nr -nolisten tcp -auth /var/run/xauth/A:0-VjxI1a
2.7 900 root [btrfs-worker-0]
1.7 2106 fblaise /usr/bin/knotify4
1.4 2094 fblaise kwin
0.6 10 root [kworker/0:1]
0.5 3643 fblaise top

And it is only on my /home filesystem… system is currently sitting idle. Wow.

This is on a Linux Mint laptop with 3.0.0-13-generic-pae.

Anyone experienced this?