Copying a file on TrueNAS goes via the attached PC - why?

If I want to make a second copy of a file on a TrueNAS server the file is moved to the attached PC and then sent back to TrueNAS, which takes a long time compared to a file being copied just within the TrueNAS machine - why is this and can it be avoided?

Version of TrueNAS?

Client PC(s) involved?

Are you copying within the same folder on an SMB share? Across two different SMB shares?

OS Version:TrueNAS-SCALE-24.10.1
Product:H61MA-D2V
Model:Intel(R) Pentium(R) CPU G620 @ 2.60GHz
Memory:16 GiB
Client PC = basic Win11 i3 16Gb machine
Copying one file within same SMB share
Copied TrueNAS-SCALE-24.10.1.iso
to TrueNAS-SCALE-24.10.1 - Copy.iso
I can’t think why TrueNAS would not just create the copy itself saving time and network bandwidth.

Try logging in into the WebUI of yout TrueNAS server, bavigate to “System settings->Shell” and in the opened terminal type “mc” (it stands for midnight commander") and press enter. It is a dual panel fiel manager, like Norton commander used to be.
Then navigate on the left panel to your source directory (Usually the pools are under /mnt/) then use TAB to switch focus to the right panel, select the target directory, switch back to the left panel, use F5 tp COPY files and F6 to MOVE files between the panels.
If you use your Windows machine, all actions are done through the network.

Doesn’t sound right. By default copies of a file should be going through the block cloning layer and doing the copy all server-side. Can you past your SMB share information? I.E. the purpose field and screenshot of the advanced page? Additionally the output of testparm -s would be helpful.

1 Like

Even without block cloning, it should definitely be a server-side operation with SMB and Windows 8.1 or newer.

Yep, it should, since he says he’s copying within the same share as well.

I found MC but I can’t find /mnt/ maybe I’m doing something wrong?

Is this what you asked for, if not where is the SMB share info, purpose and advanced?

Logon ID: ‘0’
Logon Type: 3
Local Address: ipv4:192.168.1.44:445
Remote Address: ipv4:192.168.1.28:62775
Service Description: SMB2
Auth Description: Null
Client Domain: MicrosoftAccount
Client Account: sbennett
Workstation: WIN11-PRO-64-PC
Became Account: sbennett
Became Domain: TRUENAS
Became Sid: S-1-5-21-1439876373-3511943717-879940562-20071
Mapped Account: sbennett
Mapped Domain: MicrosoftAccount
Netlogon Computer: Null
Netlogon Trust Account: Null
Netlogon Negotiate Flags: ‘0x00000000’
Netlogon Secure Channel Type: 0
Netlogon Trust Account Sid: Null
Password Type: NTLMv2
Client Policy Access Check: Null
Server Policy Access Check: Null
Vers:
Major: 0
Minor: 1
Result:
Type: NTSTATUS
Value Raw: 0
Value Parsed: SUCCESS

Not sure how to run testparm so I ran it in the shell with this result:

truenas_admin@truenas[~]$ testparm -s
Load smb config files from /etc/smb4.conf
regdb_init: Failed to open registry /var/run/samba-cache/registry.tdb (Permission denied)
Failed to initialize the registry: WERR_ACCESS_DENIED
error initializing registry configuration: SBC_ERR_BADFILE
Error loading services.

Run that command with sudo in front of it. sudo testparm -s

1 Like

Is file being copied using File Explorer or some 3rd-party file manager? I’ve seen some of latter do not properly implement file copying. This was the case for the last bugticket someone opened about this issue. We can’t do anything if the developer isn’t using the correct windows APIs for copying files.

IIRC some endpoint protection software may also force copies to go through client.

1 Like

That’s better:

truenas_admin@truenas[~]$ sudo testparm -s
[sudo] password for truenas_admin:
Load smb config files from /etc/smb4.conf
Loaded services file OK.
Weak crypto is allowed by GnuTLS (e.g. NTLM as a compatibility fallback)

Server role: ROLE_STANDALONE

Global parameters

[global]
bind interfaces only = Yes
disable spoolss = Yes
dns proxy = No
load printers = No
logging = file
max log size = 5120
passdb backend = tdbsam:/var/run/samba-cache/private/passdb.tdb
printcap name = /dev/null
registry shares = Yes
restrict anonymous = 2
server multi channel support = No
server string = TrueNAS Server
winbind request timeout = 2
idmap config * : range = 90000001 - 100000000
fruit:zero_file_id = False
fruit:nfs_aces = False
idmap config * : backend = tdb
create mask = 0664
directory mask = 0775

[data_samba]
ea support = No
path = /mnt/DataPool/data_samba
posix locking = No
read only = No
smbd max xattr size = 2097152
vfs objects = streams_xattr shadow_copy_zfs ixnas zfs_core io_uring
tn:vuid = 97e9e538-bd42-4ae4-a06b-71e0741bc9ce
fruit:time machine max size = 0
fruit:time machine = False
nfs4:chown = True
tn:home = False
tn:path_suffix =
tn:purpose = DEFAULT_SHARE
truenas_admin@truenas[~]$

Using TeraCopy 3.17 from TeraCopy for Windows - Code Sector which is also available in the Microsoft Store so I assume MS must approve it?

OK. Probably just poor design for the application (e.g. using wrong Windows APIs). Do you see the issue if you just use File Explorer?

BTW, when you’re using 3rd-party applications to cause the issue it’s generally important to disclose that in the initial post :wink:

6 Likes

Problem solved thanks, removed TeraCopy and now large file copy is almost instantaneous, I had to copy several Gb files to even see the HDD light on the TN server come on. Thanks for the tip re 3rd party apps I should have thought to mention it. To test just copied 130Gb file in less than 60s so that’s definitely not going via the network :smiley:

4 Likes

Right. You’d think that details such as using the correct APIs would be important for developers of tool for copying files.

Generally whenever I approach a task on a particular OS, I first try to accomplish it using vendor-provided tools. The vendor will typically make sure it’s using latest APIs / improvements, and you don’t have to worry as much about supply chain attacks and other problems that crop up with 3rd parties.

5 Likes


Does this help?
(t is child of /)

1 Like

THis is your data path:
image
/mnt/DataPool/data_samba

1 Like

Yes thanks, I could not see /mnt when mc opens but I did File > Quick CD and added /mnt and it then appeared and I could click into it to find all my files. I got stuck assuming that /mnt would be listed when mc opens, or at least would be a sub folder of those locations that are listed. I’m not a Linux expert as you can guess. Anyway problem solved but useful to know about MC.

Chiming in after seeing this thread in my weekly TrueNAS community digest - interesting discovery with Teracopy, I’ve always found it to be a pretty reliable tool.

I might try testing it later on my TN CORE server later if there’s interest in that but for now, I found this feedback on the developer’s website highlighting this issue, so it’s not just you @stevenbennett :

SMB Server Side Copy / FSCTL support - Code Sector

2 Likes