LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 12-08-2006, 08:01 AM   #1
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Rep: Reputation: 30
USB flash drive (Pen drive) mounts read only


Friends
This is driving me nuts.

I have FC5.

I have a USB flash drive of 512 MB.

When I insert this into a USB port, the drive is automatically mounted. But it mounts read only. I am not able to delete, copy, change permissions etc of any file on the disk.

It seems strange.

I have gone to the "Removable Drives and Media" in the preference menu, but nowhere any control is provided.

When I mount it by giving "mount -t vfat -o rw /dev/sdb1 /media/disk", it mounts. But again when I try to delete a file, It gives the error "read-only file system".


Surprisingly, in my home PC (with FC5) when I insert this drive I find that the I am able to delete, copy etc etc.


Any help friends ?

Also friends, can we format this flash drive ?

Thanks in advance

Prabhat Soni

Last edited by prabhatsoni; 12-08-2006 at 08:12 AM.
 
Old 12-08-2006, 09:16 AM   #2
dracolich
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 1,173

Rep: Reputation: 47
I use the options -o gid=100,umask=002 for mine. Others use -o users. Take your pick. Look in your /etc/fstab file for a line that pertains to the device and you can put these options in that line so they get used automatically.
 
Old 12-08-2006, 09:43 AM   #3
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by prabhatsoni
When I mount it by giving "mount -t vfat -o rw /dev/sdb1 /media/disk", it mounts. But again when I try to delete a file, It gives the error "read-only file system".
Give the mount command w/o any options a see whether it says it is mounted ro. If so, check /var/log/messages to see if there are any clues to why it got mounted ro.

You also might try (as root) giving the command

mount -o remount,rw /dev/dsb1

after you have already mounted it, and see if it will change over.

Quote:
Also friends, can we format this flash drive ?
My understanding is you can partition and format just like a hard drive. But you do so at your own risk. You might want to search the internet on this topic first. But normally, you just want to use the FAT filesystem that is alread there.

EDIT: You don't have you drive set to "write protect" do you?

Last edited by blackhole54; 12-08-2006 at 09:46 AM.
 
Old 12-09-2006, 01:47 AM   #4
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Original Poster
Rep: Reputation: 30
Thanks friends,

(1) I had already looked up the /etc/fstab and did not find any entry corresponding to this.

(2) I used follwing command to manually mount the drive:

Code:
mount -t vfat -o uid=500,gid=500,umask=033 /dev/sdb1 /media/disk
But it too resulted into the "read-only file system"

(3) Strangely I booted into my XP and tried to delete the files from there and found that I could not do it. Then I tried to format it from XP, and was successful.

Now I can copy the files into this drive.

Inexplicable !
Beats me !


Thanks anyway friends.


Prabhat Soni
 
Old 12-09-2006, 09:16 AM   #5
dracolich
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 1,173

Rep: Reputation: 47
One thought comes to my mind now. How many files and directories were on the root of the drive? I've experienced limits on these drives due to the FAT filesystem, especially when using long file names.
 
Old 12-09-2006, 12:11 PM   #6
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by dracolich
I've experienced limits on these drives due to the FAT filesystem, especially when using long file names.
My understanding is that FAT has a hard limit on the number of directory entries in the root directory (512?). And when you delete a file, the directory entry is not removed, it is just marked as deleted. So if you run out of room in your root directory, you are just out of luck.

I believe subdirectories don't have this limit, but like the root directory they don't remove deleted entries.
 
Old 03-20-2007, 01:16 PM   #7
m_runwal
LQ Newbie
 
Registered: Mar 2007
Posts: 8

Rep: Reputation: 0
Access write for Pen Drive ?

how should I able to write Pen drive ?
when I try to create , delete , edit , I always get Readonly access.

I am using Fedora core 6. with pen drive auto mounted.

Help me. !
 
Old 03-20-2007, 10:05 PM   #8
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by m_runwal
how should I able to write Pen drive ?
when I try to create , delete , edit , I always get Readonly access.
All I know to suggest is what I suggested to prabhatsoni in post #3. Do make sure the pen drive is not set to "write protect" (a switch on the device if it has this capability).
 
Old 03-21-2007, 12:26 AM   #9
m_runwal
LQ Newbie
 
Registered: Mar 2007
Posts: 8

Rep: Reputation: 0
just a day before I was able to write in pen drive. but with the same command I couldn't.

No that is not the case. in my pen drive, it doesn't have any option or nob for write protection. and all my files are easily accessible (rwx) from windows. but it still giving me trouble for linux.

Pen drive is ok. not issue with the hardward.
Linux mounting is also ok.

As its only standalone machine. the only user of my machine is MySelf. and I logged most of the time as root. what else I have to do to write in pen drive.

whenever i try to delete the file it say "read-only" access.

Your help, will really really help me out of trouble.

Thank you

Last edited by m_runwal; 03-21-2007 at 12:32 AM.
 
Old 03-21-2007, 12:49 AM   #10
prabhatsoni
Member
 
Registered: Oct 2004
Location: India
Distribution: FC 12
Posts: 233

Original Poster
Rep: Reputation: 30
With me the problem was intermittant.
Not having any idea about removing "read-only access" I used the brute force approach and formatted the drive and it worked ok.

I think there is substance in what blackhole54 has said above about the hard limit on directory entries in the root of the file system. And if it is true, then we would be requiring frequent reformatting whenever the limit is reached, which would again be quite frequent considering the frequent copy-delete operations which a pen drive usually goes through.

If you will be using this flash drive only with linux then creating ext3 file system might be explored.


