LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-24-2003, 05:39 PM   #1
pandasuit
Member
 
Registered: Jul 2003
Location: Canada
Distribution: Slackware
Posts: 70

Rep: Reputation: 15
Stop USB Flash drive from buffering?


I have a USB flash drive (Creative Nomad Muvo 128). In WinXP when I write to the drive it happens right away but in Linux files are not actually copied to the drive until I unmount it. Since it is on USB 1.1 this can take quite a few minutes if I change alot of the data on the drive. Is there anyway to disable the caching of data so that it writes to the drive as soon as I copy files to it?

I am using SuSE 8.2. Is there any other information needed?

output from 'mount':
/dev/sda1 on /media/sda1 type vfat (rw,nosuid,nodev,user=pandasuit)
 
Old 12-26-2003, 06:31 PM   #2
miaviator278
Member
 
Registered: Dec 2003
Location: Al-Diwania, Iraq (deployed)
Distribution: Slackware ONLY
Posts: 237

Rep: Reputation: 30
i'll check into this as i would like to do the same thing
check the man page on mount
any documentation on usb in /usr/doc

what you are trying to do is turn off caching to the usb disk..

windows actually does it too to some extent.. if you write to a drive and remove it in win or lin, you will generally not have the data you just wrote
_______________________
if you get a tinfoil gumwrapper stuck in the end of you usb drive it will make computers shut off when you insert it, and then create a 6.2 gig file on a 128 mg drive...
 
Old 12-27-2003, 02:35 AM   #3
pandasuit
Member
 
Registered: Jul 2003
Location: Canada
Distribution: Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
I will take a look into that too.

I noticed that in Win2k even if I wait for the writing to finish (and it is actually writing to the device right away) if I remove the device without first telling Win2k to "stop the device" none of the new data will be on it when I plug it into something else. On XP this is not a problem as it will auto-stop the device (I guess this is synonymous with automatic clean unmount). I have actually never seen WinXP wait before writing things to the device...but frequent read accesses to the same file become quicker leading me to believe there is some caching going on.

One difference I noticed right away between Win and Lin is that in Win the device is still accessible during a write much like a HD while in Lin I am unable to even list files on the device while data is being written to it.
 
Old 12-27-2003, 04:35 AM   #4
carlywarly
Member
 
Registered: Feb 2003
Location: Sunny Southport, again.
Distribution: PCLinuxOS 0.93 and 0.92, Vector sometimes
Posts: 825

Rep: Reputation: 30
I noticed this effect, until I used my usb drive on Mandrake 9.2 It definitely doesn't cache, but 9.1 does. I have no idea why. I haven't tried with SuSE 9.0 yet.
 
Old 12-27-2003, 07:26 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,681

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Adding the sync option will disable caching.

See man pages for mount for details.
 
Old 12-27-2003, 04:58 PM   #6
miaviator278
Member
 
Registered: Dec 2003
Location: Al-Diwania, Iraq (deployed)
Distribution: Slackware ONLY
Posts: 237

Rep: Reputation: 30
that should save another night of searching, someone please post if this works for them.. mount man page (read 150 times missed synch option 149 times)...
 
Old 12-27-2003, 07:09 PM   #7
pandasuit
Member
 
Registered: Jul 2003
Location: Canada
Distribution: Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
miaviator278: You probably know this...but: type "/" then "synch" while reading a man page to search for that term. Of course the real issue (the one I didnt have solved) was which term to look for. So thx to michaelk for pointing it out.
 
Old 12-28-2003, 10:57 AM   #8
Slacker_Rex
Member
 
Registered: Aug 2003
Location: Arkansas
Distribution: Slackware 12.2
Posts: 104

Rep: Reputation: 15
According to man mount:

" -o Options are specified with a -o flag followed by a comma separated string
of options. Some of these options are only useful when they appear in the
/etc/fstab file. The following options apply to any file system that is
being mounted (but not every file system actually honors them - e.g., the
sync option today has effect only for ext2, ext3 and ufs):"

The last sentence tells me that synch won't work unless I reformat my drive. I guess I will have to make sure I umount it first. Since I use my drive for both linux and windows, I don't want to make it an ext2 (or other compatable for syncing) system.
 
Old 12-28-2003, 04:54 PM   #9
miaviator278
Member
 
Registered: Dec 2003
Location: Al-Diwania, Iraq (deployed)
Distribution: Slackware ONLY
Posts: 237

Rep: Reputation: 30
yes i noticed that for my vfat usb drive, that i use to download from the windoze computers that i can use to get on the net (i don't have an option here, it's use MS computer or don't get on the net, military crap).. so i hope it's not the actual kernel level usb mass storage driver, if anyone else has any insight please post it..

pandasuit
did this work for you?
and yes, i tried searching for cache, caching, etc. and did not find synch...
 
Old 12-28-2003, 06:58 PM   #10
pandasuit
Member
 
Registered: Jul 2003
Location: Canada
Distribution: Slackware
Posts: 70

Original Poster
Rep: Reputation: 15
I just tried it. It will mount with synch as an active option (at least according to the output of mount) but it does not have the desired effect. It acts just like before. Whether this is because it is not implemented for that filesystem or because it is not the option to do what we want I do not know. I would be interested in seeing how Mandrake 9.2 is automounting these drives. What are the active options? carlywarly?

I will be upgrading to SuSE 9 in the next few days I hope (the CDs have been sitting on my desk for a few weeks) and will get back to you guys about how it handles USB drives.
 
Old 12-29-2003, 09:18 PM   #11
Slacker_Rex
Member
 
Registered: Aug 2003
Location: Arkansas
Distribution: Slackware 12.2
Posts: 104

Rep: Reputation: 15
Semper Fi MI Aviator, your dilemma is one of the main reasons I got my flash drive. It is so much easier to plug it in and pass files back and forth between OS's that are not alike (and at work rather than having to deal with up and down military e-mail).

Keep 'em safe!
(from a Gunny in the states)
 
Old 12-29-2003, 10:32 PM   #12
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
Here's my supermount fstab entry from Mandy 9.2:

none /mnt/removable supermount dev=/dev/sda1,fs=ext2:vfat,--,codepage=850,iocharset=iso8859-1 0 0

Only thing I changed is to remove kudzu so it would stop deleting the mount point and editing fstab automatically. There was a change in behavior between 2.4.22-10mdk kernel (stock) and the updated 2.4.22-21mdk kernel I'm using now, however. Used to create the mount point under user's home ~/tmp/mnt/removable and now it creates it in /mnt/removable and chown's that dir to user:group instead. In any case, Mandy 9.2 seems to flush the write cache every few seconds regardless of the device I'm using. So I sort of doubt the USB mass storage driver has anything to do with it. Have no idea how to tweak the default cache behavior, but that's my guess.
 
Old 12-30-2003, 02:00 AM   #13
miaviator278
Member
 
Registered: Dec 2003
Location: Al-Diwania, Iraq (deployed)
Distribution: Slackware ONLY
Posts: 237

Rep: Reputation: 30
it may do that automaticly for ext2 systems.
curious how to do it on a vfat. though
 
  


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 thumb drive -- Need to stop? lnebrown Linux - Newbie 9 10-25-2005 11:40 PM
USB Flash Drive LunarEagle Linux - Newbie 5 03-22-2005 04:11 PM
help about USB flash drive deepdark SUSE / openSUSE 13 01-05-2005 11:38 PM
USB 2.0 Flash Drive fusee Linux - Hardware 3 04-16-2004 05:46 PM
USB Flash Drive Hady Linux - Hardware 1 11-20-2003 01:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:21 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
Open Source Consulting | Domain Registration