Need help on how to install Rsnapshot on FreeNAS

Status
Not open for further replies.
Joined
Sep 3, 2013
Messages
2
Hi,
I have been using Rsnapshot on a Ubuntu based file server for years and it has been working great for me. Rsnapshot logs on to my other machine and backs up their content on the Ubuntu file server. I now intend to migrate my server to FreeNAS and I am really exiting about the data integrity features of ZFS. My question is how can I install Rsnapshot on FreeNAS? I searched everywhere on the internet and I found nothing. Anyone can help?
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Install it in a jail. You can't install anything to the OS drive

Sent from my Nexus 5
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
There are tutorials on how to install programs in jails, including the official documentation. Please spend a little time familiarizing yourself with the forums and the documentation
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, there's not going to be a tutorial for something like that(referring to rsnapshot in particular). The jail is FreeBSD(or linux if you want to use a linux jail) so you're talking about stuff that is beyond the scope of the forum.
 

clownphish

Dabbler
Joined
Dec 9, 2012
Messages
33
I'm sure some people will tell you not to do it this way and how it's better in jails, etc. Having said that, this is what I do and it has worked happily for me for over 6 months (and I have successfully restored files in this time).

IMHO, running rsnapshot to do backups in a jail has a host other issues like permissions problems, how you backup your freenas database that lives under /data on the USB stick, etc. This is nice and simple and it has the plus that you can use the cron feature of the FreeNAS GUI and the built in alerting, etc. The downside to this method is you have to re-add it every time you upgrade. Disk space usage here is about 1MB on the USB stick so pretty negligible.

In essence, it's as simple as temporarily mounting the root partition in read/write mode and adding the package:
Code:
mountrw /
pkg_add -r rsnapshot


On older version this was all that was needed. Since 9.2 it looks like there's some dependency issues which are always fun. In this case:
Code:
pkg_add: warning: package 'rsnapshot-1.3.1_1' requires 'rsync-3.1.0_1', but 'rsync-3.0.9_3' is installed


I solved this by removing the older version of rsync and replacing it with the newer one on the assumption that it is backwards compatible.


Code:
pkg_delete rsync-3.0.9_3 rsnapshot-1.3.1_1
pkg_add -r rsnapshot


At this point you should re-mount the root system as read-only. My preference hear is to reboot to ensure everything comes up clean.

You need to configure your rsnapshot config files now as normal. You should definitely save these somewhere else (e.g. in your pool). I have a separate hard disk under /mnt/system/ and I have a directory for storing the rsnapshot config and log files.

After this, log into the GUI and add the cronjobs on the schedule you want and as per the rsnapshot documentation. Use nice to set the priority to be lower than normal as rsync is CPU hungry and it is, after all, a backup job.

e.g.
Code:
nice -19 rsnapshot -c /mnt/system/rsnapshot/rsnapshot.conf daily
nice -19 rsnapshot -c /mnt/system/rsnapshot/rsnapshot.conf weekly

etc

As always, take a backup of your config before you do any of this. One of the great features I've been impressed with on FreeNAS is how easy it is to restore your configuration if you have backup (get a new USB stick, load FreeNAS on it, boot it and restore your config and you're away).

Good luck.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You are installing rsnapshot on the FreeNAS installation? wow.. talk about playing with fire!
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, but you realize FreeNAS expects to have so much free space available.. and if it doesn't have it has..... problems. The manual specifically says not to install anything on the FreeNAS install and to use jails for any software you plan to install.
 

clownphish

Dabbler
Joined
Dec 9, 2012
Messages
33
I'm sure some people will tell you not to do it this way and how it's better in jails, etc
As I expected ;-) Although, I do agree it's not recommended. Running out of space definitely sounds bad. On the flip side, it is only 1MB and it solves an awful lot of other problems. At the end of the day, it's your data...hopefully the OP can make an informed choice having read the above.

Alternatively, I did find an article where someone else had a method using symbolic links to achieve a similar thing with wget. This could be a better method than installing it on the FreeNAS partition but I haven't tested it. Still requires modifying the root partition, but I guess it's a few bytes of symbolic links vs 1MB of files, if that makes you feel happier.

If anyone has a better idea of how to overcome the challenges of performing an rsnapshot backup from a jail I'd be interested. The one that springs to mind immediately is "how do you deal with permissions on the host system from within a FreeNAS Jail?" e.g. /data directory on the FreeNAS image, any user data that has permissions your jail user running the backup might not have access to, etc.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Why the hell would you need to worry about permissions on the host system? Run the entire thing in a jail on your pool and call it a day.
 

clownphish

Dabbler
Joined
Dec 9, 2012
Messages
33
Why the hell would you need to worry about permissions on the host system?
On further playing with this, it seems my concern about permissions was unfounded. I thought root in a jail wasn't equal to root on a host system and there'd be issues with the jail backing up files owned by root on the host.

Run the entire thing in a jail on your pool and call it a day.
If you do this then everything you want to backup has to be added as a NULLFS mount into the backup jail before you can run the backup. It's not a simple case of adding the pool at the root level because you get an error:

Code:
Mar 25 03:16:47 freenas manage.py: [middleware.exceptions:38] [MiddlewareError: The path could not be mounted /mnt/pool: Mount failed (64) -> mount_nullfs: /mnt/pool (/mnt/pool) and /mnt/pool/jail/backup/media/pool_backup are not distinct paths ]

In this example, my backup jail is called 'backup' and lives under the jail root of /mnt/pool/jail

I presume this is because you're referencing the jail itself and it'd create a recursive reference. Anyway, this means you'd have to add every volume and jail you've got under /mnt/pool (excluding your backup jail) and remember to keep adding them if you want them backed up. I'd rather a solution that backs up new volumes and jails without my intervention.

Being able to run a backup of your FreeNAS natively (i.e. outside a jail) makes way more sense to me, even if the method could be improved to be achieved in an officially-supported way (not by adding additional packages to the FreeNAS installation).

Anyway, I think I've got mine running now by installing the rsnapshot package and dependencies under my pool and linking to it as opposed to installing directly to the FreeNAS installation. If anyone is interested I'll post it.
 

SSPI-itd

Cadet
Joined
May 30, 2014
Messages
1
Hi clownphish. I'm interested to know your solution on linking as opposed to installing directly to FreeNAS. Could you post it or email to me.

Thanks!
 
Status
Not open for further replies.
Top