Saturday, October 20, 2012

Private File Sync and Synology

Keywords: Synology, CloudStation, ownCloud, Linux, DropBox alternative

Key points: 


  • Synology CloudStation
    • What is this and why would I need it
    • What are the limitations
    • How to hack
      • New User / Second instance
      • edit the SQLite file
  • Alternative
    • ownCloud
    • install on Synology
  • Conclusion

Synology CloudStation


 What is this and why would I need it

Info page here.

"Cloud Station makes it easy to sync and access your files anytime, anywhere. DiskStation becomes a secure cloud storage for documents, music, photos and video – whenever you add, remove or edit a file on one of your PCs, the change will automatically happen on other devices, including Mac and mobile devices (DS file). No more forgotten attachments or wrong files. Your files will always stay up-to-date wherever you go.
  • Sync files across PC, Mac, and mobile devices
  • Retain up to 30 previous versions and roll back to any version easily
  • View and access files even without Internet connection
  • Sync and share files among group members"
So, in short, you have your own DropBox replacement ... nice :)
The privacy and security are now my responsibility.

What are the limitations


There are two type of sync folders: Home and Shared. While Home folder is for personal use the Shared is intended to be used in groups.


  • No more than two Shared folders.



What ?? Why? ... have no idea


  • The Shared folders do not have versions
While you can see previous versions of your files in the Home folder the Shared folders do not have this feature :(

How to hack

  • New User / Second instance
You can always run a second instance of the application with a different user account so you can have more than one Shared folder and with versions. Let's make it more clear:
You need a Shared folder Family for your brother, cousin, grandma and you.
And you want to have your personal folder - only for you.
And you need another Shared folder only for you and your brother.
So: in the Synology web admin add the users Family and MeAndBro.
All family members install the CloudStation client with the user Family.
You and your brother have to run a second instance with the user MeAndBro
... and you can start a third instance with your own user...
Looks awful ... yep... but works.

  • Edit the SQLite file
There is a more interesting solution: manually edit the sys.sqlite file and add all the sessions :)
How:
The CloudStation client uses sessions. Once you are authenticated you have a session. If you do not unlink this session in the Synology CloudStation web admin interface it will keep working.
This is also a nice solution to add users to your Synology CloudStation service without giving them the user/password (good for companies). 
First authorize yourself and set up the sync folder for your first session.
Close the CloudStation client.
Copy the sys.sqlite from the CloudStation config folder to another place.. and maybe with filename session1.sqlite
The file is in your personal folder. In Mac this should be your ~/.CloudStation/db folder or similar. In Windows is %LOCALAPPDATA%\CloudStation\db or C:\Users\YOURUSER\AppData\Local\CloudStation\db
Now open the sqlite file with your favorite sqlite program. I used sqlitebrowser.
Make a backup of the original sys.sqlite if you need it later. Copy or export the session row from the session_table.
Now delete the sys.sqlite file in the db folder  Then start the CloudStation client - it will ask you again for settings. Write the user/pass for the next session that you need, like user MeAndBro. Once you have set it up and the sync works close the CloudStation client. Now make again a copy of  sys.sqlite and maybe name it session2.sqlite. Open it with the sqlitebrowser and you will see the new session in the session_table
Keep doing this for all the sessions you need.

At the end add all the sessions in one sys.sqlite file and copy this new file overwriting the original.
Be careful with the conn_id: this should be the id from the connections_table.
Start the application and you will see in the settings that now all your folders are syncing :)

Take a look at the connections_table in the sys.sqlite file - play with the settings and experiment. You will find out also that you can add second Synology server and sync a folder to it.... nice ?

This way you can just send a ready to use sys.sqlite file to your girlfriend and you don't need to share the password :D

I really hope that the Synology devs will not brake this nice feature.

Alternative

If you are up to use the Synology CloudStation to keep your files in sync with your family - you already know how to hack it - but don't forget that there are alternative solutions:

ownCloud

... "gives you universal access to your files through a web interface or WebDAV. It also provides a platform to easily view & sync your contacts, calendars and bookmarks across all your devices and enables basic editing right on the web. Installation has minimal server requirements, doesn't need special permissions and is quick. ownCloud is extendable via a simple but powerful API for applications and plugins.
ownCloud started with a keynote by Frank Karlitschek at Camp KDE’10 where he talked about the need of a self-controlled free and open source cloud."
ownCloud works on any, repeat, on any web server + PHP + MySQL.
... and it has Client app for Windows, MacOS and Linux !!! Yes, Linux. CloudStation client for Linux does not exist now.

It is Open sourced; It is stable; No stupid limitations... and runs on Synology :D :D :D

Thank you Eric Gielians !!! Danke!

- If there is a solution like this since more then a year why Synology have to reinvent the wheel?
- I really have no idea. Maybe they do not trust it and need proprietary solution and control... but, you know, they have to take into account ownCloud.

Install on Synology

Please read the post and follow the instructions.


Conclusion

Another drawback of CloudStation is the update: there is no autoupdate feature in the client app and you have to manually update it :( ... and the last update broke all the settings you have made and you have to AGAIN set up and sync all your files and folders !!! This can become a real nightmare if you have synced 8GB and/or your brother is on a trip in Greece :( :( :(

Make your conclusion, do whatever suits you and always try again ;)

3 comments:

  1. I just found a big pro for CloudStation and you will like it:
    CloudStation makes partial file transfer like rsync :)
    I just tested with 40MB bmp file:
    I changed a very little part of the file and the transfer was 0.4MB
    I did the same with the ownCloud client and the app transferred again the whole 40MB file ...

    ReplyDelete
  2. Hello Dani,

    Thanks for this very interesting post.

    Latest version of Synology CloudStation (4.2) released this month now enables sharing more than two Shared Folders over the cloud.

    However does still not enable keeping files change/deletion history in SharedFolders, while the feature is still there for users' home folders.
    For this reason, I looked for applying your SQLite editing method, which... however did not work: at the last step, when I reproduce the sessions in the final sys.sqlite (by making sure the conn_id is the correct one), then restart CloudStation client, sync status displays an error for all sessions that I added to the initial sys.sqlite file.

    => Did you try your method with latest CloudStation release? If yes is you method still working?
    (I fill the issue comes from the unique entry in the connection_table, which makes reference to one sessionID only...)

    Thanks for your feedback.
    Kind regards,
    Eric

    ReplyDelete
  3. Hi Eric :)

    No, I haven't tried with the latest version - it has now what I need and didn't have to try :)

    There is "change/deletion history in SharedFolders":
    - just open the web gui as THE admin and see in filestation :)
    ... yes this is also a little bug :)
    read my last post http://danis-laugh.blogspot.com.es/2013/03/cloudstation-new-version.html

    ReplyDelete