Prabhat Soni

Last edited by prabhatsoni; 03-21-2007 at 12:58 AM.
 
Old 03-21-2007, 05:18 AM   #11
m_runwal
LQ Newbie
 
Registered: Mar 2007
Posts: 8

Rep: Reputation: 0
Thank you.
I got the clue from you both. I have formated my pen drive with windows. ( just unsure about if I format with linux could not give problem in windows) then I got the access of my file.

one more thing. their was no as such 256 folder on my root drive. it has hardly 10 to 20 folder on root drive. I haven't counted inside folder/folder/folder. but finally my problem is solved before my deadlines.

Thanks everybody.
-----------------------------------------------------
May be someother day I could able to help others.
 
Old 03-22-2007, 02:38 AM   #12
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by prabhatsoni
I think there is substance in what blackhole54 has said above about the hard limit on directory entries in the root of the file system. And if it is true, then we would be requiring frequent reformatting whenever the limit is reached, which would again be quite frequent considering the frequent copy-delete operations which a pen drive usually goes through.
My recollection is that the hard limit only applies to the root directory on a partition (or drive). If so, you could solve the problem by doing all of your work in subdirectories. But beyond finding the following link, I have not researched that for this thread, so I could be wrong. I believe I first became aware of this limitation in connection with a problem NASA had with the Mars Rover. (In this article they talk about the "DOS filesystem," but I believe they really mean a FAT filesystem.)

Quote:
Originally Posted by prabhatsoni
If you will be using this flash drive only with linux then creating ext3 file system might be explored.
Good idea if you really don't need to intereact with things that can't handle ext2/ext3. I am wondering if you really want journaling (ext3 vs ext2), but I am not sure.

Quote:
Originally Posted by m_runwal
their was no as such 256 folder on my root drive. it has hardly 10 to 20 folder on root drive. I haven't counted inside folder/folder/folder.
I am glad you solved your problem.

As far as not having much stuff in the directory, remember that (at least according to the story I just linked to) it is not how much you now have in your directory, but how much total you have had since it was created. Also, I believe I recal reading that the way long filenames (beyond "8.3 names") are implimented, they chew up some of the availabe directory space. Maybe somebody reading this thread (hint, hint) who knows the details of this stuff will post, so we can all stop guessing and going on vague memories!

Last edited by blackhole54; 03-22-2007 at 02:40 AM.
 
Old 03-22-2007, 08:11 PM   #13
dracolich
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 1,173

Rep: Reputation: 47
blackhole54, you're almost right. My sources, the M$ knowledgebase and the FAT Wiki, state that the limit only applies to the root of the drive or partition. The limit, 512, inherited from FAT16, considers only objects that each use only one directory entry. When using long filenames every 13 characters requires another entry, so a file with a name that's 42 characters long (including spaces and symbols) requires the same entry space as 4 files that use the 8.3 naming format.

My mother ran into this after saving a lot of files from the internet. She never used subdirectories (she does now) but there were only 162 (60MB of a 128MB capacity) files on the root of the drive. Most of the files were 20-30 characters long.

I, personally, ran into this with my Sandisk mp3 player. I received "disk full" errors when trying to copy files although there was still over 100MB free. The filenames were all in the format:
%artist - %album - %track - %song.mp3
I had to remove the new empty file holder, unmount, disconnect, remount, copy some files off then delete them one-by-one - unmounting, disconnecting and remounting between each - until I could create some subdirectories to move them all into.

Make note of the unmount, disconnect, remount procedure. It was slow and frustrating but it worked. In my mother's case, I had already copied all her files and use Sandisk's format tool to reformat the Cruzer to it's original state, but I believe the method I used with my mp3 player would've worked.

Last edited by dracolich; 03-22-2007 at 08:12 PM.
 
Old 03-23-2007, 02:04 AM   #14
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Thanks for the clarification, dracolich.
 
Old 05-03-2007, 01:44 PM   #15
xenmaster
LQ Newbie
 
Registered: Sep 2005
Posts: 15

Rep: Reputation: 0
I've got a usb harddisk that is correctly recognized (by SuSE/KDE) and automagically mounts, but then when I try to write to the filesystem, I get "Read-only file system" errors. The filesystem is mounted rw.

This is the `mount` line:
/dev/sdc1 on /media/My_Book type subfs (rw,nosuid,nodev,sync,fs=floppyfss,umask=002,procuid,utf8=true)

I myself have put the umask=002 line into /etc/fstab. But this doesn't effect the read-only-ness of the filesystem. There is nothing I can do that makes it read-write.

Sometimes, I can write to it for a couple of commands. I do a 'touch', I mkdir a directory, I move a file. But then inevitably it becomes read-only again. On one occasion I was able to write to it an entire session. This seems to be completely random behaviour.

Does anyone have any knowlegde of the mounting process of usb devices and why it could be that it gives almost random "read-only" errors?
 
  


Reply

Tags
access, drive, pen, read, usb


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:36 PM
HFS+ Formatted Flash Drive Mounts as Read-Only applewax Linux - Hardware 4 11-03-2006 11:00 AM
Vtec V-Drive USB 2.0 Flash Pen not working in Ubuntu 5.10 qwerty Linux - Hardware 0 02-16-2006 07:54 PM
read & write USB pen drive?? wrangler Linux - Newbie 5 03-08-2005 04:11 PM
Lexar USB Jump drive mounts read only qaball Linux - Hardware 7 02-06-2004 08:22 AM


All times are GMT -5. The time now is 01:44 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration