hard links on samba shares

View: New views
5 Messages — Rating Filter:   Alert me  

hard links on samba shares

by Riccardo Iaconelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!
I'm encountering a bug with samba shares, rsync and hard links. I was trying
to investigate why on my "linksys" samba share i wouldn't get any hard link
transferred and rsyncs to it would take forever. To keep a long story short,
here's the output of the command, which should be pretty explanatory :-)

mount says that:
//192.168.0.105/DISK on /samba/linksys type cifs (rw,mand)


[root@popper linksys]# ls -lah test/*
-rw-rw-r-- 2 502 501 4 2009-10-23 08:53 test/file1
-rw-rw-r-- 2 502 501 4 2009-10-23 08:53 test/file2

[root@popper linksys]# rsync -avz --hard-links test/ test2/
sending incremental file list
./
file1
file2

sent 146 bytes  received 53 bytes  398.00 bytes/sec
total size is 8  speedup is 0.04

[root@popper linksys]# ls -lah test2/*
-rw-rw-r-- 1 502 501 4 2009-10-23 08:53 test2/file1
-rw-rw-r-- 1 502 501 4 2009-10-23 08:53 test2/file2

Is this a bug or just samba being not reliable for hard links? :-)

Bye,
-Riccardo

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: hard links on samba shares

by Matt McCutchen-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-10-23 at 09:15 +0200, Riccardo Iaconelli wrote:

> I'm encountering a bug with samba shares, rsync and hard links. I was trying
> to investigate why on my "linksys" samba share i wouldn't get any hard link
> transferred and rsyncs to it would take forever. To keep a long story short,
> here's the output of the command, which should be pretty explanatory :-)
>
> mount says that:
> //192.168.0.105/DISK on /samba/linksys type cifs (rw,mand)
>
>
> [root@popper linksys]# ls -lah test/*
> -rw-rw-r-- 2 502 501 4 2009-10-23 08:53 test/file1
> -rw-rw-r-- 2 502 501 4 2009-10-23 08:53 test/file2
>
> [root@popper linksys]# rsync -avz --hard-links test/ test2/
> sending incremental file list
> ./
> file1
> file2
>
> sent 146 bytes  received 53 bytes  398.00 bytes/sec
> total size is 8  speedup is 0.04
>
> [root@popper linksys]# ls -lah test2/*
> -rw-rw-r-- 1 502 501 4 2009-10-23 08:53 test2/file1
> -rw-rw-r-- 1 502 501 4 2009-10-23 08:53 test2/file2
>
> Is this a bug or just samba being not reliable for hard links? :-)

Probably the latter.  You can always strace rsync to check that it is
issuing the link(2) call and see what the result is.

--
Matt

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: hard links on samba shares

by Paul Slootman-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri 23 Oct 2009, Matt McCutchen wrote:
> On Fri, 2009-10-23 at 09:15 +0200, Riccardo Iaconelli wrote:
> >
> > [root@popper linksys]# rsync -avz --hard-links test/ test2/
> > sending incremental file list
> > ./
> > file1
> > file2

> > Is this a bug or just samba being not reliable for hard links? :-)
>
> Probably the latter.  You can always strace rsync to check that it is
> issuing the link(2) call and see what the result is.

Rsync is not even trying the link(2) call, as it doesn't recognize that
the files are linked; the output would have been:

./
file1
file2 => file1


Please do an ls -li on the source, to see if the inode numbers are the
same. Perhaps even do it with separate ls invocations ("ls -li file1; ls
-li file2") to see if it varies.


Paul
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: hard links on samba shares

by Matt McCutchen-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-10-23 at 11:31 +0200, Paul Slootman wrote:

> On Fri 23 Oct 2009, Matt McCutchen wrote:
> > On Fri, 2009-10-23 at 09:15 +0200, Riccardo Iaconelli wrote:
> > >
> > > [root@popper linksys]# rsync -avz --hard-links test/ test2/
> > > sending incremental file list
> > > ./
> > > file1
> > > file2
>
> > > Is this a bug or just samba being not reliable for hard links? :-)
> >
> > Probably the latter.  You can always strace rsync to check that it is
> > issuing the link(2) call and see what the result is.
>
> Rsync is not even trying the link(2) call, as it doesn't recognize that
> the files are linked; the output would have been:
>
> ./
> file1
> file2 => file1

You're right.  Somehow I was thinking that rsync might silently adjust
its output if hard linking fails, but that doesn't make much sense and
indeed that is not how rsync behaves (I tested).

--
Matt

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Re: hard links on samba shares

by Riccardo Iaconelli-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 23, 2009 at 10:36 AM, Matt McCutchen <matt@...> wrote:

> On Fri, 2009-10-23 at 11:31 +0200, Paul Slootman wrote:
>> On Fri 23 Oct 2009, Matt McCutchen wrote:
>> > On Fri, 2009-10-23 at 09:15 +0200, Riccardo Iaconelli wrote:
>> > >
>> > > [root@popper linksys]# rsync -avz --hard-links test/ test2/
>> > > sending incremental file list
>> > > ./
>> > > file1
>> > > file2
>>
>> > > Is this a bug or just samba being not reliable for hard links? :-)
>> >
>> > Probably the latter.  You can always strace rsync to check that it is
>> > issuing the link(2) call and see what the result is.
>>
>> Rsync is not even trying the link(2) call, as it doesn't recognize that
>> the files are linked; the output would have been:
>>
>> ./
>> file1
>> file2 => file1
>
> You're right.  Somehow I was thinking that rsync might silently adjust
> its output if hard linking fails, but that doesn't make much sense and
> indeed that is not how rsync behaves (I tested).

Looks like this is the problem, even if i get 2 as link count, inode
numbers differs. and i guess there is no way to ensure samba will do
hard links properly. well, such is life :\

Thanks,
-Riccardo
--
GPG key:
3D0F6376
When encrypting, please encrypt also for this subkey:
9EBD7FE1
-----
Pace Peace Paix Paz Frieden Pax Pokój Friður Fred Béke 和平
Hasiti Lapé Hetep Malu Mир Wolakota Santiphap Irini Peoch שלום
Shanti Vrede Baris Rój Mír Taika Rongo Sulh Mir Py'guapy 평화
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html