Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
zotero_data [2022/03/20 06:24] – [Restoring From the Last Upgrade Backup] dstillmanzotero_data [2023/07/13 17:52] (current) – [Backing Up Your Zotero Data] dstillman
Line 3: Line 3:
 ===== Locating Your Zotero Data ===== ===== Locating Your Zotero Data =====
  
-The easiest and most reliable way to find your Zotero data is by clicking the "Show Data Directory" button in the [[preferences/advanced|Advanced]] tab of your Zotero [[preferences|Preferences]] window. This will reveal the folder on your computer that contains your Zotero database and attachment files.+The easiest and most reliable way to find your Zotero data is by clicking the "Show Data Directory" button in the [[preferences/advanced|Advanced]] tab of the [[preferences|Zotero preferences]]. This will reveal the folder on your computer that contains your Zotero database and attachment files.
  
 ==== Default Locations ==== ==== Default Locations ====
- 
-=== Zotero 5 === 
  
 Unless you have selected a custom data directory in the [[preferences/advanced|Advanced]] pane of the Zotero preferences, your Zotero data is stored within the following OS-dependent directories: Unless you have selected a custom data directory in the [[preferences/advanced|Advanced]] pane of the Zotero preferences, your Zotero data is stored within the following OS-dependent directories:
Line 16: Line 14:
 |**Linux**|<code>~/Zotero</code>| |**Linux**|<code>~/Zotero</code>|
  
-=== Zotero 4 for Firefox (2017 and earlier) ===+The "Show Data Directory" button will always reveal the data directory currently in use and is the recommended method for finding your data directory. If you're unable to access the Zotero preferences, a search for the file name 'zotero.sqlite' can also help you locate the Zotero data directory. 
 + 
 +<details> 
 +<summary>**Older Versions**</summary> 
 + 
 +<html><h5>Zotero 4 for Firefox (2017 and earlier)</h5></html>
  
 |**macOS**|<code>/Users/<username>/Library/Application Support/Firefox/Profiles/<randomstring>/zotero</code> <html><small>Note: The /Users/&lt;username&gt;/Library folder is hidden by default. To access it, click on your desktop, hold down the Option key, and click the Finder's Go menu, and then select Library from the menu.</small></html>| |**macOS**|<code>/Users/<username>/Library/Application Support/Firefox/Profiles/<randomstring>/zotero</code> <html><small>Note: The /Users/&lt;username&gt;/Library folder is hidden by default. To access it, click on your desktop, hold down the Option key, and click the Finder's Go menu, and then select Library from the menu.</small></html>|
Line 23: Line 26:
 |**Linux (most distributions)**|<code>~/.mozilla/firefox/Profiles/<randomstring>/zotero</code>| |**Linux (most distributions)**|<code>~/.mozilla/firefox/Profiles/<randomstring>/zotero</code>|
  
-=== Zotero 4 Standalone (2017 and earlier) ===+<html><h5>Zotero 4 Standalone (2017 and earlier)</h5></html>
  
 |**macOS**|<code>/Users/<username>/Library/Application Support/Zotero/Profiles/<randomstring>/zotero</code> <html><small>Note: The /Users/&lt;username&gt;/Library folder is hidden by default. To access it, click on your desktop, hold down the Option key, and click the Finder's Go menu, and then select Library from the menu.</small></html>| |**macOS**|<code>/Users/<username>/Library/Application Support/Zotero/Profiles/<randomstring>/zotero</code> <html><small>Note: The /Users/&lt;username&gt;/Library folder is hidden by default. To access it, click on your desktop, hold down the Option key, and click the Finder's Go menu, and then select Library from the menu.</small></html>|
Line 30: Line 33:
 |**Linux (most distributions)**|<code>~/.zotero/Profiles/<randomstring>/zotero</code>| |**Linux (most distributions)**|<code>~/.zotero/Profiles/<randomstring>/zotero</code>|
  
-The "Show Data Directory" button will always reveal the data directory currently in use and is the recommended method for finding your data directory. If you're unable to access the Zotero preferences, a search for the file name 'zotero.sqlite' can also help you locate the Zotero data directory.+</details>
 ===== Data Directory Contents ===== ===== Data Directory Contents =====
  
-The most important file in the data directory is the zotero.sqlite file, which is the database containing the majority of your data: item metadata, notes, tags, etc. When Zotero starts up, it reads the zotero.sqlite file in the active data directory.+The most important file in the data directory is the ''zotero.sqlite'' file, which is the database containing the majority of your data: item metadata, notes, tags, etc. When Zotero starts up, it reads the ''zotero.sqlite'' file in the active data directory.
  
