Best practices for backing up FireFox profile?

Get help for specific problems
Posts: 4
Joined: 25 Aug 2024

one1

It's important to me that I have a backup of my FireFox profile. Using a small app called fBackup I have come up with a list of essential files and folders to backup. I have also found the important plugin data folders and can back those up too. I do this to avoid having a gigantic backup that contains unnecessary information.

However, as I understand it, the FF profile directory should only be backed up when FireFox is closed.

Is there a way to either remind me to close FF before I run my backup, or somehow not run the backup until FF is closed?

Or is there some better way to be doing what I am trying to do?

Thanks!!!
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

When you try to backup your FireFox profile, but didn't close it, you'll see the following error message during synchronization, which is also the reminder you asked for:
Cannot read file "[...]Firefox\Profiles\1234a12b.default\parent.lock".

The file is locked by another process:
Firefox [C:\Program Files\Mozilla Firefox\firefox.exe]
Posts: 4
Joined: 25 Aug 2024

one1

Thanks.

I didn't have parent.lock in my list of files to sync. Remember I'm not syncing the entire profile. I have now added it.

I guess what I was hoping for was a notification *before* the syncing started, not an error message after syncing had begun.
User avatar
Posts: 4058
Joined: 11 Jun 2019

xCSxXenon

Two options:
1) Create a batch script that first kills Firefox and then runs the FFS sync
2) Run FFS as admin and enable "copy locked files". This will use the Windows VSS to get a copy of the files, even when in-use.
Posts: 4
Joined: 25 Aug 2024

one1

Two options:
1) Create a batch script that first kills Firefox and then runs the FFS sync
2) Run FFS as admin and enable "copy locked files". This will use the Windows VSS to get a copy of the files, even when in-use. xCSxXenon, 26 Aug 2024, 14:47
I guess maybe I wasn't explaining the issue well.

I'm looking for a solution that warns me to shutdown FF before I do the backup.

I don't want to backup the profile while FF is open. Everything I read says that you don't get a proper backup if you copy while FF is open. So #2 above won't solve the issue.

I also don't want to just kill FF because I might have things open that I need to close properly.

I'm old. And forgetful. If I wasn't, then I would just remember to shut down FF before I do the backup. But I am.

Maybe there isn't a perfect solution.

Thanks for the ideas, though.
User avatar
Posts: 4058
Joined: 11 Jun 2019

xCSxXenon

Then you will definitely need a batch script that first checks if Firefox is open and then prompts you if it is.
Here you go:
@echo off

:checkFirefox
tasklist /fi "ImageName eq firefox.exe" /fo csv 2>NUL | find /I "firefox.exe">NUL
if "%ERRORLEVEL%"=="0" goto firefoxOpen
goto runSync

:firefoxOpen
cls
echo.
echo Firefox is running!
CHOICE /c cq /n /m "Press [C] to kill Firefox and continue or [Q] to quit"
IF %errorlevel%==1 goto killAndContinue
IF %errorlevel%==2 goto quit

:killAndContinue
taskkill /f /im firefox.exe
goto runSync

:runSync
cls
echo.
echo Running FFS sync!
"C:\Program Files\FreeFileSync\FreeFileSync.exe" "X:\PATH\TO\YOUR\FFS_BATCH\CONFIG"
goto quit

:quit
exit
I have also attached it for download. As always, make sure you trust and inspect random things you download from random strangers on the internet lol
You can copy/paste that code into your own batch script if you are more comfortable. You will have to change the path to your FFS batch configuration file.
Attachments
Sync Firefox Profile.bat
(587 Bytes) Downloaded 537 times
Posts: 1038
Joined: 8 May 2006

therube

Just noting...

Force terminating Firefox (taskkill /f) potentially could lead to corruption.
Better, IMO, to heed the "or [Q] to quit" (& manually close FF).
(Likewise, taskkill will close all instances of FF [if you happen to run multiple instances simultaneously - perhaps not too common, but I am apt to].)
User avatar
Posts: 4058
Joined: 11 Jun 2019

xCSxXenon

Just noting...

Force terminating Firefox (taskkill /f) potentially could lead to corruption.
Better, IMO, to heed the "or [Q] to quit" (& manually close FF).
(Likewise, taskkill will close all instances of FF [if you happen to run multiple instances simultaneously - perhaps not too common, but I am apt to].) therube, 27 Aug 2024, 16:17
Ehhh, technically maybe, but the chances of corrupting anything are extremely tiny, almost impossible. But that is why the choice is given and it is worded as "kill Firefox"
Posts: 4
Joined: 25 Aug 2024

one1

Thank you so much!

I'm new to this… do I understand correctly that I would need to use this to do the backup from the command-line?
User avatar
Posts: 4058
Joined: 11 Jun 2019

xCSxXenon

No, a batch script is a collection of command-lines, ran in order like a program. If you create a batch script (.bat file), or download the one I attached, you can simply double-click it to run. As I said, after saving the one I provided, you will have to right-click it and edit it. You will have to change the path to your .ffs_batch file