[Samba] Re: vfat / ftruncate problem
tom at umsl.edu
Mon Apr 14 13:51:36 GMT 2003
On 11 Apr 2003 17:51:38 +0200
Uli Luckas <luckas at musoft.de> wrote:
> A much safer Idea would be to skip truncating, returning an error. Maybe
> Windows can deal with failing truncates.
> result = sys_ftruncate(fd, len);
> /* if (result == 0) */
> goto done;
I greatly appreciate your response Uli. Thankyou for taking the time to understand my question and write back with your very meaningful comments.
I would have wrote back to you sooner but I wanted to try out your suggestion first. Your way does work and following your reasoning it does sound like a better work around to my problem so I'm sticking with your way.
Yes you seem to understand the problem completely. But in summary, for anyone else who might ever be interested in this thread:
When Windows 98SE Windows Explorer copies a file to a Samba shared vfat partition it first, creates the file (so I guess a size of 0 bytes at this point), then extends it the same size as the source file, THEN starts copying the source file to it.
vfat on Linux doesn't support extending a file so Samba uses its own alternate method of just writing bytes of zeros one by one to the newly created file until it is the right size and then begins the copying. The problem is, with very large files (hundreds of megabytes) this Samba work around of extending the file can take so long that something (Samba or Windows I'm not sure which side) times out before the actual copying begins and just results in an error on the Win 98SE box.
So, what I've done is circumvented the part where Samba extends the file. I messed with it quite a bit this weekend and haven't noticed this causing any problems.
Perhaps some database application might choke with my workaround in place, but its unlikely I'll ever be accessing a database stored on that Samba share so I can live with that possibility.
Thanks again Uli.
More information about the samba