Moving files on samba-connected NAS

5

This might be a stupid question, but when I move files around on my NAS-box (freeNAS), does the data go via my Windows PC?

How about when I copy?

I have always been afraid to cleanup on my NAS-box because I didn't know whether the files would take hours to move and such...

Christian Wattengård

Posted 2011-05-30T07:17:20.027

Reputation: 445

I cannot provide an answer, but a clue. You could check your network activity while moving. Also, moving a file to another directory should be fast. If you want to make sure the data does not go via your windows pc, you can ssh (per (http://www.chiark.greenend.org.uk/~sgtatham/putty/)%5BPuTTY] for example) to your FreeNAS box and use mv, cp, etc.

– cularis – 2011-05-30T08:10:59.550

Answers

6

This depends on the source and target:

Same source and destination share:
In case the source and target are on the same SMB share then your client just sends the command to move it. The data itself is never transferred to your client and uploaded to server again. This also allows you to move gigabytes of files within milliseconds even when on a slow VPN connection.

Different source and destination share:
In case the source and destination folders are not on the same SMB share, then even if you move the data it's transferred via your local machine. So the network transfer is around two times the data size (read data, write data, delete data on old location).

Copy:
If you copy data it's always copied via your client. So always the traffic is around double the data size.

So yes, moving is only fast if done on the same share. If you use a NAS with local shell access you might be able to do some move operations faster by logging in on the shell and moving the folders directly on NAS side. For example you want to move files from \\nas\incoming\ to \\nas\archived\ then moving files via Samba/SMB will mean to copy the data via network from one share to the other. Assuming that on the NAS the directory structure looks as follows (example):

/data/
/data/incoming
/data/archived
...

And assuming /data/ is on the same volume (check using mount command) then executing the following will be much faster:

mv "/data/incoming/some-folder" "/data/archived"

This would move all the data almost immediately since the move operation on the file system is just about adding a reference to the some-folder directory in archived and removing the reference from incoming.

Caution: If you move data on the shell, then you also move it including all the permissions. So you might have to adjust the permissions of some-folder after moving it in order to match the permissions of other files in the archived folder.

SkyBeam

Posted 2011-05-30T07:17:20.027

Reputation: 3 612