Adding an rsync server to the Brennan B2

508 views
Skip to first unread message

Tony

unread,
Mar 10, 2018, 5:54:01 PM3/10/18
to Brennan Forum
I've created a script that adds an rsync server to my Brennan B2.   Thanks to Martin Brennan for allowing me access to the buildroot configuration used to create the Linux version used by the B2.

Why rsync?  

Well, it's because I have rsync running on all the computers at my house to backup everything to a NAS file server (Synology DS201+).  Except my B2.

rsync does a really nice job of creating incremental backups. Only files that have changed since my last backup are copied from my various computers to my NAS. And each backup looks like a complete separate snapshot even though underneath there is only one copy of each unique file.  

So my backups are fast, complete, and yet disk space efficient.  And I run then automatically daily or weekly with no intervention required on my part. I have terabytes of videos, pictures, documents, music, etc. backed up.  And I can restore files going back years. Accidentally delete a photo and don't realize it for several weeks? No problem, just find the last snapshot that contained that picture and restore it.

All because of having rsync servers running on my various devices. And now on my B2 as well!

You can learn more about rsync via the links I've posted down below.

Warning : 
Installing rsync using my script requires using the Linux command line on your B2  via ssh - at least until Martin makes it a standard part of the B2.  The installation requires you to run as "root" on your Brennan B2 as "root" is the only configured user. When running as "root", you can easily delete critical files - or even all files- if you make a typing mistake.  A full backup of your music directories is strongly recommended before proceeding.  You should also be comfortable with downloading a new SD card image from the Brennan web site and installing it on the SD card in your B2 should things go completely wrong.


Files added to the Brennan B2 for rsync functionality

/usr/sbin/rsync              - the actual executable rsync client & server code
/etc/rsyncd.conf            - configuration for the rsync server
/etc/rsyncd.secrets       - user names & password for remote rsync access
/etc/init.d/S51rsync       - file that starts rsync in daemon (server) mode at boot

Notes : 
  1. The examples below use a example Brennan B2 IP address of 192.168.0.200.  Use the actual IP address of your B2 when you install the script. It will be visible on the scrolling section of the B2's OLED display when no music is playing.
  2. The password for rsync access is brennan and the rync user is b2.  You should change both in the /etc/rsyncd.conf and /etc/rsyncd.secrets files.
  3. There are two rsync shares available - one for music on the hard drive (if installed) and the other for music on the SD card (no hard disk installed). 
  4. The examples below assume a hard drive equipped B2 - use shareSD in place of shareHD for SD card only B2 models.
  5. When using actual artist, album, or song names that include spaces, use a \ before each space.  For example,  Jethro\ Tull/Thick\ As\ A\ Brick (note the forward slash / between the artist and song name)
  6. If you've come this far,  I'd also suggest that you change the root password of your B2. "Security through obscurity" is a proven flawed concept.

Obtaining the rsync installation script : (rsync_install.sh)

The rsync installation script was created using a tool from makeself.io  Running the script causes it to unpack the necessary installation file buried at the tail end of the script itself and then executing a setup script.

Download the script from here :  b2 rsync download link 

The md5sum check for the script  is : 44ba430943c7df3a1c4567cd47beeebe

Transferring the Installation Script to the Brennan B2

You can transfer the rsync installation script to your B2 several different ways.
  1. If you have NAS enabled in your B2, then simply copy the rsync_install.sh file across your LAN to the NAS share.
  2. If you want to use a USB stick, copy the rsync_install.sh file to the USB stick and plug that into USB port C on the B2
  3. Copy it across using this command from a Linux computer :  sftp -p ro...@192.168.0.200:/root <<< $'put rsync_install.sh'
It does not matter what folder you use on your B2 as long you can find the script. 

Running the Installation Script (rsync_install.sh)

Run the script by logging onto you B2 via ssh and changing into whatever directory holds the script. 
There are several script parameters you might want to try out in the order listed below.

./rsync_install.sh --help          -- gives all the script run choices
./rsync_install.sh --list       -- shows all the files that the script will install
./rsync_install.sh --info        -- shares information about the script build and contents
./rsync_install.sh --check       -- checks the integrity of the various files that will be installed
./rsync_install.sh --noexec    -- simulates the installation, but does not actually run the install script

