w82

[Solved] Backing up config files

Recommended Posts

Hi,

Over the last month, I've had a lot of trouble with BTSync and had to reinstall several times. Each time I've done this, I have lost all the config options (mainly the shares). I'm now on the official debian version, but am confused which config files I should back-up.

I want to get to the stage where I can install BTSync on a freshly formatted device, restore a config, and all the old settings and shares are there and working.

Can anyone advise which folders and files are essential to be backed-up to make this happen?

Thanks

Will

Share this post


Link to post
Share on other sites

Hi Will,

There are 2 ways :

  1. You need to backup whole storage folder. Though, you'll need to be careful and ensure that folders path does not change.
  2. Make your own config, with pre-defined folders (only standard folders supported). In this case, you'll need to keep only this config folder, Sync will create all other folders from it.

 

Share this post


Link to post
Share on other sites

Hi Roman,

Thanks. Option 2 makes more sense I think. So I took a look at the config and have tried to populate "Shared folders section" without luck.

I've used the key for a shared folder from another BTSync instance on another device. Is this correct? When I run BTsync, the folder isn't appearing, so I've obviously done something wrong and I'm sure it's to do with the key.

The docs for shared folders in configs is a bit sparse, so would love your help if you get time

Thanks

 

Will

Share this post


Link to post
Share on other sites

Will,

is config valid? You can run it through a json validator. 

And does sync have rw access to the chosen directory? Check this. 

Share this post


Link to post
Share on other sites

Hi Helen,

I've managed to sort it, thanks. Here are my findings for backing things up on debian / raspberry pi.

Config

Webui and shared folders can't work together, so you can't monitor things in the web interface. To add a shared folder, you need a key which you can generate - then just use this key on other devices. Save the config file with a unique name so it isn't automatically over-written, and make a backup of it in a completely separate folder which isn't touched. Keep it safe!

To run this config using systemd, create a new service file. This is mine. Save and overwrite it in /lib/systemd/system/btsync.service

[Unit]
Description=BitTorrent Sync service
Documentation=http://help.getsync.com/
After=network.target

[Service]
Type=forking
User=pi
Group=pi
UMask=0002
Restart=on-failure
PermissionsStartOnly=true
PIDFile=/var/run/btsync/btsync.pid
ExecStartPre=/bin/mkdir -p /var/run/btsync
ExecStartPre=/bin/chown -R pi:pi /var/run/btsync
ExecStart=/usr/bin/btsync --config /home/pi/.config/btsync/config2.json

I'm running it as pi instead of btsync in order to preserve permissions.

When you upgrade btsync, all your settings are overwritten - including /lib/systemd/system/btsync.service. So, once you've installed btsync or upgraded, run a script to restore your backups:

sudo systemctl stop btsync.service
sleep 2
sudo rm /lib/systemd/system/btsync.service
sudo cp /home/pi/btsyncconfig/btsync.service /lib/systemd/system/btsync.service
sudo systemctl daemon-reload
sudo systemctl start btsync.service

This will run btsync using my backed-up config and all the old shares are still there.

Hope this helps someone

Will

Edited by w82

Share this post


Link to post
Share on other sites

thank you Will! Much appreciated, your guide can be useful for others. 

yes, indeed, webui and "shared_folders" cannot live together in one config.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.