Backup folders in Linux over rsync to Freenas disk
Goal: Backup your home partition or what ever folder you like to your network attached folder on freenas system over rsync.
Preparation - your freenas system should be properly configured, accessible over network and cifs/smb is working on it.
First test - try to access your smb share over dolphine or some other file manager.
Create folder which you will use to mount your samba share:
$ mkdir /mnt/freenas
Important part is to properly configure your mount point so ordinary user can mount it each time when needed and not just root user. This is important so your backup home files will preserve correct permission
Edit your /etc/fstab and add next lines
//192.168.1.10/backup1 /mnt/freenas smbfs users,noauto 0 0
or if you are using newer distro (like Kubuntu 12.10) then you need to use cifs file system
//192.168.1.10/backup1 /mnt/freenas cifs users,noauto 0 0
where 192.168.1.10 is my freenas machine local ip. Then reload mount table
$ sudo mount -a
Now you can mount this folder like a regular user - this is important so your backup home files will preserve correct permission
$ mount /mnt/freenas
We are now ready lets execute rsync command
rsync -azv --delete --log-file=/tmp/rsync-backup.txt /home/user/ /mnt/freenas/home_user/
Where rsync options are
- a - archive flag, so timestamps, permissions... will be preserved
- z - use compression when transfering files
- v - be verbose
- --delete - deletes files from target that are not there in a source directory.
- --log-file=file - specify log file
Thats it.
Resources
1 comment
rsync
Since FreeNAS is capable of being rsync server, why don't you try to use it's native protocol to backup ? Probably ssh compression will speedup things, for example.
P.S. By the way, nice guide, thanks.
P.P.S Beograd is the best !