How to do a Freenas local rsync over localhost
This article shows how easy it is to setup an rsync within a single Freenas server to an external disc.
This article shows how easy it is to setup an rsync within a single Freenas server to an external disc, to make a almost realtime safety copy of your source files on your Freenas server.
In the setup I have Freenas installed on a HP Microserver with a couple of discs installed and on a USB port (USB 3) an 2.5" external disc. Never rely on the external disc only and secure your source code or any other data that you never should lose on another backup, but that you already knew.
This article assumes version 9.1 of Freenas to be installed. And that you have your external drive connected and have a volume like "USB-External" created to this disc.
Step 1. Prepare the rsync module
The rsync module is the receiver of the rsync request. This is going to be the reference to the USB disc.
Now head to the menu "Services" and select "Add Rsync Module".
Once you have done that a window will open up where you can configure the module.
As you can see we are using IP address 127.0.0.1 (localhost) of the server itself.
In the Path you select the root of you USB disc or the root folder where the task should put its data. Why not selecting the source folder on the USB disc? Well if you do that it will put the folder name in the task under the selected folder. It would turn up to be something like "SourceVault/SourceVault" (example).
The Access Mode should be "Read and Write", otherwise nothing will happen.
As user you select "root", because the rsync task is in fact talking to itself.
In the group you put "wheel" and in "Hosts allow" you put "127.0.0.1/24", although I think that is not even required. But it always good to limit who can talk to this module.
Now save the module and it will show up in the Rsync Modules list in the Services menu of Freenas.
Step 2. Prepare the rsync task
The rsync task is the requester of the rsync task and communicates with the rsync module from step 1.
Now head to the tasks menu of Freenas. Select here "Add Rsync Task". You can also select "View Rsync Tasks" and create the task from the overview.
Now we configure the task.
The parameters are already configured in the image.
In the Path you select the folder that you want to sync with the remote module. So don't select here the USB Disc folder, but the actual folder to be copied.
As user you select "root", which corresponds with the just created module.
In the "Remote host" we put "127.0.0.1", for it will talk to itself.
In the "Remote Module Name" you put exactly the name of the created module, be aware that this is case-sensitive. The direction is "push", for you want to push it to the USB disc.
The frequency of the synchronization you have to configure to you own taste.
Now we go a bit down in this dialog and configure the other options.
Well just take over the options above or modify it to your own flavor.
Save the task and you're ready to go.
Final tip of experience
If initially your data is huge and has a lot of folders and files it is best to copy the data first within the shell of the program or with putty or another SSH client.
You can do than something like:
Modify this statement so that it corresponds with your own server configuration.