Moving Zotero Data Directory

I helped a curator move his Zotero data directory from his PC's hard drive to his individual drive on the institutional network. This is safer, in case his PC should crash. I followed the steps I usually do, which are to "show data directory" from Edit>Preferences>Advanced>Files and Folders. Once at the right place, I navigated up one level in the file directory and proceeded to copy his Zotero folder to his network drive. The copy process had commenced (it is quite a large library with PDFs) when I realized I hadn't closed the standalone, though I had remembered to close all browsers.

We have in our instructions that if one does not close the standalone at this time, data may be corrupted. I closed the standalone as soon as I remembered - the copying progress bar was about 1/3 of the way through. He has a very slow PC and so asked if he could finish the process on his own, based on our instructions - i.e. once the folder is copied to choose the new custom location for the Zotero Data Directory in Edit>Preferences>Advanced>Files and Folders.

The curator also has an online Zotero account, has paid for additional storage, and is synching both data and files. Should there be any problems with his data, is it possible to import his library into the standalone FROM his online library/the cloud? I did not create a back-up because I assumed that copying his Zotero folder on the network drive was the back, for all intents and purposes.

I do hoped I haven't messed this up by not closing the standalone. The window in which to do that is so tight; one moment's distraction and you can forget. I wish there were another more foolproof way to change the location of the Zotero data directory for someone who already has items in their library, without fear of data loss.

