Moving files on samba-connected NAS
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.
Related videos on Youtube
ErrorrrDetector
Updated on September 18, 2022Comments
-
ErrorrrDetector over 1 year
Which is the best Data Structure for Priority Queue implementation and why ?
name some other Data Structures other than the best one to implement a Priority Queue and Tell its advantages and Disadvantages .Thanks. Thanks Thanks Thanks Thanks Thanks in advance so much thnx
-
cularis almost 13 yearsI 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 (chiark.greenend.org.uk/~sgtatham/putty/)[PuTTY] for example) to your FreeNAS box and use mv, cp, etc.
-
therealrootuser about 9 yearsHave you tried Wikipedia? en.wikipedia.org/wiki/Priority_queue#Implementation
-
Carcigenicate about 9 yearsYou can't delete on mobile. Go to the site.
-
ErrorrrDetector about 9 yearsWhat NExt ?? What NExt ?? What NExt ??
-
ErrorrrDetector about 8 yearsGive a few more details !
-
-
Asif Mushtaq about 8 yearsany other reason please? as in linked-list there is insertion time is O(1)
-
Tim about 8 yearsWhile inserting may take constant time, peeking and initial building (search) can be expensive. Every data structure is a trade off, and most can be used for most situations. It's all about trade-off and efficiencies.
-
Admin almost 2 yearsThanks a lot for this! One sub-question: When the COPY operations's source and target are entirely on the share, why does this travel through the client? And not on the server alone? Would be so convenient: Much faster. And you could only initiate the copy operation, and as no traffic flows through your client, disconnect or only "observe" (keep idle connection open and get notified when done), not fearing that a network disruption interrupts/destroys your copy operation. Also if the host has a copy-on-write filesystem GB/TBs can be copied in a sec.