Hacking The ReadyNAS

As you may know, I use a Netgear ReadyNAS RND4410 for my internal network’s mass storage. I’m very happy with the device, but it is a bit inflexible when it comes to back-ups.

The problem is that most forms of back-up that it provides for don’t support the deletion of files that are no longer on the source. For example, if file A and B were backed up last night, but file A was deleted on the source by somebody this morning, tonight’s backup should back up only file B (and even then, only if it has since changed) and delete file A from the back-up destination.

This level of control calls for the common free software program, rsync, to be used for back-ups. The ReadyNAS does support rsync, but Netgear’s interface to it via the Web-based FrontView software is less than ideal. That’s because it doesn’t allow one to specify the use of rsync’s many optional flags and parameters. In particular, it doesn’t allow the essential --exclude flag to be used to omit certain directories from the back-up. I’m not being picky; I actually have a back-up job that will fail without the use of this flag.

Happily, though, the ReadyNAS is Linux-based and Netgear nowadays provide an EnableRootSSH patch, which will, oddly enough, allow you to ssh into your ReadyNAS as root.

I’d been resisting the temptation to do this for some time, because I had no good reason to do so. The ReadyNAS is sold as an appliance and one isn’t really supposed to go prodding at its internals. The potential for rendering one’s device non-functional is definitely there. Of course, I know what I’m doing (famous last words, I know), but I still have a healthy respect for devices supposed to operate as black-box appliances.

Nevertheless, I needed more flexible rsync functionality for my back-ups. An alternative to poking around on the Netgear would be to schedule the back-up jobs on the clients themselves, pushing the data to be backed up to the ReadyNAS instead of having the ReadyNAS run the back-up job and pull the data from the clients.

I wanted my back-ups centralised, however, so I installed the EnableRootSSH patch and went gently wandering across the file-system.

I found what I needed and was able to add the functionality I needed with 15 lines of Perl. Now, it’s possible to define a set of extra options to be passed to an rsync back-up job when it’s invoked.

I’ve posted details of how to do this to Netgear’s ReadyNAS forum, so I won’t repeat them here. I mention the hack here only to gain a bit of publicity for it, as I’m sure I’m not the only person who needs this extra functionality.

Of course, a much better solution would be for Netgear to integrate this into their FrontView Web-based interface. I’d much rather be able to use the supplied tools than have to resort to hacks like this.

Still, at one level, it is nice that Netgear have allowed this kind of thing to be done. It encourages experimentation, development and user community growth.

This entry was posted in Hacking, System Administration. Bookmark the permalink.

5 Responses to Hacking The ReadyNAS

  1. Carl Hutzler says:

    Thanks for your information and PERL script. I just implemented it on my client’s readynas machine to have rsync operate on a different port and with a bandwidth limiter. This method (changing the backup perl script) works much better than my first attempt of just inserting a small shell script in in cron.daily.

    http://carlhutzler.com/blog/

  2. Jared Leinach says:

    I just read the details you posted on the ReadyNAS forum and made the below query to you there before realizing this would be more likely to find you:

    I am in a similar boat: I totally agree with you about the purpose of appliances (and the need to not void rights to tech support as well), but i need to get my ReadyNAS to run rsync with parameters that I can’t control through FrontView.

    Your solution is about as uninvasive as it gets so I am preparing to ride on your coat tails (thanks again for bothering to post the solution). I just wanted to see if you had run into any problems since implementing this before I jump in.

    Also, I actually need to get FrontView to STOP adding the “-l” paramter because the rsync server i’m backing up to (from the ReadyNAS) is ibackup and their server rejects connections with this parameter (a documented feature). I’m not familiar with perl at the moment so it’s not clear to me if this will be doable/easy.

    Thanks in advance for any feedback you can offer.

  3. ianmacd says:

    Yes, sorry, I don’t ready the ReadyNAS forum on a daily basis.

    Nevertheless, I’ve posted a reply to your message there.

  4. Dennis says:

    I saw above that you don’t read the ReadyNAS forum everyday, so I’ll ask here what I posted in reply to the forum:

    I’d like to implement this on my ReadyNAS, but /frontview/bin/backup on mine is a compiled file:

    readynas:/etc# file /frontview/bin/backup

    /frontview/bin/backup: perl script text executable

    My NAS is a ReadyNAS Pro Business Edition with RAIDiator 4.2.4

    Any suggestions where I should look for the raw perl code?

    Thanks!

  5. ianmacd says:

    “perl script text executable” doesn’t mean that it’s compiled code. It’s executable, but it’s interpreted code.

    In other words, that’s the correct file to edit; also for your system.

Leave a Reply

Your email address will not be published. Required fields are marked *