Thanks.
  • It's very unlikely this caused any problems. There's a very small chance that closing Zotero while the zotero.sqlite file itself was being copied could result in the copy being corrupted, but 1) probably not, 2) it probably was copying files in 'storage' by that point, 3) you still have the original file on the first hard drive, and 4) there are automatic backups of the database in the data directory. Just check the database integrity in the Advanced → Files and Folders pane of the Zotero preferences to make sure the file copied OK, but this really isn't something to worry about.

    And yes, you could always sync to pull down data from the online library, though that won't be necessary here.

    Note, however, that storing the data directory on a network drive is more likely to result in a corruption or result in other problems, because network drives don't always properly mirror the normal hard drive behavior that Zotero and other database-backed programs rely on. So if you're going to do that, you'll want to keep this in mind if you run into unexpected disk I/O errors and make sure the folder is backed up in some automated fashion.
  • The window in which to do that is so tight; one moment's distraction and you can forget. I wish there were another more foolproof way to change the location of the Zotero data directory for someone who already has items in their library, without fear of data loss.
    I'm also not clear on what "window" you mean here. You basically have two options when moving from the default location to a custom data directory:

    1) Create a new, empty destination directory, point Zotero at it, let Zotero close down (which it will prompt you to do), and then delete the new directory and move the old data directory to the same location (or move the files from within the old folder to the new one).

    2) Copy/move the whole old directory with Zotero closed, let Zotero start up to an empty database, point it at the new directory, close it, and delete the empty data directory.

    Having Zotero move the folder itself isn't really an option, since there are just too many weird errors that can result due to security software, etc. This is really a job for the OS.

    For Option 2, Zotero could prompt to choose a custom data directory instead of creating a new data directory at the default location. (It already does the inverse — if you're using a custom location and you move that folder, it offers to switch to the default location or let you choose another.)
  • Thank you so much for your thorough response! The instructions we have developed for ourselves (pulling partly from Zotero.org documentation) for changing the data directory for those users who already have items in their library are, I believe, akin to your option 2 above. I've included them below. What I meant by "window" is that we or the curators (when they try it themselves) often forget to do step 4 below, only realizing that we've skipped it by the time we are at step 7. So I was wondering if there was an easier way to do this, which would not involve the possibility of skipping this step. I will experiment with your Option 1.

    Our instructions:

    If you have already started collecting items, you will need to move the files to the new data directory location before changing the data directory location in your settings.

    1. In Zotero Standalone, select Edit, then click on Preferences in the dropdown menu and go to the Advanced tab. Click on the Files and Folders tab.

    2. Select the “Show Data Directory” Button.

    3. A Windows Explorer window will open to your data directory. Minimize this window.

    4. CLOSE ZOTERO AND YOUR INTERNET BROWSER. NOTE: IF YOU DO NOT DO THIS, YOUR DATA MAY BE CORRUPTED.

    5. Maximize the Windows Explorer window. Click up one level in the file directory. Find the folder called “Zotero,” and copy the folder (CTRL+C).

    6. Navigate to your H:\ drive. Create a folder called Zotero Data Directory. Paste your copied folder into this folder.

    7. Reopen Zotero. Open Preferences and navigate back to the Files and Folders tab under the Advanced tab.

    8. Under Data Directory Location, click on the Choose button to select a Custom location and navigate to the location on your H:\ drive where you saved a copy of your data directory files. Click Select folder.

    9. Click OK.

    10. After clicking OK, you will be prompted with the following message. Click Yes. "The directory you selected is empty. To move an existing Zotero data directory, you will need to manually move files from the existing data directory to the new location after Zotero has closed. Use the new directory? Yes/More info/No."

    11. You will then be asked to restart Zotero. Click Quit Zotero. "Zotero must be restarted for the change to take effect. Be sure to move files from your existing Zotero data directory to the new location before opening Zotero. Quit Zotero."

    12. Reopen Zotero. You may now continue collecting citations.

    13. If you reopen your Preferences to the Advanced tab, and then Files and Folders, it should match the screenshot below. (Here we provide a screenshot of the Advanced tab with the custom directory pointing to the new location.)
  • A few corrections:

    1: "Zotero Standalone" -> "Zotero"

    4: No need to close the browser, just Zotero

    6: There's no need to create a folder named "Zotero Data Directory". You would just copy or move the "Zotero" directory to the new location.

    10: If you actually chose the directory you copied, you wouldn't receive that message. That would only appear if, as it says, you chose an empty directory.

    And once Zotero is up and running in the new location and all items and files are accessible and everything is working properly, you would presumably want to delete the old "Zotero" directory to avoid confusion and save disk space.

    (And really, I wouldn't worry too much about possible corruption. You should definitely close Zotero first but you would still have to be pretty unlucky to end up with a corrupted copy. It wouldn't affect the original file in any case, so if you forgot and then noticed right away you could just copy the zotero.sqlite file again.)
  • But just reiterate what I say above:
    So if you're going to [put the data directory on a network drive], you'll want to keep this in mind if you run into unexpected disk I/O errors and make sure the folder is backed up in some automated fashion.
  • Thanks so much for these corrections to our instructions, dstillman - it's very much appreciated.

    To your last reiterated point above: "... and make sure the folder is backed up in some automated fashion." I'm not sure I understand. (Sorry I'm an instruction rather than a systems librarian.)

    Anything that is on our institution's network is automatically back-up every night by the museum's systems department, which is why we advise our curators to move their zotero data directory to their personal drives on the network. Is that what you mean by ensuring that the folder is backed up in some automated fashion?
  • Anything that is on our institution's network is automatically back-up every night by the museum's systems department (...). Is that what you mean by ensuring that the folder is backed up in some automated fashion?
    Yes, that's exactly what dstillman is talking about, so it sounds like you're good.
  • Great, thanks adamsmith.
  • As of Jan 2023, I confirm the steps of my successful experience:

    0. In Zotero: Resync/refresh.

    1. In Zotero: Edit/Preferences, Advanced tab, Files and Folders tab.

    2. "Show Data Directory", Go up one level, Ctrl-C the entire folder.

    3. CLOSE Zotero!!!

    5. In the destination folder/drive: Ctrl-V. WAIT for the entire copy.

    6. Reopen Zotero: Edit/Preferences, Advanced tab, Files and Folders tab.

    7. "Custom location", navigate to and select the drive folder just pasted.

    8. Zotero wants to restart but actually just closes itself (good). Restart Zotero. Wait for sync/refresh.

    9. Check if everything is fine. Close Zotero and rename the original folder to anything else. Reopen and check if everything STILL fine, if not, close, rename and point it back to its old directory: review the steps.

    10. Erase the old (renamed) folder and welcome the free space!
Sign In or Register to comment.