Move firefox profile and cache into RAM tmpfs.
Relocating firefox's profile and cache into tmpfs of RAM; speed up firefox and save your hard drive's lifespan and space.
Change XXXX.UserProfile to exactly to your path of course.
creating backup locations first:
edit your /etc/fstab add following lines files will be mounted on firefox original locations, profile and cache:
Before you mount these drives, you need backup all its files, and clean these space, needs root to mount all these new ram drive partitions.
Add following lines into your .bash_profile, which will copy your backup firefox cache and profile into memory disk whenever you login.
now creating a script to manual sync your firefox profile and cache, which can be used by cron job too:
vim ~/sbin/firefox_sync
save it then chmod 700 make it manually executable. You can use this script in .bash_logout or crontab -e .
Go to firefox preference, security and privacy; override automatic cache management and change its size to anything less than 250MB.or modify firefox's options in user.js/about:config:
more info of user.js you can consult with kb.mozillazine.org/User.js_file and or ghacks.net user.js
Good luck.
Change XXXX.UserProfile to exactly to your path of course.
creating backup locations first:
Code:
mkdir ~/backup/firefox.profile mkdir ~/backup/firefox.cache chmod 700 ~/backup/firefox.*
Code:
tmpfs your_home/.mozilla/firefox/XXXX.UserProfile tmpfs size=250M,user,exec,uid=uid#,gid=100 0 0 tmpfs your_home/.cache/mozilla/firefox/XXXX.UserProfile tmpfs size=250M,user,exec,uid=uid#,gid=100 0 0
Code:
cd ~/.mozilla/firefox/XXXX.UserProfile cp -a * ~/backup/firefox.profile cd ~/.cache/mozilla/firefox/XXXX.UserProfile cp -a * ~/backup/firefox.cache
Code:
if [ "$(find $HOME/.mozilla/firefox/XXXX.UserProfile/ -maxdepth 0 -empty)" ]; then rsync -ah $HOME/backup/firefox.profile/ $HOME/.mozilla/firefox/XXXX.UserProfile/ --delete-before else echo -n "firefox profile is already filled "; fi if [ "$(find $HOME/.cache/mozilla/firefox/XXXX.UserProfile/ -maxdepth 0 -empty)" ]; then rsync -ah $HOME/backup/firefox.cache/ $HOME/.cache/mozilla/firefox/XXXX.UserProfile/ --delete-before else echo " cache is already restored"; fi sleep 0.1
vim ~/sbin/firefox_sync
Code:
#!/bin/sh #check both directory exist then back up when there is no lock file inside firefox profile if [[ -d ~/.mozilla/firefox/XXXX.UserProfile ] && [-d ~/.cache/mozilla/firefox/XXXX.UserProfile]] && [[ -d ~/backup/firefox.profile ] && [-d ~/backup/firefox.cache ]]; then if [ -L ~/.mozilla/firefox/XXXX.UserProfile/lock ]; then echo "lock file exist" exit 1 else rsync -ah ~/.mozilla/firefox/XXXX.UserProfile/ ~/backup/firefox.profile/ --delete-before rsync -ah ~/.cache/mozilla/firefox/XXXX.UserProfile/ ~/backup/firefox.cache/ --delete-before fi; fi sleep 0.1 exit 0
Go to firefox preference, security and privacy; override automatic cache management and change its size to anything less than 250MB.or modify firefox's options in user.js/about:config:
Code:
user_pref("browser.cache.disk.capacity", 234496); user_pref("browser.cache.disk.smart_size.enabled", false); user_pref("browser.cache.disk.smart_size.first_run", false); user_pref("browser.cache.memory.enable", false);
Good luck.
Total Comments 1
Comments
-
This is a great guide, very similar to this one. Would you know on Linux how to affect all profiles, e.g., some where in the /usr/lib64/firefox path?
Posted 01-25-2018 at 11:05 AM by RobbieTheK