Jump to content











Photo
* * * * * 1 votes

Firefox in RAM drive (with auto-load and auto-save features)


  • Please log in to reply
16 replies to this topic

#1 Amr Abdel Aziz

Amr Abdel Aziz
  • Members
  • 9 posts
  •  
    Egypt

Posted 03 October 2012 - 05:42 PM

I have created a useful script for ImDisk and I want to share it with you.

Easy 4 steps to install firefox to ImDisk RAM drive. (With autoload on startup and autosave at shutdown)The result is that firefox will run blazingly fast, even with many addons installed and many tabs are open. The changes made to contents of the RAM drive will not be lost on shutdown or restart.

This script works well on Windows 7 with UAC disabled.

Paste the following lines to a text file and save it as ramdisk-setup.cmd

@echo off

::--------------------------------------------------------------
:: YOU CAN EDIT THE RAM DISK SETTINGS HERE BEFORE RUNNING SCRIPT
::--------------------------------------------------------------
SET ramdrv=T:
SET ramsize=200M
SET ramfs=fat32
SET ramlabel=RAMDISK
SET backupimg=D:908sx3yr
::--------------------------------------------------------------

if "%1"=="autoload" goto :autoload
if "%1"=="autosave" goto :autosave

rem -- install routine
echo The script will create a RAM disk with the following settings:
echo ramdrv=%ramdrv%
echo ramsize=%ramsize%
echo ramfs=%ramfs%
echo ramlabel=%ramlabel%
echo backupimg=%backupimg%
echo.&pause
copy /y "%~f0" "%SystemRoot%system32ramdisk.cmd"
SCHTASKS /Create /TN "Ramdisk Autoload" /RU SYSTEM /SC onstart /TR "'%SystemRoot%system32ramdisk.cmd' autoload" /RL HIGHEST /F
SCHTASKS /Create /TN "Ramdisk Autosave" /RU SYSTEM /SC ONEVENT /EC System /MO "*[System[Provider[@Name='USER32'] and EventID=1074]]" /TR "'%SystemRoot%system32ramdisk.cmd' autosave" /RL HIGHEST /F
imdisk -a -s %ramsize% -p "/fs:%ramfs% /q /y" -m %ramdrv%
label %ramdrv% %ramlabel%
echo.
echo Now install firefox to ram drive %ramdrv%

echo Then, move firefox profile folder and cache folder to ram drive
echo.&pause
goto :eof

:autoload
imdisk -a -s %ramsize% -p "/fs:%ramfs% /q /y" -m %ramdrv%
label %ramdrv% %ramlabel%
robocopy %backupimg% %ramdrv% /dcopy:t /mir >nul
goto :eof

:autosave
robocopy %ramdrv% %backupimg% /dcopy:t /mir >nul
imdisk -d -m %ramdrv%



I hope you find it useful :-)

Edited by Amr Abdel Aziz, 03 October 2012 - 06:21 PM.


#2 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 03 October 2012 - 11:45 PM

Useful indeed! Thank you very much ;)

#3 Amr Abdel Aziz

Amr Abdel Aziz
  • Members
  • 9 posts
  •  
    Egypt

Posted 04 October 2012 - 04:57 AM

I have found a bug that will prevent ImDisk ramdisk creation on startup only if the laptop is on battery power. The bug is due to the default power settings of scheduled tasks created by using SCHTASKS command line. Create a task first by using SCHTASKS. Then, run the below vbs script to fix power settings of the scheduled task.

This script works well on Windows 7 with UAC disabled.

Paste the following lines to a text file and save it as ramdisk-setup.cmd

@echo off

::--------------------------------------------------------------
:: YOU CAN EDIT THE RAM DISK SETTINGS HERE BEFORE RUNNING SCRIPT
::--------------------------------------------------------------
SET ramdrv=T:
SET ramsize=200M
SET ramfs=fat32
SET ramlabel=RAMDISK
SET backupimg=D:908sx3yr
::--------------------------------------------------------------

