LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-20-2004, 11:52 PM   #1
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Flash drive write cache


Does anyone know if there's a way to disable write caching on a particular disk (e.g. sda)?

I'd like to speed up the unmount process for a USB flash drive.

Dave
 
Old 05-21-2004, 10:46 AM   #2
nukkel
Member
 
Registered: Mar 2003
Location: Belgium
Distribution: Hardened gentoo
Posts: 323

Rep: Reputation: 30
Sure...
First unmount the drive.
Go into your /etc/fstab (will need to be root to edit it).
Find the line that corresponds to your flash drive.
There's an options field with comma-seperated keywords;
add the word
sync
to that list, using the necessary comma's
Now you can mount it it won't use write cache.

Beware that this speeds up the unmount time (and avoids disaster should you pull out a mounted drive) but it will increase latency while working on the drive.

Hope this helps, greetings
 
Old 05-21-2004, 05:32 PM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Original Poster
Rep: Reputation: 96
Excellent. That's exactly what I was looking for.

Cheers!
 
Old 05-21-2004, 08:50 PM   #4
Slacker_Rex
Member
 
Registered: Aug 2003
Location: Arkansas
Distribution: Slackware 12.2
Posts: 104

Rep: Reputation: 15
It does not quite work that way. If you man mount, you will see that :

the sync option today has effect only for ext2, ext3 and ufs

My flash drive is a mounted with vfat, so sync wouldn not have an effect. I am gues the drive could be reformatted to one of the ones listed above if you really need it to work though.
 
Old 05-21-2004, 09:25 PM   #5
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Original Poster
Rep: Reputation: 96
Interesting.

I've tried moving large numbers of files to the device with sync on and with it off, and it appears that sync *does* work with the device formatted as msdos.

After moving 40 MB of files with sync off, unmounting takes ~5 seconds. With sync on, unmounting is instant.

Perhaps the man pages haven't been updated for kernel 2.6??

Dave
 
Old 05-22-2004, 11:07 AM   #6
nukkel
Member
 
Registered: Mar 2003
Location: Belgium
Distribution: Hardened gentoo
Posts: 323

Rep: Reputation: 30
That's strange Slacker_Rex... I've been experimenting with it as well and it also seemed to work (kernel 2.4.20) ... Writes take a lot longer and unmounting goes instantly. And it worked as well on floppy disks, which are msdos file system.

Maybe someone forgot to update the man pages?

Anyway, if it works to speed up the unmounting, all the better!

cheers!
 
  


Reply


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
turning on dma and write back cache on SATA? niverson Linux - Hardware 16 02-15-2006 12:42 AM
webmin troubles - Failed to write to /etc/webmin/module.infos.cache : No space left o coal-fire-ice Linux - Software 1 07-28-2005 10:08 AM
mount floppy drive and l3 cache?? gsr_kashyap AIX 1 03-25-2005 04:09 AM
IRQ conflict when external drive/flash-drive is put to use Nightfrost Linux - Hardware 0 10-22-2004 04:15 AM
USB Flash drive will not let me write. sniperhf Linux - Hardware 1 12-05-2003 02:39 AM


All times are GMT -5. The time now is 08:48 PM.

Main Menu
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