Siasync By Example

Thomas Grant Bennett
3 min readMay 29, 2019

--

Siasync is a new utility that will monitor a folder and synchronize its contents to the Sia network. As new files are created or removed it will keep Sia in sync with the local source folder. Siasync also supports more advanced features like only syncing certain file extensions, or excluding certain file extensions, or archive mode which won’t delete files from Sia even if they are deleted locally. Siasync works on Windows, MacOS, and Linux.

Read more about Siasync here!

Siasync doing its thing!

Logrotate Use Case

One of my favorite use cases for Siasync is to use it in tandem with Linux’s Log Rotate utility. Logrotate is a utility designed for administrators who manage servers producing a high volume of log files to help them save some disk space as well as to avoid a potential risk making a system unresponsive due to the lack of disk space. Logrotate is excellent, but what if you need to archive your logs for a long time. Siasync to the rescue!

#> Siasync -archive -include gz,zip,1, -subfolder logs /var/log/

Once a log file gets large, Logrotate will zip it up into a gz archive creating filenames like syslog.2.gz and auth.log.3.gz. By using the -include gz flag with Siasync we can tell Siasync to only upload zipped logs to Sia. This way we aren’t constantly uploading active log files to Sia, only once they’ve been zipped and compressed by Logrotate do we upload them.

The -archive flag tells Siasync that even if the archived logs are deleted from the server, keep them on Sia. We’ve now created a secure, distributed and inexpensive indefinite term Logrotate solution on Sia!

Note: By default Logrotate will often reuse filenames as it rotates logs, this can sometimes cause problems on Sia, I recommend you attach a timestamp to each log file so it has a unique filename.

Security Camera Footage Use Case

A few weeks ago I published an example of how I record the camera feed from the security cameras in my house into 15 minute chunks and upload them to Sia. This solution required that Sia be active and running if I wanted my footage to be uploaded to Sia. With Siasync I can now have my camera footage saved locally, and synced to Sia, providing a more robust, performant backup solution.

#> Siasync -archive -include mp4 -subfolder camfootage /tmp/cam1

Siasync will automatically detect any new mp4 files saved in /tmp/cam1 or its subfolders and upload them into a folder named “camfootage” on Sia. Using this method I could run Siasync once a week and have it upload the last weeks footage to Sia for archiving.

Media Backups Use Case

Of course Siasync can be used to keep a local folder 100% in sync with Sia. Suppose you wanted to backup your photos to Sia, but as you delete bad photos you want them to also be deleted from Sia. This is super simple with Siasync.

#> Siasync -subfolder photos /home/tbenz9/photos/

Siasync will upload any new files as they appear, and delete any files from Sia when they are removed. The -subfolder flag is optional and simply tells Siasync what folder to use on the Sia network. If -subfolder isn’t set, it will upload the files into the “siasync” folder.

Conclusion

This is just a few ideas of how I’m using Siasync today, please let me know in the comments below how you plan to use Siasync and what your experience has been!

Like what you see? Want to see more?

Contribute by opening a ticket or pull request, letting me know in the comments section below, on reddit at /u/tbenz9 or mentioning me in the Sia Discord at @tbenz9#2796.

Beer money — Siacoin: f63f6c5663efd3dcee50eb28ba520661b1cd68c3fe3e09bb16355d0c11523eebef454689d8cf

--

--