if "%1"=="autoload" goto :autoload
if "%1"=="autosave" goto :autosave

rem -- install routine
echo The script will create a RAM disk with the following settings:
echo ramdrv=%ramdrv%
echo ramsize=%ramsize%
echo ramfs=%ramfs%
echo ramlabel=%ramlabel%
echo backupimg=%backupimg%
echo.&pause
copy /y "%~f0" "%SystemRoot%system32ramdisk.cmd"
SCHTASKS /Create /TN "Ramdisk Autoload" /RU SYSTEM /SC onstart /TR "'%SystemRoot%system32ramdisk.cmd' autoload" /RL HIGHEST /F
SCHTASKS /Create /TN "Ramdisk Autosave" /RU SYSTEM /SC ONEVENT /EC System /MO "*[System[Provider[@Name='USER32'] and EventID=1074]]" /TR "'%SystemRoot%system32ramdisk.cmd' autosave" /RL HIGHEST /F

cscript.exe ScheduledTaskPowerSettings.vbs "Ramdisk Autoload"
cscript.exe ScheduledTaskPowerSettings.vbs "Ramdisk Autosave"

imdisk -a -s %ramsize% -p "/fs:%ramfs% /q /y" -m %ramdrv%
label %ramdrv% %ramlabel%
echo.
echo Now install firefox to ram drive %ramdrv%
echo Then, move firefox profile folder and cache folder to ram drive
echo.&pause
goto :eof

:autoload
imdisk -a -s %ramsize% -p "/fs:%ramfs% /q /y" -m %ramdrv%
label %ramdrv% %ramlabel%
robocopy %backupimg% %ramdrv% /dcopy:t /mir >nul
goto :eof

:autosave
robocopy %ramdrv% %backupimg% /dcopy:t /mir >nul
imdisk -d -m %ramdrv%



Paste the following lines to a text file and save it as 'ScheduledTaskPowerSettings.vbs' in the same folder as 'ramdisk-setup.cmd'

' Create a task first by using SCHTASKS. Then, run a command similar to this to fix task power settings:
' cscript.exe ScheduledTaskPowerSettings.vbs "My Scheduled Task"

Option Explicit
Const TASK_UPDATE = &H4
Const TASK_DONT_ADD_PRINCIPAL_ACE = &H10
Dim TaskName, objTaskService, objRootFolder, objTask, objDefinition

If Wscript.Arguments.Count <> 1 Then Err.Raise 1, "Invalid command line arguments!"

TaskName = Wscript.Arguments.Item(0)

Set objTaskService = CreateObject("Schedule.Service")
objTaskService.Connect
Set objRootFolder = objTaskService.GetFolder("")
Set objTask = objRootFolder.GetTask ("" & TaskName)
Set objDefinition = objTask.Definition
objDefinition.Settings.DisallowStartIfOnBatteries = false
objDefinition.Settings.StopIfGoingOnBatteries = false
objDefinition.Settings.StartWhenAvailable = true
objDefinition.Settings.Compatibility = 2
objRootFolder.RegisterTaskDefinition objTask.Name, objDefinition, TASK_UPDATE or TASK_DONT_ADD_PRINCIPAL_ACE, , , objDefinition.Principal.LogonType

Wscript.echo "ScheduledTaskPowerSettings.vbs: " & TaskName & " has successfully been fixed"

#4 Amr Abdel Aziz

Amr Abdel Aziz
  • Members
  • 9 posts
  •  
    Egypt

Posted 05 October 2012 - 02:56 PM

Here is a revised version of ramdisk-setup.cmd
  • Checks that the script is run under Windows Vista/7/8. Windows XP is not supported.
  • Checks that script is run as administrator or UAC is disabled.
  • Checks for ImDisk installation and that its service is running.
  • Checks for an already existing drives with the same letter as choosen by the user.

@echo off

