I have problems transferring binary programs to a micro-controller prototype board when using ubuntu/kubuntu to mount the board via usb. With MacOS and Windows there are no problems. I have found the writing from Ubuntu definitely changes the written file. I suspect that the write caching is the problem. How can I disable it, or what else might be the problem.
Read this first: http://groups.google.com/group/linux.kernel/msg/8d1591196c0ae15e?pli=1
I am unsure if it is true or not.
You can try using hdparm to set the write caching feature to off at runtime. (You will probably need to run this after every boot or every time you remove and reinsert the device)
Please ensure you know the correct device name (
sdb
,sdc
or so on).You can find out the device name by running:
You can also edit
/etc/fstab
and add the mount optionssync,dirsync
however I am not very familiar with how/etc/fstab
works with removable devices. I think they need a permanent mount point.kudos to @NightwishFan for the hdparm switch to set the drive's write-caching feature.
Note that the
sync
mount option decreases the speed by a magnitude (over 10 times).flush
mount option ensures an effective writing with no performance cost. Also I've been using it with no issues for a few years on all the FAT devices (spinning or flash-memory based) I've used: Actually the whole set of mount options isnoauto,users,noatime,flush,umask=111,dmask=000
, set manually or in /etc/fstab.I have replaced "sync" in favor of "noatime,flush" like stated in @tuk0z answer.
This lead to the USB floppydrive behaving the same like sync, but it writes files so much faster, like the normal operationspeed you expect it to be.
Reading image files from floppy does not result in random artifacts anymore. Also reading DD floppies does not result in weird characters in filenames.
Perhaps it's a bit unfortunate how the official documentation of "mount" put the usage in context.
Kudos!