-
Notifications
You must be signed in to change notification settings - Fork 281
Recovering from a tree structure corruption
Sometimes bad things happen. The tree structure could become corrupted in certain situations. Fortunately, there are good chances you can restore the original tree structure by recovering from a Firefox session backup. Here are some tips
- how to make a tree structure corruption less likely and
- how to recover if the tree structure becomes corrupted.
You can restore tabs with tree structure with Firefox sessionstore-backup
, but please note that there is no guarantee. TST is now built on WebExtensions API completely, and the backend of data storage may be changed by Firefox suddenly. (For example the backend of storage API was changed from JSON file to IndexedDB.)
You can do a few things to make a tree structure corruption less likely or to mitigate its impact:
- Better avoid using other tab-managing extensions together with TST. As Firefox developers have mixed up a privacy feature (containers) with a UI feature (tabs), this is not always achievable. But, for instance, resist to use extensions that group tabs by containers if you use TST.
- Prefer to use Create new group from tabs on the TST menu over using normal tabs as parents of other tabs. In case you are not able to restore the tree structure, there will be (empty) group tabs preceding their related tabs in the flat structure allowing you to re-create the original structure manually.
- Don't leave Firefox open for a too long time, e.g. exit it before hibernating your computer. Restart Firefox before/after making a big tree change or before starting a dangerous operation that could destroy the tree. This causes Firefox to create a new session backup file (
previous.jsonlz4
) on its next start that won't change until Firefox is restarted. - Some Firefox session backup files change frequently (
recovery.jsonlz4
andrecovery.baklz4
). Use a file synchronization software to make copies of them to a safe place. For instance, you can set up FreeFileSync to store versioned copies (named by time stamp) automatically whenever these files change (using RealTimeSync). This is what you really should do if you can't follow the precautions above.
Note: The session backup files are stored in the sub-folder sessionstore-backups
of your Firefox profile. To see where to find your Firefox profile folder, type about:support
into the Firefox address bar.
When the tree structure has become corrupted, follow these steps:
- Do not add or delete tabs or windows. Do not even activate a different tab. Doing so will cause replacement of the session backup files and may delete your last usable one.
- Copy the current session backup files from the Firefox profile to a safe place.
- Exit Firefox (from the Hamburger menu).
- Create a new copy of the session backup file you want to restore. You can try
recovery.jsonlz4
, but better chances are withrecovery.baklz4
. Rename the copied file tosessionstore.jsonlz4
. Then move it to the Firefox profile folder (if there is already a file with that name, replace it). - Restart Firefox and wait until TST has rebuilt the tree.
- If the tree structure has not been restored, start over with step 3, but use a different/older backup file in step 4. If you have set up versioned copies as explained in the precautions, there are plenty to choose from.
- If you don't have a usable backup file that was stored shortly before the corruption happened, you can try to restore the session state from the time when Firefox was last started (choose
previous.jsonlz4
in step 4). But you will lose tabs and windows created since then. - If you already restarted Firefox after the corruption happened,
previous.jsonlz4
won't help. You can try to use one of theupgrade.jsonlz4-{timestamp}
files Firefox creates after upgrading to a new version.
If you don't panic on a tree structure corruption but immediately copy the existing session backup files to a safe place, there are good chances that you can recreate the original structure. With a setup that automatically copies versioned backup files to a safe place, you will be able to do the recovering within a few minutes.