Backing up Windows computers to a Synology NAS via SSH and rsync. I recently purchased a Synology DS1. NAS (network attached storage) for my home network. The 5- drive, Linux powered device is beautiful – small, sleek and quiet. What sold me was the amazing web- based configuration interface they provide, and the ability to access the device remotely via the web or from mobile apps Synology provides in the i. Tunes App Store and Android Market. After setting it up with a couple 2. ![]() TB and 3. TB drives, I wanted to use the device to backup documents from several Windows computers I manage (my own, my wife’s netbook and my parents’ computers thousands of miles away). Local network backup is pretty easy – you can use the Synology Data Replicator to backup Windows hosts to your Synology on your local network. However, it seemed pretty slow to me, and doesn’t use the highly- optimized rsync protocol for backing up files. Since I was previously using rsync over SSH to a Linux server I run at home, I figured since the Synology was Linux- based, it should be able to do the same. All it takes is a few updates to the Synology server, and a few scripts on the Windows computers you want to backup to make this work for both computers on your home network as well as any external computers you want to backup, as long as they know the address of the remote server. You can use a dynamic- IP service such as TZO. Late 2011 and early 2012 benchmarks using an SSHD consisting of a 750 GB HDD and 8 GB of NAND cache found that SSHDs did not offer SSD performance on random read. DD-WRT is free Linux-based firmware for several wireless routers, most notably the Linksys WRT54G (including the WRT54GL and WRT54GS) and Buffalo WHR-G54s,WHR-HP-G54.
Dyn. DNS. org so your remote Windows clients know how to contact your home Synology. Once I got it all working, I figured the process and scripts I created could be used by others with a Synology NAS (or any server or NAS running Linux). I’ve created a Git. Hub repository with the scripts and instructions so you can setup your own secure backup for local and remote Windows computers: https: //github. Features. Uses rsync over ssh to securely backup your Windows hosts to a Synology NAS. Each Windows host gets a unique SSH private/public key that can be revoked at any time on the server. The server limits the SSH private/public keys so they can only run rsync, and can’t be used to log into the server. The server also limits the SSH private/public keys to a valid path prefix, so rsync can’t destroy other parts of the file system. Windows hosts can backup to the Synology NAS if they’re on the local network or on a remote network, as long as the outside IP/port are known. NOTE: The backups are performed via the Synology root user’s credentials, to simplify permissions. The SSH keys are only valid for rsync, and are limited to the path prefix you specify. You could change the scripts to backup as another user if you want (config. Synology NAS Setup. Enable SSH on your Synology NAS if you haven’t already. Go to Control Panel – Terminal, and check “Enable SSH service”. Log into your Synology via SSH. Create a /root/. ssh directory if it doesn’t already existmkdir /root/. Upload server/validate- rsync. Then chmod it so it can be run: chmod 7. Create an authorized. Cygwin can be used to accomplish this. You can easily install Cygwin from http: //www. After installing, pluck a couple files from the bin/ folder and put them into the client/ directory. The binaries you need are: chmod. You may also need a couple libraries to ensure those binaries run: cygcrypto- 0. This can be useful if you have a VCS repository that clients can connect to. It allows you to make remote changes to the backup scripts, and have the clients get the updated scripts without you having to log into them. The scripts are updated each time start- backup. For example, you could use this command to update from a svn repository: vcs. Update. Cmd,svn up. If you are using a VCS system, you should ensure you have the proper command- line . I’ve used Collab. During client setup, you simply need to log into the machine, checkout the repository, and setup a scheduled task to do the backups (see below). Each time a backup is run, the client will update its backup scripts first. The client package is now setup! If you’re using %vcs. Update. Cmd%, you can check the client/ directory into your remote repository. Client Setup. For each client you want to backup, you will need to do the following: Generate a private/public key pair for the computer. You can do this by running ssh- keygen. It should look something like thiscommand=. The following DOS environment variable is available to you, which is set in config. Root. Path% - Remote root rsync path. You should set rsync. Path to the root remote rsync path you want to use. For example: set rsync. Path=%rsync. Root. Path%/%COMPUTERNAME%orset rsync. Path=%rsync. Root. Path%/bob/%COMPUTERNAME%%rsync. Root. Path% is set in config. Synology backup volume (eg, /volume. Path% would evaluate to this if your current computer’s name is MYCOMPUTER: /volume. MYCOMPUTERYou can see this is the same path that you put in the authorized. The following DOS environment variables are available to you, which are set in start- backup. Standard. Opts% - Standard rsync command- line options. Connection. String% - Rsync connection string. For example: set cmd. Args=rsync %rsync. Standard. Opts% . If you are using %vcs. Update. Cmd%, you can checkout the client directory so you can push remote updates (see above). Setup a scheduled task (via Windows Task Scheduler) to run start- backup. Create the computer’s backup directory on your Synology NAS: mkdir /volume. MYCOMPUTERThe client is now setup! Source. As noted above, the source for these scripts is available on Github: https: //github. If you have any suggestions, find a bug or want to make contributions, please head over to Git.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
August 2017
Categories |