[Samba] silent file truncation on ext3 with linux quota v0

Johannes Niess j.niess at uni-bonn.de
Wed Jul 23 18:18:33 GMT 2003

Johannes Niess <j.niess at uni-bonn.de> writes:

> The following message is a courtesy copy of an article
> that has been posted to comp.protocols.smb as well.
> Hi,
> I'm trying to implement file system quotas on a Debian Woody Linux
> box. My problem is that W2k Explorer silently truncates files when
> going over quota by copying files. Other applications work as
> expected and show a "disk full" error message. 
> To me it looks like the error code for "over quota" is not propagated
> back from samba to Windows Explorer.
> I've tried with all combinations of Linux kernel 2.4.18, latest
> 2.4-ac, samba-2.2.3a-12 (from woody) and a debian source package
> 2.2.8a reconfigured --with-quota. I've not yet used a newer quota
> package.
> I've found some descriptions of the problem, but no workaround. I
> understand that samba supports only v2 version quotas (from the -ac
> kernel series and maybe latest 2.4-marcelo's-pre). I'm not asking for
> support of network drives size set to quotas. A "dfree command" can
> easily do that. 
> BTW: What's the status of quota support in Samba 3? What I really want
> are quotas per samba share, independend of the OS.

It happpens with _all_ devices. Even setting "strict allocate = yes"
does not stop the creation of sparse files.

Steven Langasek explained it in Debian-Bug 202396:

On Tue, Jul 22, 2003 at 11:17:35AM +0200, Johannes Niess wrote:
> something seems terribly wrong with disk full error handling. Howto
> reproduce:

> 1) mke2fs /dev/fd0 (with a 1.44 MB floppy)
> 2) mount /floppy
> 3) create writeabe [floppy] share in smb.conf:
> [floppy]
> path = /floppy
> writable = yes
> force user = root ; to shortcut problems with user mount options

> 4) use Windows 200 explorer to copy a 2MB file to [floppy] share
> 4) No error message on windows client. File truncation for file
> exceeding disk size. Zero byte length for following files.

> Behavior seen from client varies with file system used:
> ext2 shows full lenght under windows and linux.
> vfat shows truncated length.

> I'm afraid that this happens on "real" shares, too.

There is a fundamental disconnect due to the Unix concept of "sparse
files" (something Windows lacks).  Windows applications sometimes open a
file for writing, seek to the "end" and write a byte as a means of
checking whether space is available for the whole file, and then never
do any more error checking for the duration of the file write.  This
works passing well when the server is a Windows machine; when the server
is a Unix machine, it's possible to have a file whose total length is
greater than the available storage size, since unwritten blocks of
zeroes in the middle of a file don't use space on the disk.

You can find further discussion of this problem in the archives of the
samba-technical mailing list.  I think there may be a fix for this in
Samba 3.0; but even if there isn't, I don't intend to deviate from the
upstream source to correct what is, ultimately, a *client* bug (since
AFAIK it's Windows, not Samba, which is failing t

More information about the samba mailing list