Active zotero.sqlite on Synology?

Hi, I hope this is the right place for my question.

I'd like to set up my Zotero data directory inside a Synology cloud station synced folder. However, I have read that it is dangerous to put the .sqlite file inside a cloud-synced folder such as Google Drive, due to the possibility of corruption. Can someone explain in plain English what the danger is here? Also, perhaps someone who is knowledgeable enough could take a look at this white paper on the cloud station software: http://global.download.synology.com/download/Document/WhitePaper/Synology_Cloud_Station_White_Paper.pdf
Would be okay to keep the .sqlite file in a folder synced with this software?

Barring this solution, does anyone know any software that would, say, automatically send the .sqlite file from a local folder to another local folder which is synced with the Synology each time Zotero is closed? This would basically be the same, and possibly avoid the data corruption risk, since the synced .sqlite file would never be open and active. It would just get overwritten each time zotero was closed, then synced.

Hope my questions are clear, and someone has some insights for me! Thanks so much!
  • edited April 5, 2016
    The Zotero sync server will freely sync *all* of the important data in the sqlite file (the only data caps/subscription costs incur for attached files, which you can sync using a third-party WebDAV server or other tool). Have you had specific issues using the sync mechanism?

    But, to answer what you asked, read what SQLite says about this in the aptly named How To Corrupt An SQLite Database File.
    Would be okay to keep the .sqlite file in a folder synced with this software?
    No. See section 1.2 of the linked document.
    Barring this solution, does anyone know any software that would, say, automatically send the .sqlite file from a local folder to another local folder which is synced with the Synology each time Zotero is closed? This would basically be the same, and possibly avoid the data corruption risk, since the synced .sqlite file would never be open and active. It would just get overwritten each time zotero was closed, then synced.
    No. Let's say you have Zotero open on Computer A and Computer B and you've made changes to both. This is VERY common. It is a PITA as a user to remember to close one before working on the other and, even if you went to that effort, mistakes happen.

    Close Zotero on Computer A. The changes made to computer A are now on your backup server. Great!

    But now close Zotero on Computer B. What happens? B doesn't have the changes made to A. It can't, because it was open when those changes were uploaded. So B can still get pushed to the server, but that overwrites the changes that had been made on A.
  • edited April 5, 2016
    Oh yes, I've had issues with sync before, which is why I now only store my database locally. Also for backup purposes, I want control of my zotero.sqlite. I don't allow any online service (Zotero or other) to retain the only copy of my data. I always keep local backups which I control. Can I do this when using sync?

    I had an issue before where not everything synced properly with the server, and then when syncing down to a fresh install, items and attached files were missing, other information was out of date, etc. The point is, I just don't trust that my library will be in tact when restoring from the server. By keeping it locally, I know what's in my db file, and I can just replace it from a backup in about 1 second, no need to worry about servers down or lost access to my account. That said, I would like to take advantage of any means for automated local backup that won't compromise my db integrity. i.e. If the backup occurs when the .sqlite file is active (Zotero is open), it is my understanding that this can cause issues. Is there some way to avoid this? My thought was just to write a script that will run the file sync every time I close Zotero.

    Sorry, didn't see the rest of your post. I only use Zotero on one computer. So I don't think what you say about Computer A and B would be an issue, but I certainly understand the concern for those using more than one computer.
  • Oh yes, I've had issues with sync before, which is why I now only store my database locally.
    These should be fixed if they are still issues.

    Backup and sync are really two different things. Backing up a closed sqlite file (ideally, storing versioned backups) is effective at making sure you don't lose too much data. But no: there's no good way to turn this into a syncing mechanism.
    I had an issue before where not everything synced properly with the server, and then when syncing down to a fresh install, items and attached files were missing, other information was out of date, etc.
    Sorry for that data loss. Zotero gives the status of a sync and there was likely an error icon on display next to the sync icon. It will likely be more noticeable in the future: https://github.com/zotero/zotero/issues/941
    That said, I would like to take advantage of any means for automated local backup that won't compromise my db integrity. i.e. If the backup occurs when the .sqlite file is active (Zotero is open), it is my understanding that this can cause issues. Is there some way to avoid this? My thought was just to write a script that will run the file sync every time I close Zotero.
    Again: it is certainly safe (and encouraged) to have backup software make a copy of a closed sqlite file (and ideally one that is versioned). This is a one-directional backup and does not allow for bi-directional syncing.

    I personally do both: I rely (successfully) on Zotero's syncing to keep multiple computers in sync, but can restore lost files from a single computer if needed.
  • Zotero very much encourages you to keep back-ups. Sync is no substitute for that. (And Zotero's server would basically never have the only copy of your data: even when relying on Zotero sync entirely, you always have both the local version and the server versoin of the database)

    As for backup, just run standard backups, something like rsync+cron (i.e. essentially Mac Time Machine or the approximations on that on Windows) of the Zotero folder -- or, if it was me, the entire harddisk -- to an external HD (or a server). Yes, there is a chance that happens with an open database, but that's not much of a problem. In the very unlikely case that the backup of zotero.sqlite actually is corrupted when you need it, you have Zotero's automated backups of its own database, which is from the last time it was closed.
  • Hi again adamsmith. I'd rather just eliminate any possibility of corruption by manually doing the backup, rather than using rsync or something. I don't leave my computers on all night, so I can't schedule the backup for a time I know I won't be using zotero. Secondly, I'm not sure that Zotero does automatically make the zotero.sqlite.bak files every time zotero closes. It seems to generate the .bak and .bak2 files somewhat regularly, but it's certainly not every time zotero is closed.

    I suppose my best bet at this point is figuring out how to write a shell script (or soon bash when windows gets bash) to see when the zotero application closes, then run a little sync from my local dir to my local google drive dir.

    I think this is where I have to start with this: https://www.google.com/url?q=https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fwindows%2Fdesktop%2Faa393250%28v%3Dvs.85%29.aspx&sa=D&sntz=1&usg=AFQjCNE6z_adceacPUDZwMC-8S9eVJ2LOQ Anyone know the next steps? I ask half in jest, but thanks if anyone can help!
  • edited April 6, 2016
    I wouldn't overthink this. Just use a proper backup system (like Time Machine on OS X) that does regular, automated, incremental, versioned backups of all your important data, including Zotero. There's no reason you need a dedicated backup system for Zotero. If by some stroke of misfortune it happens to back up in the split second that there's an open transaction and you end up with a corrupted database in the backup, you'll have numerous good copies before and after.

    If you want to be extra safe, you can decrease the interval and increase the number of Zotero's automated backups. They're created every 24 hours by default, but you can configure those with the extensions.zotero.backup.interval and extensions.zotero.backup.numBackups prefs.
Sign In or Register to comment.