As one can easily see reading my blog I truely love my RAMdisk. After experimenting with moving the cache of my Chrome installation to the RAMdisk I realized that the speed difference is quite small. So I finally found my perfect solution: I move my whole Chrome profile to the RAMdisk and I get an amazing speed gain (I suppose it is because of all the files that are written to during browsing like history etc.). Here is how I do it:
Most important and first of all: BACKUP YOUR PROFILE! Then backup it again. Did I mention that you should backup your profile? No? Then do it now!
Ok, then I installed Windows Server 2003 Resource Kit Tools from Microsoft to get RoboCopy, a superior command line tool. Then I created two batch files (.bat), one named “logon.bat” and one named “logoff.bat” (I put them into a seperate diectory like D:\scrpits but put it wherever you want – the only thing is that the directory should be accessible by every user who should use the scripts of course)). In the logon.bat I put the following line (please replace the parts where it says <username> with your actual username, e.g. bobby or HaX0R and adjust the drive letters (D is my hard drive, R my RAMdisk)) – it should actaully all be in one line:
robocopy "D:\Standalone\Iron\Profile" "R:\IronProfiles\<username>" /MIR /XD "D:\Standalone\Iron\Profile\Default\Cache" /LOG+:"D:\Standalone\Iron\<username>-backup.log"
All it does is copying the whole Chrome directory to the RAMdisk except the cache (it will be created each new each time) and writing a few lines to a log file (just to be save). On my EeePC 901 the copying takes a few seconds and is nearly not recognizable during boot. In the logoff.bat there is also one line:
robocopy "R:\IronProfiles\<username>" "D:\Standalone\Iron\Profile" /MIR /XD "R:\IronProfiles\<username>\Default\Cache" /LOG+:"D:\Standalone\Iron\<username>-backup.log"
This line copies all the changes back again except the cache (it will be deleted) to the harddrive and again write to the log file. But as we use robocopy and we also use a few nice arguments with it it is only a incemental backup so very few bytes are actually written. Again the copying process takes only a few seconds.
I then ran the logon.bat by doubleclicking it to have the whole profile copied to the RAMdisk once. Then I changed all my shortcuts to Chrome. Rightclick on one of them and select “Porperties”. Then add –user-data-dir=”R:\IronProfiles\<username>” to the “Target” (or change the link accordingly if the user-data-dir argument already exists). Do this for each and every of your shortcuts pointing to Chrome, even the “Application Shortcuts”! To test if your profile works from RAMdisk delete or rename your profile in the original directory (D:\Standalone\Iron\Profile in my example) – you made backups, right? Now start your Chrome. Is your “New Page”-Page correct? Then everything is fine. Otherwise you screwed up along the way. Restore your backup profile and start again.
Ok, so now we have the bat files to copy the profile forth and back and we have all shortcuts changed and Chrome still works great. Now on to the last step: automating the copying. Select “Run” from the start menu and execute “gpedit.msc”. In the Group policy console (gpedit.msc) under ‘User Configuration\Windows Settings\Scripts’, you can specify scripts that are to run when the user logs on or logs off the computer. These scripts run as User, not as Administrator. Doubleclick the Logon entry and create a new entry for your logon.bat in the opening dialog. Do the same for Logoff. Be careful to use the correct absolute paths to the bat files! Then close all the windows.
You should be set now. During your next logoff changes in the profile should be copied to your hd and on the next logon the whole profile is pull into the RAMdisk again. You can try this out by restarting your computer (or logging off and on but during restart your RAMdisk is emptied so the effect comes clearer).
But watch out: if you choose to delete your profile dir on the harddrive to have it copied to it from RAMdisk once (I did this just to try it) you will get a black screen during logout. The copying takes quite some time so Windows turns to black – don’t know why. Nothing is wrong then and you can sit through it. If you don’t wait till it’s done and turn off your computer to early (e.g. by holding the power button) the copy will be corrupted. My tip is not to try this after all.
If you want to add this on a multi user system you’ll have to change a few things. I already made a step in this direction by naming the directories on the RAMdisk after actual users. But in the RoboCopy command you would have to use variables for the username etc. As I only have a single user system I didn’t try such scenarios but I would appreciate hints and tips.