No files have been transferred after rsync - linux

When I ran 'rsync' in the following way, no file has been transferred?!
rsync -rv -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /home/user/.ssh/myrsd.pem" /cygdrive/c/user/local/temp/somefolder root#xx.xx.xx.xx:/
terminal output:
sending incremental file list
sent 118 bytes received 26 bytes 96.00 bytes/sec
total size is 1,560 speedup is 10.83

rsync works only on deltas- meaning if a file already exists on destination folder, and it is identical to the file in the source - it won't be copied. only new/updated files will be transferred
so if all files are already there- rsync will have nothing to do

The culprit is the missing slash after the local folder - 'somefolder' in this case. It should be '/cygdrive/c/user/local/temp/somefolder/' instead of '/cygdrive/c/user/local/temp/somefolder'
In the former case the output shows no files after "sending incremental file list" while it will show the files transferred in the latter one.
sending incremental file list
xx/xx/myfile

Related

How to retrieve the size of a specific stream before doing sync

I'm working on a script and need to query the size of a specific stream before I do a sync to a local harddrive. The local unsynced folder is empty.
I know there is a p4 sizes and I have tried the following command
p4 -u TheUserName -p ExternalServerUrl -c MyWorkspace sizes -s //Path/To/Stream -H
But it seems to report my local storage (which is empty).
So the output I get is this:
//Path/To/Stream 0 files 0 bytes
-H 0 files 0 bytes
So how can I query the server for the size before actually doing the sync?
Thanks in advance for any feedback!
You need to use wildcards to refer to a set of multiple files (including a depot directory path):
p4 sizes -s -H //Path/To/Stream/...
Note that if the -H goes after the file path, it's treated as another file path, which is why your output included the line -H 0 files 0 bytes.
Another important thing to note is that the depot path corresponding to the stream name is not necessarily the same thing as the stream contents -- if the stream is a virtual stream, or if it has import paths, some or all of its files live under other depot paths. For your purposes you probably want to instead use a client-path syntax, which will correspond to everything in the workspace (i.e. everything mapped by the workspace's stream):
p4 sizes -s -H //MyClient/...
The other solution, which will also work if the local directory isn't empty, is to take advantage of the totalFileSize field in the tagged output of p4 sync:
p4 -Ztag -F "%totalFileSize% bytes (%totalFileCount% files)" sync -n -q

what options to use with rsync to sync online new files to remote ntfs drive?

i run a mixed windows and linux network with different desktops, notebooks and raspberry pis. i am trying to establish an off-site backup between a local raspberry pi and an remote raspberry pi. both run on dietpi/raspbian and have an external hdd with ntfs to store the backup data. as the data to be backuped is around 800GB i already initially mirrored the data on the external hdd, so that only the new files have to be sent to the remote drive via rsync.
i now tried various combinations of options including --ignore-existing --size-only -u -c und of course combinations of other options like -avz etc.
the problem is: nothing of the above really changes anything, the system tries to upload all the files (although they are remotely existing) or at least a good number of them.
could you give me hint how to solve this?
I do this exact thing. Here is my solution to this task.
rsync -re "ssh -p 1234” -K -L --copy-links --append --size-only --delete pi#remote.server.ip:/home/pi/source-directory/* /home/pi/target-directory/
The options I am using are:
-r - recursive
-e - specifies to utilize ssh / scp as a method to transmit data, a note, my ssh command uses a non-standard port 1234 as is specified by -p in the -e flag
-K - keep directory links
-L - copy links
--copy-links - a duplicate flag it would seem...
--append - this will append data onto smaller files in case of a partial copy
--size-only - this skips files that match in size
--delete - CAREFUL - this will delete local files that are not present on the remote device..
This solution will run on a schedule and will "sync" the files in the target directories with the files from the source directory. to test it out, you can always run the command with --dry-run which will not make any changes at all and only show you what will be transferred and/or deleted...
all of this info and additional details can be found in the rsync man page man rsync
**NOTE: I use ssh keys to allow connection/transfer without having to respond to a password prompt between these devices.

Windows to Linux (Rsync and SSH)

I'm new to rsync, so my problem is probably obvious.
I'm trying to backup the folders in Windows Pictures to a remote Linux directory.
This is what I have:
rsync -av ssh /cygdrive/c/users/Owner/Pictures blah#192.168.1.10:/var/files/ImageSync
I got this format from: Transferring from Windows to Linux with rsync
But I am getting this error:
rsync: link_stat "/home/Owner/ssh" failed: No such file or directory (2)
rsync: change_dir "/cygdrive/c/users/Owner/Pictures" failed: No such file or directory (2)
sent 20 bytes received 12 bytes 64.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.1]
I have an ssh key pair already linked up, so there is no need for a password... Unless I did something wrong and that's why I am having issues.
Thanks!
Note:
Had to manually open cygdrive through cd and ls. It works!
rsync -av -e ssh /cygdrive/c/Users/Owner/Pictures/ blahc#192.168.1.10:/var/files/ImageSync/
I think you may need a "-e" ahead of ssh:
rsync -av -e ssh /cygdrive/c/users/Owner/Pictures blah#192.168.1.10:/var/files/ImageSync

rsync not copying my files

I was trying to use rsync to only copy the .c files from a given directory. Therefore I tried this command:
rsync -nrv --include="*.c" --exclude="*" test/ temp/
The output:
sending incremental file list
test1.c
test2.c
sent 63 bytes received 18 bytes 162.00 bytes/sec
The data I wanted to be copied was found, but when I check 'temp', it is empty.
I also tried to let rsync create the directory and the output is the following:
sending incremental file list
created directory temp
./
test1.c
test2.c
sent 66 bytes received 21 bytes 174.00 bytes/sec
But when I check for the directory 'temp', it doesn't exist.
What am I doing wrong?
you gave -n, which means "dry run"!
remove the -n
you should at least check man page for the options you used, to understand the meanings:
-n, --dry-run perform a trial run with no changes made

Why this file do not get downloaded into a specified location?

I am downloading the file in this link. I am using Ubuntu 12.04 and I used the below command to download it.
wget -p /home/ubuadmin/CUDA http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_32.run
Below is my command line input and output.
root#ubuserver3:/home/ubuadmin# wget -p /home/ubuadmin/CUDA http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_32.run
/home/ubuadmin/CUDA: Scheme missing.
--2014-03-11 08:06:28-- http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_32.run
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 23.62.239.35, 23.62.239.27
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|23.62.239.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 686412076 (655M) [application/octet-stream]
Saving to: `developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_32.run'
100%[======================================>] 686,412,076 663K/s in 16m 56s
2014-03-11 08:23:24 (660 KB/s) - `developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_32.run' saved [686412076/686412076]
FINISHED --2014-03-11 08:23:24--
Total wall clock time: 16m 56s
Downloaded: 1 files, 655M in 16m 56s (660 KB/s)
It says the download is completed but I can't find the file in that folder. I am accessing this server remotely using PuTTY, and using WinSCP to see the file structure. What has gone wrong? Why is it missing even it is downloaded?
To set the target folder, use -P (upper case) instead of -p.
From man wget:
-P prefix
--directory-prefix=prefix
Set directory prefix to prefix. The directory prefix is the directory
where all other files and subdirectories will be saved to, i.e. the
top of the retrieval tree. The default is . (the current directory).
cd /home/ubuadmin
mkdir test
cd test
wget http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_32.run
after use this command
stat cuda_5.5.22_linux_32.run
and show output
The "p" needs to be capitalized. Keep in mind Linux is case sensitive in most aspects.

Resources