3

I have a NAS embedded Linux device which has Samba4 installed and running. I have configured a samba share, and I am trying to do server-side copy within that samba share from a client. This is what I am trying to do: https://wiki.samba.org/index.php/Server-Side_Copy

  1. I first tried on Windows7. I first mount that samba share from my WIN7 laptop, and use robocopy command to copy a big file between two directories within that share. And I can see that works. The robocpoy is really quick to copy a big file. And I also analyze the network traffic using wireshark. It has something like: Ioctl req FSCTL_SRV_COPYCHUNK_WRITE File:... and Ioctl resp FSCTL_SRV_COPYCHUNK_WRITE File:...

  2. Then I tried on ubuntu15. I am pretty sure that ubuntu15's Linux kernel support CIFS_IOC_COPYCHUNK_FILE ioctl. I mount that share using: mount.cifs //[host_ip]/[share_name] [mount_path] -o vers=2.1,username=root. I am pretty sure it has to have vers=2.1 because to use server-side-copy it has to use SMB2 protocol. And again based on https://wiki.samba.org/index.php/Server-Side_Copy, it says "cloner" does this function. The key function here is to call: "ioctl(dst_fd, CIFS_IOC_COPYCHUNK_FILE, src_fd)". So I downloaded and compiled "cloner" and execute this command, but it does not work. Basically, the cloner command takes forever and never stop (kill -9 even not work). I use wireshark monitors network traffic as well. What I see is: It is sending the same request as Windows7 does which is Ioctl req FSCTL_SRV_COPYCHUNK_WRITE File:..., but it is getting an error saying: Ioctl response, Error: status_invalid_device_request

Why cloner on linux does not work, but robocopy on win7 works? Why it is getting Error: status_invalid_device_request? What is missing in cloner? If there is something missing here or a bug how to fix this? Is there any existing client side server-side-copy code or tool that I can use?

Shuo Dong
  • 61
  • 3

0 Answers0