It's been a long time since ntfs-3g has been the de facto NTFS driver option for leading Linux distributions. This allows for very convenient interoperability with a variety of external storage media with great capacities, like external hard disk drives. One of the problems I faced during the last year of using it, is that when I used KDE's automount feature (actually, the media:/ kioslave) I got boxes in the filenames instead of Greek or other national characters. The solution turned out to be simple in concept, yet obscure in application.

The first thing gone unnoticed with KDE is that the media:/ kioslave - which is responsible for automatically mounting external storage devices among other things - uses the HAL subsystem to get information on attached devices and mount removable storage, like USB sticks and external hard drives. As of HAL 0.5.0 and later, the desktop environment in use is responsible for informing HAL on the required mount options of each device.

While GNOME is very good at defining and passing mount options to HAL, KDE's way of doing so is obscure and problematic. Even though you can right-click on an unmounted device and change the mount options, it turns out that for NTFS-3g the most internationalization critical option, locale, can not be defined! Stumped by this stupid limitation, I tried working my way to a solution.

The only solution which worked for me is a hack and, as such, might be deactivated/overwritten on the next ntfs-3g package update. Besides that, it really works! All of the following must be executed as root!

Overview: a wrapping script will be created, forcing the locale. The mount command will automatically use

First, create a wrapping script to mount ntfs-3g filesystems. Create the file /sbin/mount.ntfs-3g.sh with the following contents:

#!/bin/bash
ntfs-3g "$@" -o locale=el_GR.UTF-8

Of course, substitute el_GR.UTF-8 with your country's locale! Afterwards, make it executable by typing (as root):

chmod +x /sbin/mount.ntfs-3g.sh

Now, let us backup the original /sbin/mount.ntfs-3g:

mv /sbin/mount.ntfs-3g /sbin/mount.ntfs-3g.original

Finally, let's point the mount helper to the mount wrapper script we created:

ln -s /sbin/mount.ntfs-3g.sh
	/sbin/mount.ntfs-3g

That's all there is to it! You can now plug in your NTFS formatted external storage device and KDE will recognize it, mount it and have no problem with national characters any more!

No comments