Users of QNAP NAS devices have been asking for an out-of-the-box solution to backup to Rackspace Cloud Files for a few years now. There is already a tool in the QNAP Web UI for backing up your shares to Amazon S3, Elephant Drive, or Symform.

The best solution I have so far is utilizing Pyrax, the Python SDK for Rackspace public cloud. The cf_pyrax script makes use of the sync_folder_to_container function found in Pyrax to sync a directory to a Cloud Files container. Even though the QNAP NAS is Linux-based, a lot of the usual methods for installing packages and scheduling jobs do not apply.

Here is what I did to configure my QNAP TS-419P II for a scheduled backup to Rackspace Cloud Files.

Install Python 2.7

Navigate to the QNAP web interface and install the Python v2.7 .qpkg from the App Center.

Verify the Installation

Verify that Python 2.7 was successfully installed:

python --version

Install PIP

Install PIP 1.2.1:

curl -o https//
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
python install

If you get "ImportError: No module named setuptools", install setuptools first:

wget --no-check-certificate
tar xf setuptools-1.0.tar.gz
cd setuptools-1.0
python build
python install

Install Pyrax

I had some issues with the NAS running out of room on tmpfs when installing Pyrax so provide a cache path with ample space:

pip install pyrax --download-cache /share/path/to/directory

Grab the script from

Create a Credentials File

Create a credentials file with the following info:

username = myusername
api_key = myapikey

Test Sync

Your syntax to sync to a specific container should be as follows:

python TestContainer1 /share/MD0_DATA/testshare1 DFW /share/MD0_DATA/credentials.txt

Edit Crontab

After ensuring that the sync works properly, setup a cron job to backup your shares at a desired time.

QNAP overwrites crontab with etc/config/crontab after every system reboot/shutdown. You must modify this file if you want new cron job entries to stick:

echo "1 4 * * * python TestContainer1 /share/MD0_DATA/testshare1 DFW /share/MD0_DATA/credentials.txt" >> /etc/config/crontab
echo "1 4 * * * python TestContainer2 /share/MD0_DATA/testshare2 DFW /share/MD0_DATA/credentials.txt" >> /etc/config/crontab
crontab /etc/config/crontab


comments powered by Disqus