Mount SMB Share on Synology DS1815+

We just received a new toy in our dry lab. I am talking of course about Synology DS1815+ NAS DiskStation. We are planning on using it as temporary storage for the ongoing projects in the lab and also we want to be able to back it up to Brown’s Long Term Storage samba share. After installing a couple of useful tools like nano and sftp, I decided to mount Brown’s long term storage (LTS) on DS1815+ automatically after each reboot. Here are the steps:

Login as root to your DS1815+

ssh root@xxx.xxx.xxx.xx 

Create credentials file:

nano /root/.servercred

Add the following lines to your credentials file:

user=username_goes_here
password=password_goes_here
domain=domain_goes_here_if_the_share_uses_it

open your rc.local

nano /etc/rc.local

Add the following lines before the exit 0 line:
line 1 makes sure the CIFS filesystem is initialized

sleep 2m  
mount.cifs //xx.x.xx.xxx/share_name /mnt/ -o credentials=/root/.servercred

I use mount.cifs as simple mount with option of inputing credentials does not behave correctly on DS1815+.

Now I only need to configure crontab with rsync so that every weekend the DS1815+ volume will be backed up to the mounted directory.

First create a small ash script:

nano /usr/local/backup_data.sh

Then copy the following lines into it:

#!/bin/ash
rsync -aLW -vvv --progress --no-compress /volume1/homes /mnt/share

Next, edit crontab:

nano /etc/crontab

and add a line:

0       1       *       *       6       root    /usr/local/backup_data.sh > /usr/local/cron.log

Last, update crontab

/usr/syno/sbin/synoservicectl --restart crond

That is it! Now you can use home directories created by the DiskStation and be sure that you have a copy on your long term storage samba share.