LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Stop USB Flash drive from buffering? (https://www.linuxquestions.org/questions/linux-hardware-18/stop-usb-flash-drive-from-buffering-128725/)

pandasuit 12-24-2003 05:39 PM

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)

miaviator278 12-26-2003 06:31 PM

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...

pandasuit 12-27-2003 02:35 AM

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.

carlywarly 12-27-2003 04:35 AM

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.

michaelk 12-27-2003 07:26 AM

Adding the sync option will disable caching.

See man pages for mount for details.

miaviator278 12-27-2003 04:58 PM

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)...

pandasuit 12-27-2003 07:09 PM

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.

Slacker_Rex 12-28-2003 10:57 AM

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.

miaviator278 12-28-2003 04:54 PM

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...

pandasuit 12-28-2003 06:58 PM

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.

Slacker_Rex 12-29-2003 09:18 PM

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)

Crito 12-29-2003 10:32 PM

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. ;)

miaviator278 12-30-2003 02:00 AM

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


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