What is actually happening here?

Maximilian

Lifer
Feb 8, 2004
12,604
15
81
If I transfer files from hard drive A to hard drive B on a server using my desktop (these are shared hard drives I can access them from other PC's) does the server send the files to the desktop over the network then back to the other hard drive on the server?

I ask because I noticed the network use going crazy on task manager whenever I do this, whereas if I RDP into the server and transfer between hard drives it just goes directly to the other hard drive.

Heres a diagram of what I think is happening:
OZnfbOO.png


Red indicates the path I think the file takes, the top is just RDPing in and transferring the file, the second is me using another computer to do it. Is this correct? Why does it do that?

Not complaining just trying to understand why this happens. Does windows not realize the start point and destination are on the same computer? Or is there no protocol to account for such a situation?
 

code65536

Golden Member
Mar 7, 2006
1,006
0
76
It used to make that round-trip. This is because of how copying works in pretty much every OS--the copying process reads the data into memory and writes it back to disk, so the data must travel to the system where the process is running and then travels back.

It's possible to optimize this away, but it's not trivial, and would require cooperation from both the client and server systems (i.e., the client system needs to be able to coordinate this with the server system, and the server must support it since its OS will ultimately be the one doing the copying on behalf of the client).

And at some point--I think with Windows 8--Microsoft did implement this. But only if you use the OS's file copy API; if the file is being copied by a process that manually reads and writes the file (e.g., a custom copying utility, or maybe a program that had been ported from another OS), this optimization won't be possible for obvious reasons. Anyway, it works perfectly for me with both my client and server systems running Windows 8.1--copying a file from the server's Storage Spaces array to the server's SSD from my desktop using SMB, I get rates that far exceed that of GbE and no extra network traffic.
 
Last edited:

Maximilian

Lifer
Feb 8, 2004
12,604
15
81
Aha it goes to memory first... makes sense! Beautiful answer thanks!

The server is linux mint 16 and the desktop is windows 8.1, guess ill just have to live with it :) Or VNC in for huge transfers.
 

azazel1024

Senior member
Jan 6, 2014
901
2
76
MS I think fixed/changed this in Windows 8. Its something supported in SMB3.0, IIRC.

Otherwise, yes, it is copied in to memory on the client and then back to the server on the other drive. I've seen this behavior on Windows 7 and earlier. I have no observed it on my Windows 8 server and Windows 8/8.1 clients.

You can also use RDP to remote login to the server and copy across remotely instead of over SMB...but that is of course a lot more steps.