
UC-8100-LX Software Manual
General Debian Package Usage
5-12
45B
rsync
rsync is a utility software and network protocol that synchronizes files and directories from one location to
another while minimizing data transfer by using delta encoding when appropriate. It also has the option to
provide encrypted transfer by use of SSH. SSL encrypted transfer can be done via Stunnel wrapping. rsync uses
the 'rsync algorithm' which provides a very fast method for bringing remote files into sync. rsync can copy or
display directory contents and copy files, optionally using compression and recursion.
Using rsync for local backups
You can backup your data to secure data via rsync
We could backup our data in rootfilesystem - /Directory1 to expand storage microSD or USB - /Directory2.
moxa@Moxa:~$ sudo rsync -avP /Directory1/ /Directory2/
-v, --verbose increase verbosity
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-P --progress show progress during transfer
--partial keep partially transferred files
99B
Using rsync for External Backups
rsync can be configured in several different ways for external backups, but we will go over the most practical
(also the easiest and most secure) method of tunneling rsync through SSH. Most servers and even many clients
already have SSH, and it can be used for your rsync backups. We will show you the process to get one Linux
machine to backup to another on a local network. The process would be the exact same if one host were out on
the internet somewhere, just note that port 22 (or whatever port you have SSH configured on), would need to
be forwarded on any network equipment on the server’s side of things.
Other than installing SSH and rsync on the server, all that really needs to be done is to setup the repositories
on the server where you would like the files backed up, and make sure that SSH is locked down. Make sure the
user you plan on using has a complex password, and it may also be a good idea to switch the port that SSH
listens on (default is 22).
We will run the same command that we did for using rsync on a local computer, but include the necessary
additions for tunneling rsync through SSH to a server on my local network. For user “user” connecting to
“192.168.1.1” and using the same switches as above (-avP) we will run the following:
moxa@Moxa:~$ sudo rsync -avP -e ssh /Directory1/ [email protected]:/Directory2/
100B
Automating rsync Backups
Cron can be used on Linux to automate the execution of commands, such as rsync. Using Cron, we can have
our Linux system run nightly backups, or however often you would like them to run.
To edit the cron table file for the user you are logged in as, run:
moxa@Moxa:~$ sudo crontab -e
You will need to be familiar with vi in order to edit this file. Type “I” for insert, and then begin editing the cron
table file.
Cron uses the following syntax: minute of the hour, hour of the day, day of the month, month of the year, day
of the week, command.
It can be a little confusing at first, so let me give you an example. The following command will run the rsync
command every night at 10 PM:
Содержание UC-8100-LX
Страница 8: ...UC 8100 LX Software Getting Started 2 2...
Страница 38: ...UC 8100 LX Software Manual Security On UC 8100 LX 4 2...