::--------------------------------------------------------------
:: YOU CAN EDIT THE RAM DISK SETTINGS HERE BEFORE RUNNING SCRIPT
::--------------------------------------------------------------
SET ramdrv=T:
SET ramsize=200M
SET ramfs=fat32
SET ramlabel=RAMDISK
SET backupimg=D:908sx3yr
::--------------------------------------------------------------

if "%1"=="autoload" goto :autoload
if "%1"=="autosave" goto :autosave

rem -- install routine

ver|find /i "XP">nul && echo ERROR: this script is supported only on Windows Vista/7 && pause>nul && exit
whoami /all|find "S-1-16-12288">nul || echo ERROR: please run script as administrator or turn off Windows UAC && pause>nul && exit
sc query ImDskSvc | find /i "RUNNING" >nul || echo ERROR: ImDisk is not installed or ImDskSvc service is not running && pause>nul && exit

echo The script will create a RAM disk with the following settings:
echo ramdrv=%ramdrv%
echo ramsize=%ramsize%
echo ramfs=%ramfs%
echo ramlabel=%ramlabel%
echo backupimg=%backupimg%
echo.&pause

cd %ramdrv% >nul 2>&1 && echo ERROR: cannot create a RAM disk because there is an already existing drive %ramdrv%. && echo Please edit the script to choose one of the following unused drive letters:
cd %ramdrv% >nul 2>&1 && (for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (cd %%i: >nul 2>&1 || echo %%i:)) && pause>nul && exit

copy /y "%~f0" "%SystemRoot%system32ramdisk.cmd"
SCHTASKS /Create /TN "Ramdisk Autoload" /RU SYSTEM /SC onstart /TR "'%SystemRoot%system32ramdisk.cmd' autoload" /RL HIGHEST /F
SCHTASKS /Create /TN "Ramdisk Autosave" /RU SYSTEM /SC ONEVENT /EC System /MO "*[System[Provider[@Name='USER32'] and EventID=1074]]" /TR "'%SystemRoot%system32ramdisk.cmd' autosave" /RL HIGHEST /F

cscript.exe "%~dp0ScheduledTaskPowerSettings.vbs" "Ramdisk Autoload"
cscript.exe "%~dp0ScheduledTaskPowerSettings.vbs" "Ramdisk Autosave"

imdisk -a -s %ramsize% -p "/fs:%ramfs% /q /y" -m %ramdrv%
label %ramdrv% %ramlabel%
echo.
echo Now install firefox to ram drive %ramdrv%
echo Then, move firefox profile folder and cache folder to ram drive
echo.&pause
goto :eof

:autoload
imdisk -a -s %ramsize% -p "/fs:%ramfs% /q /y" -m %ramdrv%
label %ramdrv% %ramlabel%
robocopy %backupimg% %ramdrv% /dcopy:t /mir >nul
goto :eof

:autosave
robocopy %ramdrv% %backupimg% /dcopy:t /mir >nul
imdisk -d -m %ramdrv%



