Both sides previous revisionPrevious revisionNext revision | Previous revision |
zotero_data [2023/03/12 17:08] – [Restoring Your Zotero Data From a Backup] dstillman | zotero_data [2024/12/05 21:45] (current) – "preferences" → "settings", "pane" → "tab" dstillman |
---|
===== 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 the [[preferences|Zotero preferences]]. 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 settings]]. This will reveal the folder on your computer that contains your Zotero database and attachment files. |
| |
==== Default Locations ==== | ==== Default Locations ==== |
| |
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]] tab of the Zotero settings, your Zotero data is stored within the following OS-dependent directories: |
| |
|**macOS**|<code>/Users/<username>/Zotero</code>| | |**macOS**|<code>/Users/<username>/Zotero</code>| |
|**Linux**|<code>~/Zotero</code>| | |**Linux**|<code>~/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. | 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 settings, a search for the file name 'zotero.sqlite' can also help you locate the Zotero data directory. |
| |
<details> | <details> |
===== Backing Up Your Zotero Data ===== | ===== Backing Up Your Zotero Data ===== |
| |
We strongly recommend that you regularly back up your Zotero data directory. While [[:sync|syncing]] is a great way to make sure you can restore your libraries if something happens to your computer, it's not a 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]]). | We strongly recommend that you regularly back up your Zotero data directory. While [[:sync|syncing]] is a great way to make sure you can restore your libraries if something happens to your computer, it's 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 frequently, which 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. |
==== Restoring Your Zotero Data Using Zotero Syncing==== | ==== Restoring Your Zotero Data Using Zotero Syncing==== |
| |
If you were using Zotero syncing and have an empty local library, you can likely restore your data simply by syncing with your online library. After verifying that your library is correct on zotero.org, simply reenter your username and password in the Sync pane of the Zotero preferences and click the Sync button in the toolbar. (Zotero only syncs explicit deletions, so just syncing an empty library won't overwrite the server data **unless you deleted items manually**.) | If you were using Zotero syncing and have an empty local library, you can likely restore your data simply by syncing with your online library. After verifying that your library is correct on zotero.org, simply reenter your username and password in the Sync tab of the Zotero settings and click the Sync button in the toolbar. (Zotero only syncs explicit deletions, so just syncing an empty library won't overwrite the server data **unless you deleted items manually**.) |
| |
If you have a local Zotero library that you want to overwrite, close Zotero and delete the old [[#locating_your_zotero_data|Zotero data directory]] before syncing. Syncing your database with a different Zotero account will also prompt you to remove the existing local database. | If you have a local Zotero library that you want to overwrite, close Zotero and delete the old [[#locating_your_zotero_data|Zotero data directory]] before syncing. Syncing your database with a different Zotero account will also prompt you to remove the existing local database. |
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, 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"). | Open the Advanced tab of the Zotero settings 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. |
If you or someone else made unwanted changes to your Zotero library and synced those changes to your online library, you may be able to restore data by using a local backup of your Zotero data directory. | If you or someone else made unwanted changes to your Zotero library and synced those changes to your online library, you may be able to restore data by using a local backup of your Zotero data directory. |
| |
- Temporarily disable auto-sync in the Sync pane of the Zotero preferences. | - Temporarily disable auto-sync in the Sync tab of the Zotero settings. |
- Follow the steps in the preceding section to restore from a backup of your Zotero data directory. | - Follow the steps in the preceding section to restore from a backup of your Zotero data directory. |
- Once you see your restored data, were you to sync again, the more recent data in the online library would replace the data you just restored, and you'll need to take steps to prevent that: | - Once you see your restored data, were you to sync again, the more recent data in the online library would replace the data you just restored, and you'll need to take steps to prevent that: |
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. |
| |
- 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 tab of the Zotero settings. |
- [[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. |
- Close Zotero. In your data directory, rename zotero.sqlite to zotero.sqlite.old, rename one of the original .bak files (based on the timestamp) to zotero.sqlite, and restart Zotero. You should now see the backed-up version of your library. | - Close Zotero. In your data directory, rename zotero.sqlite to zotero.sqlite.old, rename one of the original .bak files (based on the timestamp) to zotero.sqlite, and restart Zotero. You should now see the backed-up version of your library. |
If you were not using syncing, you may wish to export to Zotero RDF any items added since the database upgrade and then reimport those into the earlier version. [[Sorting]] your library by Date Added may help you find such items. | If you were not using syncing, you may wish to export to Zotero RDF any items added since the database upgrade and then reimport those into the earlier version. [[Sorting]] your library by Date Added may help you find such items. |
| |
To temporarily disable further updates, go to the Config Editor in the Advanced pane of the Zotero preferences and set ''app.update.auto'' to false. Note that staying on an old version is not a long-term solution, as old versions are no longer supported and may stop syncing or receiving site-compatibility updates at any time. Be sure to post to the Zotero Forums and explain whatever is causing you to downgrade, and make a note to check back periodically to see whether it makes sense for you to re-enable automatic updates. | To temporarily disable further updates, go to the Config Editor in the Advanced tab of the Zotero settings and set ''app.update.auto'' to false. Note that staying on an old version is not a long-term solution, as old versions are no longer supported and may stop syncing or receiving site-compatibility updates at any time. Be sure to post to the Zotero Forums and explain whatever is causing you to downgrade, and make a note to check back periodically to see whether it makes sense for you to re-enable automatic updates. |
===== Locating Missing Zotero Data ===== | ===== Locating Missing Zotero Data ===== |
| |
* 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 (zotero.sqlite) and automatic database backups (*.bak). 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]] section of the Zotero settings 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. |
- 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 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 settings 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. |