LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-21-2013, 01:16 PM   #1
displace
Member
 
Registered: Jan 2013
Location: EU
Distribution: Debian
Posts: 268

Rep: Reputation: 25
Thumbs down Samba - slow copy operation within a remote share


I've setup samba on a remote linux server. It has a share that points to a folder on an external HDD with ext4 filesystem (about 90% free space). The server can be accessed via na ethernet connection. The files inside the remote share are fully visible from a file browser on my computer. Copying files from and to the server from my local computer works fine, and goes about 8-9 MB/s. This is fine for a 100MBit ethernet.

However when I access the share, and try to copy a file from one folder to another within the *same* share, the speed is only about 3-4 MB/s. This happens when I copy on a linux xubuntu and on a windows 7 machine. I've benchmarked the disk transfer speed with dd on the server, and it should go about 60MB/s (it's on a sata port). Why the hell is this copy operation so slow when the source and destination are on the same drive within the same samba share? Surely samba can't be so stupid to transfer the file from the remote share to the local computer that's doing the copying procedure, and then again uploading the same file to another folder within the same share.

There must be a better way. How can I fix this?
 
Old 09-21-2013, 02:24 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
What happens if you ssh into your remote machine and do the copy locally? if you get a reasonable speed that way then it looks like your assumption that it is copying files to the remote and back s true.

Just tried this from local
Code:
time cp /media/smb-192.168.1.66-lansite/Photos/Pictures/China/China1/dsc_0001.jpg /media/smb-192.168.1.66-lansite/tmp
real	0m2.689s
user	0m0.000s
sys	0m0.030s
From remote (ssh'd)
Code:
time cp /media/Media/Photos/Pictures/China/China1/dsc_0001.jpg /media/Media/tmp
real	0m0.124s
user	0m0.000s
sys	0m0.110s
As you can see there is a lot of difference (file size is about 6M)
 
Old 09-21-2013, 04:53 PM   #3
displace
Member
 
Registered: Jan 2013
Location: EU
Distribution: Debian
Posts: 268

Original Poster
Rep: Reputation: 25
Copying locally via ssh completes almost instantly. The back-n-forth sounds more and more like a plausible scenario. But how can I fix it? I mean obviously the back-n-forth approach is a waste of time and bandwidth, so considering the age of the samba project I'm guessing there has to be a way to correct this in samba.
 
Old 09-21-2013, 05:09 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
I don't think there is any way around that, either you do the copy locally and have to put up with copying back and forth or you use a remote copy and get a faster copy, apples and oranges!

Does an NFS share do the same?
 
Old 09-24-2013, 12:12 PM   #5
displace
Member
 
Registered: Jan 2013
Location: EU
Distribution: Debian
Posts: 268

Original Poster
Rep: Reputation: 25
NFS does the same. It takes about 35 seconds to copy a 200 MB file. Copying locally does it on just 4 seconds. The thing is I have to use windows file sharing. Is this a protocol limitation or something? Because I had expected a remote copy command would be built into the SMB just like the remote move command works (moving files in explorer completes instantly).
 
Old 09-24-2013, 02:12 PM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Had a good look around and there seems to be no way around this the only thing you can do is either put up with the upload/downloading delay or ssh into the remote machine and do a local copy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems using robocopy to copy to a samba share. osantos Linux - Server 9 02-03-2015 04:33 AM
*Perl* ssh into remote machine and execute parallel copy operation to network drive lunlun Programming 7 08-25-2009 12:08 PM
cant create or copy files to samba share Elnegro8 Linux - Server 27 07-16-2008 08:06 AM
cant copy file from samba's share apeacez Linux - General 1 10-11-2004 10:06 AM
filecopy from xp to samba slow, copy to mounted share fast xtra Linux - Software 6 07-29-2004 04:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration