I purchased a 1 gig PNY "mini attache" pen drive today for $20 which seemed like a decent price.
Brought it home and plugged it into my laptop, booted into WinXP. WinXP saw it without issue. I established that it was formatted in FAT.
I then plugged it into my Mandriva workstation. Blooey! It didn't mount. I got an error message from mount about invalid options or missing superblock or no filesystem (you've probably seen it).
So, I went ahead and set up some stuff in udev to make it work. After I had it working on my Mandriva system, I then rebooted my laptop into Kubuntu and plugged it in there.
Nope! Kded hung; no mount. So I promptly copied my udev rules over to the kubuntu box from the mandriva box, and voila! It works.
Now, it beats the hell out of me why I can't just plug a pen drive in and have it work, but I can't.
So, for the benefit of anyone reading this who might benefit from it, here is how I made it work.
In the directory /etc/udev/rules.d, I created a rule that I called 45-flashmemory.rules.
The contents of that file are here:
Code:
SUBSYSTEMS=="usb", SYSFS{product}=="USB Flash Memory", KERNEL=="sd?1", NAME="%k", MODE="0666", SYMLINK+="flashmem%n", RUN+="/etc/udev/scripts/penmount.sh flashmem%n pendrive%n"
This rule specifies a script to run, named penmount.sh and located in the directory /etc/udev/scripts. If this directory does not exist on your system, create it.
Here are the contents:
Code:
#!bin/bash
if [ "$ACTION" == "add" ]; then
mkdir /media/"$2"
mount -t vfat -o rw,user,auto,umask=0 /dev/"$1" /media/"$2"
chmod 777 /media/"$2"
else
umount /media/"$2"
rmdir /media/"$2"
fi
Once you have these two files installed, your PNY pendrive will be seen without issue.
Now, on my Mandriva system it turns out that the rule is not being run when the device is removed. Hence, this device (and my camera) are not being automatically unmounted, and I have had to write a script that I run as a cron to automatically scan the mountlist and unmount removed devices. This runs once a minute.
On my kubuntu system, the rule does seem to be running on removal (or something is running) and it is unmounting the device. But it is not deleting the directory in /media the way it is supposed to.
In any case, these two scripts seem to make this pendrive work OK. It really ought to be easier than this, but it isn't.