I have a large amout of data (several GB) on a remote drive, that is transparently mounted via nfs. I'd like to copy these files into a subdirectory of where they are already residing, so everything stays on the same physical disk. For that reason, I would like to prevent an unnecessary round trip over the network.

It seems that cp files* subdir does the naive thing and reads all the data into memory and then writes it back. Is that true? Is there a special command that does the actual copying entirely on the server the disk is physically connected to?

link|improve this question

50% accept rate
Do you mean copy (as in cp), or move (as in mv)? If you move the files, I don't see why there should be any round-tripping. – Kusalananda Sep 20 '11 at 13:49
I mean a proper copy (cp). – jdm Sep 20 '11 at 14:42
feedback

1 Answer

up vote 2 down vote accepted

It seems that cp files* subdir does the naive thing and reads all the data into memory and then writes it back. Is that true?

Yes.

Is there a special command that does the actual copying entirely on the server the disk is physically connected to?

No, unless you can login to the remote machine with ssh and do the copying there.

EDIT There is some work going on to add "server-side copy" to the NFS protocol version 4.2 (current is 4.1). See e.g. http://www.usenix.org/events/fast11/posters_files/Lentini.pdf . Note that then using this feature would require a) NFS clients and servers supporting it b) a new syscall for the client OS (maybe reflink or copyfile()?) c) support for using the new syscall in the usual utilities (cp, rsync, etc.). My guess it will be at least several years before anything this sees the light of day.

link|improve this answer
Too bad. I think AFS supports this, and this looks like someone implemented a patch to NFS to include it: lsub.org/who/nemo/nfscp.html – jdm Sep 20 '11 at 14:43
@jdm: There is some work in this area, see my edit. Maybe in the future.. – janneb Sep 20 '11 at 15:09
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.