LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-30-2007, 12:34 AM   #1
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
PNY Pen drive didn't work


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.

Last edited by jiml8; 06-30-2007 at 12:36 AM.
 
Old 07-01-2007, 07:55 PM   #2
xpromisex
Member
 
Registered: Apr 2004
Location: Statesboro, GA
Distribution: Arch Linux 2007.05 "Duke" (Kernel 2.6.21)
Posts: 447

Rep: Reputation: 30
you know - I really hate to ask this, as it seems really obvious to me but:

Could you have tried simply reformatting the drive from linux as fat32? May have solved the issue.
 
Old 07-02-2007, 10:34 AM   #3
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Original Poster
Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by xpromisex
you know - I really hate to ask this, as it seems really obvious to me but:

Could you have tried simply reformatting the drive from linux as fat32? May have solved the issue.
Why should that be necessary, and why would that work?

Quite obviously, there was some system misconfiguration that prevented proper mount when it was plugged in; when I explicitly specified a mount for it, it got mounted.

Also, pen drives are commonly used to move stuff from system to system. For this purpose, the most universal filesystem is the best one, and that is FAT16.

I purchased the thing specifically to carry with me when I go to a client's location. I don't know what kind of system I'll be plugging into, and I don't want to have to say; "Oh, well your system doesn't support the filesystem this pen drive has on it...". I do still see Win98 systems.
 
Old 07-02-2007, 06:12 PM   #4
xpromisex
Member
 
Registered: Apr 2004
Location: Statesboro, GA
Distribution: Arch Linux 2007.05 "Duke" (Kernel 2.6.21)
Posts: 447

Rep: Reputation: 30
I asked the question because I have seen at least two different systems that didn't recognize a Windows created FAT partition. This was solved, in my case, by reformatting the drive in question and allowing Parted(or fdisk) to create a FAT32 partition.

I only assumed that you'd want FAT32 because, in my experience, that's been more universal. I also didn't even think about FAT16 for a flash drive, but now that I think about it - it's a fine idea (at least until you get to the higher storage amounts, like the new 8Gb ones.)

I'm sorry if I came off wrong, I was simply attempting to help remedy the situation (although admittedly the situation was already remedied.)
 
Old 07-05-2007, 01:57 PM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Original Poster
Rep: Reputation: 116Reputation: 116
Sorry...upon re-reading my previous message I seem to have been displaying a bit of annoyance.

Well, I am (was) annoyed, but not at you.

It didn't occur to me to reformat using Linux to generate a FAT partition. If that works, then there is still a bug. FAT, after all, is a Microsoft file system so non-Microsoft systems that use it should expect to conform to the Microsoft standard. Since WinXP could read it immediately then it defacto was not defective at time of purchase; it was formatted correctly.

Actually, I practically never use FAT anymore. This is the only FAT device I have around anyplace these days. I have ext2 installed on my Windows machines so that is what I use for all my in-house stuff. I only need to keep this pendrive FAT so I can use it on clients' machines.
 
Old 07-13-2007, 02:01 PM   #6
ianalis
LQ Newbie
 
Registered: Mar 2006
Location: Philippines
Distribution: Mandriva 2007.1
Posts: 2

Rep: Reputation: 0
You can also disable the Flushed I/O mount option of the drive. In KDE, go to devices:/ and open the properties of your (connected) drive. Select Mounting and uncheck Flushed IO then try mounting again
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Pen Drive / Flash Drive Unmounted but the power is there teluguswan Linux - Hardware 11 10-04-2008 03:36 PM
USB flash drive (Pen drive) mounts read only prabhatsoni Linux - Hardware 24 07-02-2007 01:28 PM
Nvidia PNY fx5500 wont work on SuSe 10.0 freezes on boot cormack SUSE / openSUSE 0 10-21-2005 07:58 AM
Nvidia PNY fx5500 wont work on SuSe 10.0 freezes on boot cormack Linux - Newbie 2 10-18-2005 05:58 PM
USB pen drive won't work anerren Linux - Newbie 7 03-03-2005 12:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration