[Samba] hardlink unlink-before-save?

Bartosz Stec bartosz.stec at it4pro.pl
Mon Jun 21 08:01:41 MDT 2010

On 2010-06-21 07:15, Linda W wrote:
> Bartosz Stec wrote:
>> Hello list
>> On my server almost half of files are duplicated, and there are 
>> almost 100GB of data which is growing fast. I'm using weekly script 
>> to find duplicated files and replace them with hardlinks. Everything 
>> is fine as long as users aren't trying to edit and save some 
>> documents which have hardlinks. With samba 3.3 it seems that 
>> hardlinks aren't unlinked before file is saved.
>> Is there any way to force samba to unlink file before write?
> ---
> Wouldn't that be a function of the application program?
> Some applications do similar to that -- like a rename & create (where 
> the old file will be around as a backup).  But some applications may try
> to modify the file in-place.  It depends on the application.
> You might be able to force the issue by changing the 
> permissions/ownership on the linux server to a '3rd party' login and
> set other permissions to read-only.  Then anyone who wants to write 
> would have to delete the copy that is there (or rename it).
I think you'r missing a point. Windows apps don't realise there is even 
such thing like hard link. For instance someone simply open MS Excel 
spreasheet, edit and save it on network share. This xls file could have 
one or more hardlink, but it is now ignored at all. SAMBA is in fact a 
layer between Unix filesystem and Windows clients and programs, so the 
way which I/O operations and checks on filesystem is performed are 
strictly samba related AFAIK. Older versions seems to behave like I want 
it to according to:


Unfortunately there was no straight answer, so I started another thread :)

Bartosz Stec

More information about the samba mailing list