Did you know  45Drives offers free  public and private  webinars ? Click here to learn more  & register! Build & Price

KB450133 – Rsync Tutorial

You are here:

• Prerequisites: ssh access to your server containing your data, rsync and screen installed

• Start a screen session:

screen

• Build your rsync command. Here’s an example:

rsync -avhP --dry-run /my/local/files/ user@192.168.3.45:/mnt/Data/

Details on above:
rsync – starts the rsync program
-avhP – sets the various options for rsync. ‘a’ is archive, which will be recursive, follow links, and preserve permissions, owners, groups and timestamps. ‘v’ is verbose, so you can see the progress on screen. ‘h’ is human readable number formats, and ‘P’ shows progress on big files, and allows partially copied big files to be resumed.
–dry-run – this runs rsync in test mode; it will do everything except copy the files, so you can make sure all your settings appear to be correct.
/my/local/files/ – replace this part with the path to your directories on your server you want to copy to the host at 192.168.3.45
user@192.168.3.45 – this is the username and IP of the host you are sending the data to.
:/mnt/Data/ – is the destination path on the host. Advanced users may want to have it end up in several sub-folders, but you can also move things around once the sync completes.

• Once you’ve built your command, run it! It will ask for the password to your Fireball, so paste that in when requested. With –dry-run, rsync will try to run, but not actually copy any files. Look for any errors, and resolve them (might be locations, or passwords)

• If everything looks good, remove the –dry-run option and run it again. This time it will copy.

• If you need to interrupt it, use control-c. Rsync supports resuming, so you can re-enter the same command and it will recheck the already copied files, then resume with the remaining.

• If the copy is running, and you disconnect your ssh session, it will stop. This is where screen comes in to play. Screen allows processes to continue in the background. To suspend the screen session, use control-a, then ‘d’. If you see [detached] and are returned to your ssh prompt, you’ve executed it correctly. To later resume the screen session, type:

screen -r
Was this article helpful?
Dislike 0
Views: 1071
Unboxing Racking Storage Drives Cable Setup Power UPS Sizing Remote Access