Finally, use one of these two command lines to install the rsync server.

./rsync_install.sh                        -- installs the rsync server and support files, cleaning up afterwards
./rsync_install.sh --keep          -- installs the rsync server and support files, leaving the installation files laying around

Using the rsync server.

Once you have run the script, you an activate your rsync server by either restaring your B2 or by typing rsync --daemon from the ssh command line.

Then from your remote backup computer, try these commands :

rsync rsync://b...@192.168.0.200/                                                           -- rsync lists the two available shares on your B2
rsync rsync://b...@192.168.0.200/shareHD/                                           -- rsync lists of all your music artists, after you enter your password, 

rsync -aPv rsync://b...@192.168.0.200/shareHD/artist/            -- backup all albums & songs for specified "artist" (e.g. The\ Coors)
rsync -aPv rsync://b...@192.168.0.200/shareHD/artist/album/   -- backup all songs for specified artist & album 

rsync -aPv rsync://b...@192.168.0.200/shareHD/ .                               -- backup all songs from the Brennan to your PC

Note the period or dot at the end of some of the commands.

Note that the first time you backup all of your songs, it will take about 5 to 10 seconds per song (depending on the speed of your PC and your network).  
After that, only new music (or changes to existing files) will actually be backed up - total time usually only the 5 - 10 seconds per new song.

Here are some handy links if you want to know more about using rsync :


Rsync GUI clients

and lastly, the server based backup software that I use

Finally, there is no way for me to edit this post so check below for any corrections or clarifications.

HTH

mcg

unread,
Mar 12, 2018, 1:19:38 AM3/12/18
to Brennan Forum
Congratulations and thanks!  This is truly useful.  Let's hope that the B2 platform continues to become more open to this kind of innovation.

Brennan Support

unread,
Mar 13, 2018, 11:02:52 AM3/13/18
to Brennan Forum
Hi Anthony

Well done and thanks for all the work and for the copious documentation - I'm catching up after a mini break but I'll take a look in more depth - the makeself.io thing is interesting in its own right.

Martin

Grantski

unread,
Apr 2, 2020, 3:44:46 PM4/2/20
to Brennan Forum
Hello, is this still a valid tool to use? I am unable to download the shell script from any browser. 
thanks
Message has been deleted
Message has been deleted

Tony

unread,
Jul 24, 2020, 10:32:51 AM7/24/20
to Brennan Forum
I've moved the install script to a new site. 



Christopher Helmkamp

unread,
Jul 25, 2020, 8:39:23 AM7/25/20
to Brennan Forum
Thanks so much for sharing a new link to the install script.  Installation script ran smoothly on my Brennan B2, but can't get rsync to run.

All the installed files ended up in the right place except rsync (ended up in /usr/bin/rsync rather than /usr/sbin/rsync as indicated in the instructions).  Permissions look right and the file shows as executable, but when trying to run rsync from command line I get a file not found error.  S51rsync causes the same error when it runs on startup (line 8: rsync: not found).

Any idea what's going wrong?  Missing or incompatible libraries in a newer version of the Brennan build maybe? Thanks. --Chris

Tony

unread,
Nov 28, 2020, 5:25:51 PM11/28/20
to Brennan Forum
Sorry - missed this when first posted.  

On my B2 the rsync executable is in /usr/bin as well.   I can run it from there by just typing in rsync at my local command prompt. If I move the executable to /usr/sbin  that works too.  Not sure if it was a mistake when I wrote the docs or the script but it does not seem to matter either way.

As far as what else might be wrong, my B2 software is current and the rsync utility still runs properly.  However, AFAIK updating the b2 executable does not do anything to the underlying linux build so it's possible Brennan has bumped the OS revisions and left some libraries out.  Maybe a path error - can you get it to run when you use  /usr/sbin/rsync as the command?

Grantski

unread,
Feb 25, 2021, 7:30:11 AM2/25/21
to Brennan Forum
Thanks Tony, sorry I missed your reply last year and didn't say thanks back then.
Works a treat - I have a local server pulling a backup from the B2 each night if there are changes - then pushing to Google Drive with rclone for a perpetual backup,

all the best
Reply all
Reply to author
Forward
0 new messages