Back in February, 2011, we purchased a Synology DS1511+ Diskstation NAS device, along with six Western Digital Caviar Green WD20EARS 2TB SATA 3.0Gb/s drives. We installed five of the drives (one is a spare) into the DiskStation and configured it as RAID 5 storage. At the end of the day we got 8TB of effective storage for $1449.00 or a per GB cost of $0.18. If we amortize across three years, then that’s a raw cost of $0.06 per year. Of course, there is networking expense to be considered as well. To connect the NAS to the network, we pay $21 per month for each of the two Gig-E ports. In our case, across the three year anticipated life-cycle, we see an additional $1512 in networking fees. This doubles the per gigabyte cost to approximately $0.13 per year. To purchase storage from the University would cost us $0.65 per GB per year. Of course, University storage is on an enterprise-class EMC Isilon system and comes with 24 hour monitoring, real server rooms, monitoring, monitoring, etc. There is really no comparison. However, for certain use cases, the Synology box is pretty compelling.
We’ve been really pleased with it; we primarily use it for storage of images of systems that we plan to deploy using Clonezilla or for second-tier storage of video files. It works very well for those purposes. We are currently running the Synology DSM 3.2 software. It provides a nice web-based GUI sitting on top of a custom Linux.
We generally share it out via SMB, but it supports FTP, SSH/SFTP, and NFS, among other things.
Recently, I was looking for some additional peace of mind with regard to a MySQL database. The database is backed up elsewhere as well, but I’ve been having some issues with it and wanted one more copy, just in case. Jason Knight previously created a backup script that uses mysqldump to make backups of various MySQL databases on the server. The script then saves the files as tar.gz archives and rotates them, so that the last few are kept. What I needed was a way to copy those files over to the Synology box.
I needed a solution where the database server initiated the contact with the backup machine because of some firewall issues. I decided to turn on the Synology’s support for using it as an RSync server. Setting up the DSM-1211+ as an Rsync server involves the following steps:
You need to enable network backup and you need to turn on Rsync Backup Mode. You need to create a user called “rsync” and you need to add that user to the admin group on the Synology box. You have to give rsync permissions to the NetBackup share (created by default by DSM). So far, this is straightforward stuff. However, it DSM 3.2, there is a bug (or at least it feels like a bug to me), whereby the “rsync” user’s password is not stored in plain text on the DSM server. Unfortunately, these crypted passwords are not supported and will cause the backup to fail.
To fix this issue, you will need to ssh into the diskstation as the root user (same pass as the admin user). Once there, I had to edit the /etc/rsyncd.secrets file. The passwords in the rsyncd.secrets are hashed, but need to be plain text. Delete the hashed password and replace it with a plaintext password. Verify that the mode on the file is 600 (u+rw). You will have to decide whether you can live with the rsync user’s password being stored in plain text in the /etc/rsyncd.secrets file.
Once this change is made, you should be able to rsync from the Linux MySQL database server to the Synology box running DSM. Here is a sample command to rsync a directory (“/opt/db_backup/”) to the NetBackup “module” on the diskstation:
/usr/bin/rsync -avr --delete --password-file=/root/diskstation-pass /opt/db_backup/ email@example.com::NetBackup
The password for the rsync command needs to be stored in the password-file listed on the command line above. It should be set 600 of course.
I added the above to root’s crontab on the database server:
0 2 * * * /usr/bin/rsync -avr --delete --password-file=/root/diskstation-pass /opt/db_backup/ firstname.lastname@example.org::NetBackup
This should trigger the rsync command at 2:00 a.m. every day.