mirkosertic
Posts: 4
Joined: Mon Nov 25, 2013 11:58 am

Slow samba performance / timeout while copying of large file

Mon Nov 25, 2013 12:14 pm

Hi there

I am running my Pi mod B with the latest Raspian and Samba, which exposes my USB drives mounted by usbmount.
The USB drives are exFat formatted, so i can access them from the pi and also from my windows 7 box, and i do not hit the ntfs cpu penalty. Everything works well, even my Mediatomb server so i can watch movies from my WDTV Live.

So problem is a timeout while copying large files(>2g) from my windows 7 box using a samba mount to the attached usb device. It just times out. Smaller files work pretty well. From my point of view, windows tries to allocate the space on the usb device by creating an empty file with the same size, and then it copies the data to the drive. And the problem here is that creating a large empty file on the pi is pretty slow, and while the pi fills the space, windows will timeout.

I've tested writing to the USB device by using dd, here are the results:

pi@raspberrypi ~ $ dd if=/dev/zero of=/media/usb0/test.tmp bs=500K count=1024
1024+0 records in
1024+0 records out
524288000 bytes (524 MB) copied, 65.9082 s, 8.0 MB/s

Seems like the "fiil speed" is about 8 MB/s. It the system would use this as the copy speed, everything is ok, but this stupid win* tries to allocate the space first.

Any ideas?

Thanks in advance
Mirko

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 28358
Joined: Sat Jul 30, 2011 7:41 pm

Re: Slow samba performance / timeout while copying of large

Mon Nov 25, 2013 12:53 pm

Can you use a windows version of rsync instead? That would be better than using Samba anyway.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

mirkosertic
Posts: 4
Joined: Mon Nov 25, 2013 11:58 am

Re: Slow samba performance / timeout while copying of large

Mon Nov 25, 2013 3:02 pm

Hmm, i need a user friendly ui, is there something available? Perhaps OSS?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 28358
Joined: Sat Jul 30, 2011 7:41 pm

Re: Slow samba performance / timeout while copying of large

Mon Nov 25, 2013 3:16 pm

mirkosertic wrote:Hmm, i need a user friendly ui, is there something available? Perhaps OSS?
No idea, Google is your friend. Rsync will be much faster than Samba, or you could even use FTP which definitely does have a windows version.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

vadim
Posts: 129
Joined: Wed Sep 18, 2013 1:47 pm
Location: Nottingham

Re: Slow samba performance / timeout while copying of large

Mon Nov 25, 2013 3:22 pm

Slow samba? :o Oh, they must have called it sarabande. :lol: Invented in hell, as Cervantes once said.
In short, don't use it.

mirkosertic
Posts: 4
Joined: Mon Nov 25, 2013 11:58 am

Re: Slow samba performance / timeout while copying of large

Mon Nov 25, 2013 3:46 pm

Hi there

I tested with SFTP and FTP, and they are not much faster. I will check for a nice rsync ui. Problem is not the performance, it is the timeout!

Regards
Mirko

mirkosertic
Posts: 4
Joined: Mon Nov 25, 2013 11:58 am

Re: Slow samba performance / timeout while copying of large

Mon Nov 25, 2013 8:51 pm

Hmm, i did some testing.

After formatting the USB drive with EXT4, my problems went magically away. I also tweaked some samba settings and with a large buffer of:

socket options = SO_KEEPALIVE TCP_NODELAY SO_SNDBUF=524288 SO_RCVBUF=524288

I am reaching an average write transfer speed between my windows box and the pi of ~5-5.5MB/s, with a smaller buffer of 8192 bytes i am reaching max. 2MB/s.

This is quite strange. Any ideas? If EXT4 filesystem fixes my problems, i will stay with it. For Windows direct USB access, i will try Paragon ExtFS, but i would really like to know WHAT is the problem for this? Bad fs drivers, or bad configuration? Hopefully not bad hardware ;-)

Regards
Mirko

vadim
Posts: 129
Joined: Wed Sep 18, 2013 1:47 pm
Location: Nottingham

Re: Slow samba performance / timeout while copying of large

Tue Nov 26, 2013 12:28 pm

Buffering makes sense because writing to USB HDD is a slow process. I bet you will see high waiting % in top. Remember, your USB subsystem is stressed twice with the same data, so when receiving it can't write at the same time.

Return to “Raspberry Pi OS”