-The directory also contains a 'storage' subdirectory, containing all of your file attachments, such as PDFs, web snapshots, audio files, or any other files you have imported. (Files that are [[attaching_files|linked]] are not copied into this subdirectory.)+The directory also contains a ''storage'' folder with 8-character subfolders (e.g."N7SMB24A"containing all of your file attachments, such as PDFs, web snapshots, audio files, or any other files you have imported. (Files that are [[attaching_files|linked]] are not copied into this subfolder.)
  
-Your data directory will likely contain several other files. These can include zotero.sqlite.bak (an automatic backup of zotero.sqlite, which is updated when you quit Zotero and the existing zotero.sqlite.bak file hasn't been updated in the last 12 hours) and zotero.sqlite.[number].bak files (automatic backups of zotero.sqlite that are created during certain Zotero updates).+Your data directory will likely contain several other files and folders. These can include ''zotero.sqlite.bak'' (an automatic backup of ''zotero.sqlite'', which is updated periodically if the existing ''zotero.sqlite.bak'' file hasn't been updated in the last 12 hours) and ''zotero.sqlite.[number].bak'' files (automatic backups of ''zotero.sqlite'' that are created during certain Zotero updates), as well as folders such as ''locate'', ''logs'', ''pipes'', ''styles'', and ''translators'' that are created automatically at Zotero startup.
  
 **Warning**: Before you copy, delete, or move any of these files, be sure that Zotero is closed. Failure to do so before moving these files can damage your data. **Warning**: Before you copy, delete, or move any of these files, be sure that Zotero is closed. Failure to do so before moving these files can damage your data.
Line 44: Line 47:
 ===== Backing Up Your Zotero Data ===== ===== Backing Up Your Zotero Data =====
  
-We strongly recommend that you regularly back up your Zotero databaseSyncing is not a good substitute for backing up: the Zotero servers only store the most recent version of your libraries, and it takes just a single (possibly automatic) sync to change the server copy.+We strongly recommend that you regularly back up your Zotero data directoryWhile [[:sync|syncing]] is a great way to make sure you can restore your libraries if something happens to your computer, it'not a complete substitute for a proper backup: the Zotero servers only store the most recent version of your libraries, and it takes just a single (possibly automatic) sync to change the server copy (though some inadvertent changes can be restored from [[#restoring_from_the_last_automatic_backup|Zotero's automatic backups]]).
  
 Rather than backing up just your Zotero database, we recommend using a backup utility that automatically backs up your entire hard drive to an external device on a regular basis and keeps incremental backups so that you can restore to a given version. Most modern operating systems offer such functionality (e.g., Time Machine on Macs). Rather than backing up just your Zotero database, we recommend using a backup utility that automatically backs up your entire hard drive to an external device on a regular basis and keeps incremental backups so that you can restore to a given version. Most modern operating systems offer such functionality (e.g., Time Machine on Macs).
  
