Tuesday, May 31, 2016

Keep rsync From Using All Your Bandwidth


Keep rsync From Using All Your Bandwidth


If you use the rsync utility to keep your backups synchronized from your database server over to your backup or secondary file server, you might want to prevent the script from using too much bandwidth. Here’s how.
The point of limiting bandwidth is to make sure your backup scripts don’t clog up the network connection between your web server and database server. Naturally, limiting the amount of bandwidth your backups are using is going to make them happen more slowly, but if you can deal with that, this is the way to do it.
Normally your rsync command will look something like this:
rsync -a /backup/folder user@host:/remote/backup/folder/
What you’ll want to do is use the --bwlimit parameter with a KB/second value, like this:
rsync --bwlimit=<kb/second> <source> <dest>
So if you wanted to limit transfer to around 5MB per second, you could use a command like this:
rsync --bwlimit=5000 /backup/folder user@host:/remote/backup/folder/
You’ll want to make sure to calculate the size of your backups, and figure out how long it’ll take to transfer them at a slower rate – it wouldn’t be very helpful if your backup script takes 12 hours to run, for example.
You can also use the ionice command to limit the amount of bandwidth your script uses, which will help keep your scripts from using too much disk I/O. It’s not quite as useful since you can’t set absolute numbers like you can with the bwlimit parameter, but it’s another thing you can consider.

Thursday, May 26, 2016

How to back up files from Mac to Synology NAS with Time Machine

How to back up files from Mac to Synology NAS with Time Machine


Overview

This article will guide you through the process of backing up data from your Mac OS X computer to a Synology DiskStation using Apple's Time Machine, a backup utility included in Mac OS X 10.5 and later.


1. Set up DiskStation to support Time Machine

Before setting your DiskStation as the destination for Time Machine, you'll need to login to DSM and change a few settings.

1.1 Create a user for Time Machine and set quota limit

  1. Login to DSM with an account belonging to the administrators group.
  2. Go to Control Panel > User and click Create.
  3. Enter a username (such as "Time Machine User") and specify a password. Then click Next.
  4. Click Next.
  5. Click Next.
  6. In this example, we'll back up data to Volume 1. However, we don't want Time Backup to occupy the entire volume, so we'll enable a usage quota. On the User quota setting page, click the box under Enable quota. Then enter a value in the Quota field. For example, we'll set a quota of 200 GB on Volume 1.
  7. Minimum Volume Space: We recommended you set a quota to prevent Time Machine from occupying your entire volume. In general, the quota should be at least two or three times the size of your Mac's hard drive or the amount of data to back up.
  8. Click Next.
  9. Click Next.
  10. Click Apply.
  11. Now we should have a user called Time Machine User. Please proceed with the following section to create a shared folder.

1.2 Create a shared folder for Time Machine backup

  1. Go to Control Panel > Shared Folder and click Create to create a shared folder.
  2. Enter a name for the shared folder (such as "Time Machine Folder") and select a location (if multiple volumes exist). In this example, we'll choose Volume 1 (the same folder we specified earlier when setting up the usage quota).
  3. Make sure "Time Machine User" is assigned read/write permission for the new shared folder. Click OK.
  4. Now you should see the newly-created shared folder.

1.3 Set the shared folder as Time Machine's backup target

  1. Go to Control Panel > File Services.
  2. Find the Mac File Service section.
  3. Check the box Enable Mac file service, and choose the shared folder you just created from the Time Machine drop-down menu.
  4. Click Apply to save settings.

2. Perform Time Machine Backup to DiskStation

This section will show you how to configure Time Machine to set DiskStation's shared folder as the backup destination. This process allows Time Machine to easily locate your DiskStation on the local area network and regard it as the backup disk. When the setup is complete, Time Machine will be able to start backing up data to the DiskStation.

2.1 Configure Time Machine to set DiskStation as its backup disk

  1. On your computer, choose Apple menu > System Preferences, and click Time Machine.
  2. If Time Machine is off, slide the switch to ON.
  3. Select the shared folder you just created.
    Shared folder doesn't appear? If your shared folder does not appear, try connecting to and mounting the shared folder via AFP. To do so, go to Finder > Connect to server... and enter the address of your DiskStation.
  4. Enter the username and password of the user you just created, and click Connect.
  5. Time Machine will start backing up data soon after.

3. More Information


If you would like to learn more about Time Machine, you can consult Apple's Time Machine support page.