Table of Contents
XigmaNAS - Rsync Basic Client Backup Configuration
One of the handiest tools you'll ever have on Linux (and other *nix systems) is rsync. As the name implies, rsync is used to sync files on remote and local machines. You can use rsync to copy files to remote systems and back again, or to make backups to locally mounted hard drives.
A quick glance at the man page might be a bit intimidating though, so let's walk through some of the most commonly used options and see if rsync is right for you.
One word of caution before beginning: As an effective tool, rsync is great at moving data from one machine to another. If used incorrectly, though, it can also be an effective tool at overwriting data or deleting files. Be mindful of the fact that once files are deleted on Linux they're very hard if not impossible to recover, and that's probably the opposite of what you're trying to accomplish.
The first time you get ready to run an rsync command, particularly the first few times out, you might want to make use of the -n option (also --dry-run if you prefer the more verbose option name). This is to run through a trial run with no actual changes made.
Before deploying SSH you should be familiar with:
- Linux file and directory permissions.
- Mounting and detaching (unmounting) filesystems.
- Changing File Permissions and File Ownership.
Open a Terminal (Console, CLI) on your client PC and make sure you understand these commands:
- man mount
- man umount
- man chown
- man chmod
You can also look them up on FreeBSD.org's Man Pages.
Install XigmaNAS, if it isn't already installed.
Or you may run it from the CDROM as required for testing.
See SUG Section 2.2-Using XigmaNAS with the CDROM and a removable disk (LiveCD mode).
For details see SUG Section 6.7-RSYNC. Please note this document is meant to get you started. There are many different ways to configure and use rsync so this document only illustrates how to backup files from a client PC to your XigmaNAS server. This is probably the most common use of rsync and once you become familiar with it you will find many other ways it can help you.
1 - Enable Rsync, then select “Save and Restart”
2 - Configure a Module. It may help if you think of this as a kind of Share.
On this page you can create, delete or manage your Rsync Server Modules.
Name: This is a label for the module, and it will be used by the Rsync client to find and identify this shared, network resource.
Comment: Here you can add a comment to help describe your XigmaNAS Rsync Module.
Path: This is the path to the storage that is to be shared using Rsync. The format of this is /mnt/storagename where storagename is the mount point name. Click on at the end of the Path section. This will bring up a simple file system browser. Click the desired mount point and click “OK”. The mount point will be added to the Path.
List: If enabled, this option determines if this module should be listed when a client asks for a listing of available modules. Disable for hidden modules.
Access Mode: Select READ ONLY, Read/Write, or WRITE ONLY Access.
Adjust any other Parameters as necessary to suit your needs.
Click the “ADD” Button.
Click the “SAVE & RESTART” Button to write your changes to the XigmaNAS configuration file.
Verify Connection to Server
Connect your Client to the Network, and use PING to verify that you can reach the Server's IP Address. You can also try to open the NAS4Free WebGUI, if you are successful then you have a working connection.
Client Required Software Install
For your Client, Rsync will need to be installed, if it isn't already. On Ubuntu you can try:
sudo apt-get install rsync
In Windows you will need to download and install a client. There are many good choices, here are a few:
Some Rsync Command Options
- --delete : delete files that don't exist on sender.
- -v : Verbose (try -vv for more detailed information).
- -e “ssh options” : specify ssh as remote shell.
- -a : archive mode (same as -rlptgoD).
With this option rsync will: Descend recursively into all directories (-r), copy symlinks as symlinks (-l), preserve file permissions (-p), preserve modification times (-t), preserve groups (-g), preserve file ownership (-o), and preserve devices as devices (-D).
- -r : recurse into directories
- -z : compress file data
Rsync Usage Examples
The following commands are executed in an Ubuntu terminal or CLI.
- Backup one file:
rsync -a /home/larry/Downloads/Getting_Started_with_Ubuntu_10.04.pdf firstname.lastname@example.org:/mnt/mysata/GettingStarted.pdf
- Backup Multiple files using ssh:
rsync -v -a -e "ssh -l ldkraemer" /home/larry/Downloads/*.pdf email@example.com:/mnt/mysata/
Since rsync does not provide any security while transferring data it is recommended that you use rsync over ssh on any unsecured network. This allows a secure, encrypted remote connection. You will be prompted to enter your user-name and password unless you have configured key based authentication on both server and client.
File & User/Group Permissions: My system copied these files with the following attributes.
-rw-r--r-- 1 ldkraemer:admin 4858361 Jul 29 12:25 GettingStarted.pdf -rw-r--r-- 1 ldkraemer:admin 4858361 Jul 29 12:25 Getting_Started_with_Ubuntu_10.04.pdf
The examples shown here are very basic, you should consult rsync's documentation for more details.