Macos – Rsync for syncing 4TB from SMB to USB Volume ‘Hostnameproblem’

file-transferfilesystemsmacosrsyncsmb

I've got a problem with rsync (3.1.2.) on a MacOS 10.11.6, because I don't know how to enter the hostnames correctly. My approach was this:

$ sudo rsync -vaE --progress smb://company-nas/old_Projects/old_Projects_11 /Volumes/old_Projects_11

and what I get is:

ssh: Could not resolve hostname smb: nodename nor servname provided, or not known
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.2]

Best Answer

rsync does not support SMB itself. The URL you specified was most likely copied from some file management tool. It won’t work.

Instead, you have two options:

  • If you have to use SMB, you have to mount it.
  • If you have SSH access to the file server, you can use rsync’s native protocol (over SSH) to transfer the data.

SMB

Just browse to the share in Finder. As soon as it appears on the Desktop, it’s mounted at /Volumes/<whatever>. Probably something like /Volumes/old_Projects/old_Projects_11. This path can be used with rsync.

On Linux, you’d have to install the “cifs-utils” package (or something equivalent) and mount it manually:

mount -t cifs -o username=<username>,password=<password> //company-nas/share /mnt/my-mount-point

SSH

If you have SSH access to the file server and it has rsync available, you can use rsync’s own protocol, which may be much more efficient when you’ll have to resume the transfer at some point.

rsync -e ssh your-user@company-nas:/path/to/share /Volumes/old_Projects_11

You will then be prompted for your-user’s password and the process will start.

Important: Instead of the share name, you’ll need the full path to the shared folder.

Related Question