Re: Sync file on write?

On Sun, 27 Dec 2009, Paul Hartman wrote:

On Sun, Dec 27, 2009 at 4:30 PM, Theodore Kilgore
<kilgota banach math auburn edu> wrote:

On Sun, 27 Dec 2009, Paul Hartman wrote:


I have a USB device and write speed is terrible when I copy more than
1 file to it (it is mounted in async mode). If I copy just one file
and sync, speed is 17MB/sec, if I copy more than 1 file the speed
drops well below 2MB/sec. This does not happen on MS Windows so I
think it's some side-effect of linux i/o flushing creating multiple
write-streams or something like this.

Anyway, I'm trying to work-around this and wonder if there is a way I
can tell MC to sync/fsync (whatever means ensure file is written to
disk physically) after each file? If it would apply only to writes
into this device that would be even better :)



I have no idea of the cause of this. I am not a specialist in Midnight
Commander to any extent whatsoever. I do know a bit more about USB, but I
have never delved very much into questions of speed.

Keeping the above disclaimers in mind, it does appear to me that there is a
simple test which might help to localize the problem.

Can you set up a situation in which the slowdown occurs in Midnight
Commander, but it is possible to move the same files from the same source
location to the same destination using command-line tools only? And run a
time comparison under both circumstances?

Theodore Kilgore


Sorry if I wasn't clear, the problem isn't caused by MC and I don't
think MC has anything to do with it, but it is simply my tool of
choice for everyday working. It happens if I use "cp" from
command-line or copy files from within MC or using GUI tools. In other

this is slow:
cp file1 file2 file3 /mnt/usb; sync

this is fast:
cp file1 /mnt/usb; sync
cp file2 /mnt/usb; sync
cp file3 /mnt/usb; sync

So that's why I was curious if there's any kind of  "after file"
command or option to make it sync to disk after every file.

Interesting. So, what you are saying is, it is possible to change things on the command line so that it works fast. But if one uses the obvious construction of the command there is a slowdown. So if there is a problem with using Midnight Commander the problem is that, underneath, MC is using the usual tools in the usual and obvious way instead of clevering itself around the problem. Which I would tend to agree is not a shortcoming of Midnight Commander, per se. It is after all one of the things that I use, too, as a "tool of choice for everyday working," or else one would not find me subscribed to this list!

Quite seriously, why don't you bring this question to the attention of the people on this list over here:

        usb-storage lists one-eyed-alien net

I think some of them might find that your experience raises an interesting question or two. Me, I also wonder exactly what is behind the problem.

Come to think of it, though, what happens if you are not copying to or from a USB flash drive? Do similar things also occur if you are copying between two internal hard disks, or from one place on the disk to another? If that is the case, then this is not a USB storage problem after all, is it?

Theodore Kilgore

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]