Lost entire library with sync
Hello,
I have used my zotero offline for years. I apparently had an account that I created years ago, but synchronization was disabled.
Today I needed to share a file with a colleague and as I understood, I needed to connect using sync. I forgot that I had an account, and created a new one. When logging to this new account, Zotero told me that everything related to the former account would be deleted from my laptop. Since, in my mind, I had never been connected - and probably because I did not understand what that meant- I accepted.
As you can imagine, I have lost about all my library, years of references. The zotero file is brand new, I can't restore an older version of the sqlite file.
Using a recovery program, I managed to find a 4-day old sqlite.1.bak file. I followed this procedure: https://forums.zotero.org/discussion/3134/zotero-sqlite-bak (basically, renaming my sqlite.bak as sqlite and putting it into the zotero file) but zotero can't open and the sqlite file is now "sqlite.damaged". I have tried to fix it using the DB repair tool, but it tells me "this is not a sqlite file".
Do you know if there is anything else I can try?
A huge thank in advance, I am desperate!
I have used my zotero offline for years. I apparently had an account that I created years ago, but synchronization was disabled.
Today I needed to share a file with a colleague and as I understood, I needed to connect using sync. I forgot that I had an account, and created a new one. When logging to this new account, Zotero told me that everything related to the former account would be deleted from my laptop. Since, in my mind, I had never been connected - and probably because I did not understand what that meant- I accepted.
As you can imagine, I have lost about all my library, years of references. The zotero file is brand new, I can't restore an older version of the sqlite file.
Using a recovery program, I managed to find a 4-day old sqlite.1.bak file. I followed this procedure: https://forums.zotero.org/discussion/3134/zotero-sqlite-bak (basically, renaming my sqlite.bak as sqlite and putting it into the zotero file) but zotero can't open and the sqlite file is now "sqlite.damaged". I have tried to fix it using the DB repair tool, but it tells me "this is not a sqlite file".
Do you know if there is anything else I can try?
A huge thank in advance, I am desperate!
If you can't fix it with the repair tool, you don't have a backup of your Zotero data directory, and you can't find any other copies of zotero.sqlite, I'm afraid there's nothing to be done.
For what it's worth, this was the dialog: You would've then had to check a "Remove existing data" checkbox to proceed, at which point it would indeed have deleted your existing local data.
You're not the first to do this by mistake, and we can try to make this message more dire-sounding or maybe add some sort of backup option, but there's only so much we can do. People switch accounts on shared computers where the old data needs to be deleted.
thank you for your answer.
"Was it named zotero.sqlite when you tried?"
Yes, I edited the name and extension of the bak file myself.
"You would've then had to check a "Remove existing data" checkbox to proceed, at which point it would indeed have deleted your existing local data."
Yes, exactly, I checked this box to proceed -I am not sure that I can proceed without checking the box-. It is true that I did not understand that all my library would be deleted. I thought that only data about the account (name, password etc) would be removed. Indeed, I think that a backup or undo button would be great. Also, yes please, make this message (way) more explicit: this is a huge step, and it should be clear that everything from Zotero (files, structure, pdfs, annotations, references) will be lost and that there is not stepping back...
Is there any directory were these deleted files are stored until, say, the next time the laptop turns on?
Thank you again for your answer,
Just to be clear, you don’t have a backup of your computer from any point?
@Chiffon73: Did you also try to restore your Zotero Data Directory using your recovery program? Maybe you could at least get back some files from the storage subdirectory.
@dstillman I have one backup but can't access it during the covid lockdown. So not everything is lost, but I will have to wait several months to recover an old version. There is still hope!
@qqbb when I use the recovery programm, I can access a large number of zotero-info and zotero-cache items. Can it be of any use?
Thanks!
/Zotero/Data/storage/[itemKey]/[filename]
. So it would be best if you could try to recover a full directory. If that's not the case, search for.pdf
files.Here are some tutorials that might be helpful for data recovery. I don't know some of those programs, part of the information could be outdated. But the general procedure should hold:
https://superuser.com/a/790566
https://www.redhat.com/sysadmin/find-lost-files-scalpel
https://www.pendrivelinux.com/yumi-multiboot-usb-creator/
thanks again for your message. I haven't been able to recover the full folder with my software. It looks like it has vanished!
I had a look at the links you sent, they are for Linus and I use a Windows laptop, but they mostly recommand to use a software similar to the one I have just used. That is too bad...
I hope that the zotero team will find a way to prevent this kind of damage in the future, this is a silly mistake by the user (just pressing one button) which has very unpleasant consequences...
Thank you for your help anyway!
Some backup function that can be launched from within Zotero should be helpful, especially for less technically minded users. Moving the data directory to the operating system's trash is probably not a good option. It seems there're generally no system tools to do that.
Best answer so far!
For what it's worth, in most cases switching accounts wouldn’t result in data loss, because the whole point is that it appears when you already had a Zotero account that you had been syncing this library with previously. In your case, that syncing just hadn't happened in a long time.
We'll clarify the dialog — and possibly check for unsynced data — for the next version.
If PhotoRec worked well for PDF files, you could also try to recover SQLITE files with it. It's in the list of supported file formats. Maybe the zotero.sqlite database can be recovered as well.
While PhotoRec is a program for recovering individual files, TestDisk might be able to recover a directory.
@qqbb: This is a great software, but it does not find older versions of the zotero file. As @dstillman suggested, these files were overwritten when sync the account, and it can't find older versions of the zotero files (all the ones that are found are 2 days old max).
If accidential file deletion should happen to anyone on Windows on an SSD system, I would recommend to follow https://superuser.com/a/709755 to disable TRIM immediately. It's possible this would already be too late, but if the TRIM command is not issued right away, it could increase the chances that data can be recovered. According to Microsoft's fsutil documentation here, enabling or disabling DisableDeleteNotify does not require a restart.