-If you really want to back up your Zotero data specifically, [[zotero_data#locating_your_zotero_data|locate your Zotero data]], close Zotero, and copy your data directory (the //entire folder//, including ''zotero.sqlite'' and ''storage'' and the other subfolders) to a backup location, preferably on another storage device. As with all important data, it's a good idea to back up your Zotero data frequently (which is why we recommend an automated full-system backup instead).+If you really want to back up your Zotero data specifically, [[zotero_data#locating_your_zotero_data|locate your Zotero data]], close Zotero, and copy your data directory (the //entire folder//, including ''zotero.sqlite'' and ''storage'' and the other subfolders) to a backup location, preferably on another storage device. As with all important data, it's a good idea to back up your Zotero data frequentlywhich is why we recommend an automated full-system backup instead
 + 
 +Note that if you're using "download files as needed" for file syncing, your attachment files may not all exist locally and may not be included in a backup. Zotero Storage provides reliable storage of uploaded files, so you might choose to exclude the ''storage'' folder from your backup, but if you'd like a local backup of attachments as well, you would need to use "download files at sync time" on one computer and make a backup of the data directory from that computer.
  
 **Warning**: You shouldn't use export (e.g., to Zotero RDF, BibTeX, or RIS) as a backup method. Exporting and re-importing a library doesn't produce an exact copy — it will reset Date Added/Modified times and break links to existing citations in word processor documents, along with other potential changes. **Warning**: You shouldn't use export (e.g., to Zotero RDF, BibTeX, or RIS) as a backup method. Exporting and re-importing a library doesn't produce an exact copy — it will reset Date Added/Modified times and break links to existing citations in word processor documents, along with other potential changes.
Line 68: Line 73:
 If you were not using Zotero syncing (or were but don't want to perform a full sync) and have a backup of your Zotero data directory, you can restore your library by replacing your active data directory with your backed-up data directory. If you were not using Zotero syncing (or were but don't want to perform a full sync) and have a backup of your Zotero data directory, you can restore your library by replacing your active data directory with your backed-up data directory.
  
-Open the Advanced pane of the Zotero preferences and make a note of the specified path under Data Directory Location. (By default, this will be "Zotero" within your home folder.) Click "Show Data Directory", which should reveal your active data directory containing zotero.sqlite and possibly a 'storage' subdirectory. Close Zotero, move one level up in the filesystem (Cmd-up-arrow on macOS, Alt-up-arrow on Windows), and rename the folder to "Zotero-Old". Next, copy the data directory from your backup to the original location (e.g., "Zotero").+Open the Advanced pane of the Zotero preferences and make a note of the specified path under Data Directory Location. (By default, this will be "Zotero" within your home folder.) Click "Show Data Directory", which should reveal your active data directory containing zotero.sqlite and possibly a 'storage' subdirectory. Close Zotero, change to the parent folder of the active data directory (Cmd-up-arrow on macOS, Alt-up-arrow on Windows), and rename the folder to "Zotero-Old". Next, copy the data directory from your backup to the original location (e.g., "Zotero").
  
 When you reopen Zotero, you should see your restored Zotero data. When you reopen Zotero, you should see your restored Zotero data.
Line 93: Line 98:
 If you make a critical mistake while using Zotero — for example, if you accidentally delete a large set of items — you may be able to revert to the last automatic backup. Note that automatic backups contain only data, not files. If you make a critical mistake while using Zotero — for example, if you accidentally delete a large set of items — you may be able to revert to the last automatic backup. Note that automatic backups contain only data, not files.
  
-  - First, make sure to keep Zotero running, as the automatic backup might be overwritten when you quit the application. 
   - If you're using syncing, temporarily disable auto-sync in the Sync pane of the Zotero preferences.   - If you're using syncing, temporarily disable auto-sync in the Sync pane of the Zotero preferences.
   - [[zotero_data#locating_your_zotero_data|Locate your Zotero data]] and make a backup copy of any zotero.sqlite.bak files. The timestamps of the files may help you determine which file would contain the data you're trying to restore.   - [[zotero_data#locating_your_zotero_data|Locate your Zotero data]] and make a backup copy of any zotero.sqlite.bak files. The timestamps of the files may help you determine which file would contain the data you're trying to restore.
Line 119: Line 123:
 If you open Zotero to find your library blank or missing lots of data, there are a few main possibilities: If you open Zotero to find your library blank or missing lots of data, there are a few main possibilities:
  
-  * If you've been using a very old version of Zotero from 2017 or earlier without installing any updates and recently upgraded to Zotero 5, see [[kb/data_missing_after_zotero_5_upgrade|Missing Data After Zotero 5 Upgrade]]. Zotero 5 has been out for years, so this no longer applies to most people.+  * If you were using a very old version of Zotero — from 2017 or earlier — without installing any updates and just upgraded to a newer version of Zotero, see [[kb/data_missing_after_zotero_5_upgrade|Missing Data After Zotero 5 Upgrade]]. Zotero 5 was released many years ago, so this no longer applies to most people.
  
   * If you're using a different computer from the one where you created the missing data, and your data is also missing in your online library, your data simply hasn't synced from the computer where you created it. See [[kb:Changes Not Syncing]].   * If you're using a different computer from the one where you created the missing data, and your data is also missing in your online library, your data simply hasn't synced from the computer where you created it. See [[kb:Changes Not Syncing]].
Line 125: Line 129:
   * If you know you've had the data on this computer previously, something may have happened to your previous Zotero database, or Zotero may be looking in the wrong place for your data. Read on for instructions.   * If you know you've had the data on this computer previously, something may have happened to your previous Zotero database, or Zotero may be looking in the wrong place for your data. Read on for instructions.
  
-To determine what happened to your data on this computer, first locate your current Zotero data directory by going to the [[preferences/advanced|Advanced → Files and Folders]] pane of the Zotero preferences and using the "Show Data Directory" button. Take note of the names, sizes, and dates of the files beginning with "zotero.sqlite" in this folder, which are your Zotero database and automatic database backups. An empty Zotero database will be either approximately 1 MB (~1,000 KB) or 5 MB.+To determine what happened to your data on this computer, first locate your current Zotero data directory by going to the [[preferences/advanced|Advanced → Files and Folders]] pane of the Zotero preferences and using the "Show Data Directory" button. Take note of the names, sizes, and dates of the files beginning with "zotero.sqlite" in this folder, which are your Zotero database (zotero.sqlite) and automatic database backups (*.bak). An empty Zotero database will be either approximately 1 MB (~1,000 KB) or 5 MB.
  
 If you see only 1 MB or 5 MB zotero.sqlite files, look in the 'storage' folder, if one exists, for folders with dates corresponding with your previous usage of Zotero. If you see only 1 MB or 5 MB zotero.sqlite files, look in the 'storage' folder, if one exists, for folders with dates corresponding with your previous usage of Zotero.
Line 132: Line 136:
     - Look for larger zotero.sqlite.bak files in the data directory, or look for a larger zotero.sqlite file in any separate backups you have. (It's not possible to restore your data from the 'storage' files alone.) When Zotero starts up, it reads the zotero.sqlite file in the active data directory, so you can try other copies of zotero.sqlite by copying them to that location and filename. Do not try to import an .sqlite file into Zotero via File → "Import…" — it won't work.     - Look for larger zotero.sqlite.bak files in the data directory, or look for a larger zotero.sqlite file in any separate backups you have. (It's not possible to restore your data from the 'storage' files alone.) When Zotero starts up, it reads the zotero.sqlite file in the active data directory, so you can try other copies of zotero.sqlite by copying them to that location and filename. Do not try to import an .sqlite file into Zotero via File → "Import…" — it won't work.
     - Whether or not you have a backup, if you've been using Zotero syncing, you can sync to pull down all data in your [[/mylibrary|online library]]. If you do have a backup, all data more recent than the backup will be downloaded. If you only have an empty database, all data will be downloaded. In either case, you won't overwrite data in the online library simply by syncing — syncing doesn't work that way.     - Whether or not you have a backup, if you've been using Zotero syncing, you can sync to pull down all data in your [[/mylibrary|online library]]. If you do have a backup, all data more recent than the backup will be downloaded. If you only have an empty database, all data will be downloaded. In either case, you won't overwrite data in the online library simply by syncing — syncing doesn't work that way.
 +    - If you can't find any other copies of zotero.sqlite and weren't using Zotero syncing, you'll unfortunately probably need to recreate your database from scratch. Close Zotero, move the Zotero data directory to your desktop as "Zotero Old", and restart Zotero to create a new library. You can search for all PDFs within your "Zotero Old" folder and drag them to Zotero, and Zotero will attempt to [[retrieve_pdf_metadata|retrieve metadata]] for as many of them as possible. You can also extract data from any Word or LibreOffice documents you used with the Zotero word processor plugin by using [[https://rintze.zelle.me/ref-extractor/|Reference Extractor]], though note that any data you re-import this way won't be linked to your existing documents.
   * If this isn't the location you were expecting to be using, or if you don't see a 'storage' folder or it's empty, you'll need to locate your previous data directory on this computer. Once you find it, either select that data directory from the Zotero preferences or, with Zotero closed, rename the current directory (e.g., to "Zotero-Old") and move your desired Zotero directory to the specified location. If you're not sure where your most recent Zotero data is located, look for versions of zotero.sqlite or zotero.sqlite.bak larger than 5 MB with appropriate modification times stored elsewhere on your computer and look at the dates of the folders within the 'storage' folder.   * If this isn't the location you were expecting to be using, or if you don't see a 'storage' folder or it's empty, you'll need to locate your previous data directory on this computer. Once you find it, either select that data directory from the Zotero preferences or, with Zotero closed, rename the current directory (e.g., to "Zotero-Old") and move your desired Zotero directory to the specified location. If you're not sure where your most recent Zotero data is located, look for versions of zotero.sqlite or zotero.sqlite.bak larger than 5 MB with appropriate modification times stored elsewhere on your computer and look at the dates of the folders within the 'storage' folder.
     * Unless you have a good reason to use a custom data directory location, we strongly recommend using the [[#default_locations|default location]] in your home directory.     * Unless you have a good reason to use a custom data directory location, we strongly recommend using the [[#default_locations|default location]] in your home directory.
     * When specifying a custom data directory location, keep in mind that Zotero doesn't move or copy any data. You still need to copy your data into the specified location. Also, when pointing the data directory location to an existing folder, be sure to specify the folder containing zotero.sqlite and 'storage', not the 'storage' folder.     * When specifying a custom data directory location, keep in mind that Zotero doesn't move or copy any data. You still need to copy your data into the specified location. Also, when pointing the data directory location to an existing folder, be sure to specify the folder containing zotero.sqlite and 'storage', not the 'storage' folder.
  
-If you've gone through these steps and still can'find your data, post to the Zotero Forums with the following info:+If you've gone through these steps and aren'sure what to do, post to the Zotero Forums with the following info:
  
   * The names, sizes, and dates of all files beginning with "zotero.sqlite" in your current data directory   * The names, sizes, and dates of all files beginning with "zotero.sqlite" in your current data directory
zotero_data.1647771875.txt.gz · Last modified: 2022/03/20 06:24 by dstillman