You still need the file 'ScheduledTaskPowerSettings.vbs' in the same folder as 'ramdisk-setup.cmd' (can be found in post #3 above)

Edited by Amr Abdel Aziz, 05 October 2012 - 03:03 PM.


#5 bluespy

bluespy

    Member

  • Members
  • 31 posts

Posted 02 January 2013 - 02:34 AM

I've just executed "ramdisk-setup.cmd" on windows 8 x64 pro, but a question is "system32ramdisk.cmd" at

 

 

SCHTASKS /Create /TN "Ramdisk Autoload" /RU SYSTEM /SC onstart /TR "'%SystemRoot%system32ramdisk.cmd' autoload" /RL HIGHEST /F
SCHTASKS /Create /TN "Ramdisk Autosave" /RU SYSTEM /SC ONEVENT /EC System /MO "*[System[Provider[@Name='USER32'] and EventID=1074]]" /TR "'%SystemRoot%system32ramdisk.cmd' autosave" /RL HIGHEST /F

 

The file "Windowssystem32ramdisk.cmd" is at "c:\".

 

I thought this file name included path, but I could not know how to fix it.


Edited by bluespy, 02 January 2013 - 02:34 AM.


#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14707 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 January 2013 - 12:32 PM

Wait a minute.

There is something that simply does not sound right.

these:

 

 

 

copy /y "%~f0" "%SystemRoot%system32ramdisk.cmd"
SCHTASKS /Create /TN "Ramdisk Autoload" /RU SYSTEM /SC onstart /TR "'%SystemRoot%system32ramdisk.cmd' autoload" /RL HIGHEST /F
SCHTASKS /Create /TN "Ramdisk Autosave" /RU SYSTEM /SC ONEVENT /EC System /MO "*[System[Provider[@Name='USER32'] and EventID=1074]]" /TR "'%SystemRoot%system32ramdisk.cmd' autosave" /RL HIGHEST /F

(please note how the last two lines should be actually a SINGLE line in the batch)

Have a mistake.

%Systemroot% will expand to C:\Windows (WITHOUT the ending backslash) AND it makes very little sense to have a batch file called EITHER of "Windowssystem32ramdisk.cmd" or "system32ramdisk.cmd" a "plainer" "ramdisk.cmd" would be more appropriate (and possibly the intended result).

 

So, if you want the file to be called "ramdisk.cmd" AND be in "C:\Windows\system32\" (where it should actually be), you need to add two backslashes:

 

 

%SystemRoot%\system32\ramdisk.cmd

in every occurrence.

 

:cheers:

Wonko


  • bluespy likes this

#7 bluespy

bluespy

    Member

  • Members
  • 31 posts

Posted 02 January 2013 - 01:49 PM

Wonko the Sane /

 

Thanks, and please confirm this is right.

 

copy /y "%~f0" "%SystemRoot%\system32\ramdisk.cmd"
SCHTASKS /Create /TN "Ramdisk Autoload" /RU SYSTEM /SC onstart /TR "'%SystemRoot%\system32\ramdisk.cmd' autoload" /RL HIGHEST /F
SCHTASKS /Create /TN "Ramdisk Autosave" /RU SYSTEM /SC ONEVENT /EC System /MO "*[System[Provider[@Name='USER32'] and EventID=1074]]" /TR "'%SystemRoot%\system32\ramdisk.cmd' autosave" /RL HIGHEST /F
cscript.exe "%~dp0ScheduledTaskPowerSettings.vbs" "Ramdisk Autoload"
cscript.exe "%~dp0ScheduledTaskPowerSettings.vbs" "Ramdisk Autosave"


#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14707 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 January 2013 - 01:58 PM

Wonko the Sane /

 

Thanks, and please confirm this is right.

Yep, it seems OK.

 

:cheers:

Wonko


  • bluespy likes this

#9 Boogyxy

Boogyxy

    Newbie

  • Members
  • 29 posts
  •  
    Canada

Posted 11 January 2016 - 06:16 AM

Is this script still relevent/working as by now ?

or is there any another reccommended method to run a Full Firefox (non-portable version) from within our imdisk RAM Drive ?



#10 Boogyxy

Boogyxy

    Newbie

  • Members
  • 29 posts
  •  
    Canada

Posted 11 January 2016 - 07:34 AM

Is this script still relevent/working as by now ?

or is there any another reccommended method to run a Full Firefox (non-portable version) from within our imdisk RAM Drive ?

Also, other than the Profile.ini modif, and Profiles folder relocation, as well as the browser.cache.disk.parent_directory modif

Is there anything more to be done to get the most out of the RAM Drive benefits on Firefox ?

 

I've heard many contradictory indication from couple different forums.. I thought asking here would be a safe bet..

Such indication were :

 

browser.cache.disk.capacity 700000 (700MB)
browser.cache.disk.enable true
browser.cache.disk.parent_directory R:\ (the one mentioned above)
browser.cache.memory.enable false
browser.cache.memory.capacity 700000
browser.cache.offline.enable false
browser.cache.offline.capacity 512000
source: http://forums.mozill...p?f=7&t=2753675

 

and.. so many more:

browser.cache.memory.capacity;-1

browser.cache.frecency_half_life_hours;6

browser.cache.disk.smart_size.first_run

browser.cache.disk.metadata_memory_limit

browser.cache.disk.max_entry_size;51200

browser.cache.disk.preload_chunk_count

cache.disk.free_space_soft_limit

browser.cache.disk.max_priority_chunks_memory_usage;10240

Actually, to get the most out of a whole browser to RAM Drive relocation, we would all benefits from building some more in-dept list of such config to be modified .. no ?

 

 

Also,
I'm not sure that Firefox handled entierely on the RAM Drive after those only manipulation.. I mean, Firefox involves running tons of files located disperately in a total of 15 directories or more:

 

ie:
C:\Temp\NVIDIA
C:\Windows\winsxs\
C:\Windows\SysWOW64\
C:\Windows\System32\
C:\Windows\ServiceProfiles\LocalService\AppData\Local\
C:\Windows\Globalization\Sorting\
C:\Windows\Fonts\
C:\Users\user\AppData\Roaming\Mozilla\Firefox\Profiles\
C:\Users\user\AppData\Roaming\Microsoft\Windows\IETldCache\
C:\Users\user\AppData\Roaming\Microsoft\Windows\Cookies\
C:\Users\user\AppData\Local\Microsoft\Windows\Temporary
C:\Users\user\AppData\Local\Microsoft\Windows\History
C:\Users\user\AppData\Local\Microsoft\Windows\Caches\
C:\ProgramData\Microsoft\Windows\Caches\
C:\Program Files (x86)\Mozilla Firefox\
this, without including all the registry entries that comes with it.

This said, I have some hard time figuring out how those simple Firefox'S Profiles and Cache folders redirection are supposed to profile the most out of RAM Drive's benefit as a Firefox browsing experience.. (note that it's still quite a huge improvement)

 

Finally, are you awware of approximately how much I/O the "Xul.dll" file involve on drive, if any ?
That crucial dll file isnt handled with the only "Profiles" and "Cache" folder redirections method..

 

In the end, I'd like to mention that i'm not english-native, so please forgive me for my weird speaking. focus on the content of my interrogation instead ;P, I'll easily understand your response

 

PS#2: this question was also posted on steam, in regards to the DimmDrive app, which is basically just yet another RAM Drive app: steamcommunity.com/app/337070/discussions/0/626329820747923424/#c458605613407697925

 

I know that's quite a long and hard read for you guys.. I'm not english-native and it's quite hard for me to reflect what I want in proper words.

 

You help will be very much appreciated..

Special Thanks to Mr. Lagerkvist and v77 for the whole imdisk project. keep it going!


Edited by Boogyxy, 11 January 2016 - 08:05 AM.


#11 Hydranix

Hydranix

    Newbie

  • Members
  • 18 posts
  •  
    United States

Posted 11 January 2016 - 05:35 PM

 

Is this script still relevent/working as by now ?

or is there any another reccommended method to run a Full Firefox (non-portable version) from within our imdisk RAM Drive ?

A portable version of firefox has all of the problems encountered in trying to contain the standard installation of firefox on a ramdisk solved. Why would you want to recreate all of the work others have put into making it portable when you would be doing exactly the same thing, but with the added drawback of having invalid entries for uninstallation, and dangling paths scattered throughout the registry?


  • Boogyxy likes this

#12 Boogyxy

Boogyxy

    Newbie

  • Members
  • 29 posts
  •  
    Canada

Posted 12 January 2016 - 02:45 AM

 

 

A portable version of firefox has all of the problems encountered in trying to contain the standard installation of firefox on a ramdisk solved. Why would you want to recreate all of the work others have put into making it portable when you would be doing exactly the same thing, but with the added drawback of having invalid entries for uninstallation, and dangling paths scattered throughout the registry?

 

 

Actually, the answer to this is my ignorance to the reason why some still uses a non-portable version of a software, when a portable version of that software does exist..  This ignorance always makes me hesitant to go with the portable version when the software is faily complex.. I do think i'm wrong.. but I'd need confirmation.

 

I'm there's absolutely no difference in terms of performance, proper fonction and compatibility then this solves my problem yea.



#13 Boogyxy

Boogyxy

    Newbie

  • Members
  • 29 posts
  •  
    Canada

Posted 27 January 2016 - 06:23 PM

Bumb

 

Typo: If there are absolutely no differences in terms of performance, proper fonction and compatibility then this solves my problem yea.

are there any ?


Edited by Boogyxy, 27 January 2016 - 06:23 PM.


#14 alacran

alacran

    Silver Member

  • .script developer
  • 875 posts
  •  
    Mexico

Posted 27 January 2016 - 10:23 PM

Firefox v44.0 Portable: http://portableapps....irefox_portable

 

alacran



#15 Boogyxy

Boogyxy

    Newbie

  • Members
  • 29 posts
  •  
    Canada

Posted 28 January 2016 - 01:16 AM

Firefox v44.0 Portable: http://portableapps....irefox_portable

 

alacran

 nuts ? how dare you don't ask to get your "Advanced" tag removed ? ... your post is not relevent, neither even useful somewhat..


Edited by Boogyxy, 28 January 2016 - 01:16 AM.


#16 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14707 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 28 January 2016 - 08:47 AM

nuts ? how dare you don't ask to get your "Advanced" tag removed ? ... your post is not relevent, neither even useful somewhat..

I guess that if you ask nicely, Nuno may trade in alacran's "Advanced user" and your "Members" with a couple of new titles, like "Good willing and misinterpreted" for alacran and "Unneededly Aggressive" for you, but they would probably be too long to fit in the available space. :(
 
All in all it would be easier if the "Advanced" and "Members" remain as they are and you simply tone down a bit your attitude. :whistling:

 

Rest assured that (to the best of my knowledge):

1) Firefox portable works fine

2) alacran provided a link to it

