Q:

Rsync to remote server with mounted NFS USB

I am trying to rsync one file from server X to server Y.
In the server Y, there is a mounted dir /mnt/myDir, where I am trying to sync that file.  The goal is also to keep the full path of the file. 
I am trying to do this with:
sudo -u www-data rsync -avz /var/www/dms/test/test.tif user@server.com:/mnt/myDir/var/www/dms/test/test.tif

But this is triggering the following error:
sending incremental file list
rsync: change_dir#3 "/mnt/myDir/var/www/dms/test" failed: No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(643) [Receiver=3.0.9]
rsync: connection unexpectedly closed (241 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]

A:

The error arise from the fact you are trying to sync into a directory which does not exist on the remote side. 
You have the following possibilities:

first create the dir on the target directory issuing mkdir /mnt/myDir/var/www/dms/test (on the remote side), then issue your rsync command
elaborating on that, if you need to transfer the entire /var/www directory, you need to create the remote /mnt/myDir/var/www dir and the issuing something similar to sudo -u www-data rsync -avz /var/www/ user@server.com:/mnt/myDir/var/www
alternatively, you can instruct rsync to do the entire work for you, using the -R (--relative) option and issuing something as sudo -u www-data rsync -avzR /var/www/dms/test/test.tif user@server.com:/mnt/myDir/. In this case, be sure to read the man page as -R can have some unexpected side-effects.