3) you should never anyway trust a stranger (or two) on the internet, so get it and try it, seeing for yourself if it "performance, proper fonction and compatibility" are up to your standards
 
 
 
:duff:
Wonko


  • Boogyxy likes this

#17 Boogyxy

Boogyxy

    Newbie

  • Members
  • 29 posts
  •  
    Canada

Posted 28 January 2016 - 12:59 PM

I guess that if you ask nicely, Nuno may trade in alacran's "Advanced user" and your "Members" with a couple of new titles, like "Good willing and misinterpreted" for alacran and "Unneededly Aggressive" for you, but they would probably be too long to fit in the available space. :(
 
All in all it would be easier if the "Advanced" and "Members" remain as they are and you simply tone down a bit your attitude. :whistling:

 

Rest assured that (to the best of my knowledge):

1) Firefox portable works fine

2) alacran provided a link to it

3) you should never anyway trust a stranger (or two) on the internet, so get it and try it, seeing for yourself if it "performance, proper fonction and compatibility" are up to your standards
 
 
 
:duff:
Wonko

 

I admit I was a bit too aggressive... I bet my misinformation filter and time-wasting-meter were a bit overwelmed at the same time, i'll clear some cache... 

 

Firefox: Actually, I was'nt able to find much ressources specifically aimed at listing a "in-depth" list of about:config's key to tweak to get optimal results out of FF running from RAM Drive

The culprit to my might just be some missing key-configs modification withing FF itself.. ?


Edited by Boogyxy, 28 January 2016 - 01:03 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users