User Tools

Site Tools


information-technology:2018-ramdrive

RamDrive

A ramdrive, or ramdisk, is an imaginary hard drive that exists in memory (RAM). Hard drives are bottlenecks, as reading data off of them is slow. When you make use of a file, the computer loads the file into RAM so it can work with it more quickly.

Ramdrives are good for caches and temporary files. A web browser, for example, keeps a cache of website files you have visited. These are stored on the hard drive, as they may or may not be used in the future. If you visit a site that you've visited before, the browser checks the cache for the site's files, and uses those instead of downloading the same files again. Part of maintaining your computer, is periodically deleting caches and temporary files. If you tell your web browser, to store its cache on a ramdrive, the files will disappear when you turn off the computer. Another benefit to keeping the cache on the ramdrive, is improved speed in web browsing, since reading files from RAM is faster than from the hard drive or from the web. Hard disk performance is improved also because it is a bottleneck (less drive thrashing if you are multitasking).

I used imdisk virtual disk driver (open source)

Installing imdisk adds a file to the system32 folder (um… yeah I'm still on an old machine), so it is available from the command prompt.
I ran the command to install a persistent 200mb ramdrive mounted on z:
imdisk -a -s 200m -m z: -p “/fs:fat32 /v:ramdrive /q /y” -P
This will not immediately take out 200mb of memory from your system, as it only uses what it needs.

Unfortunately, I found that although this formats the ramdrive with a file system, when you reboot the computer, the ramdrive is not reformatted. So I set up a windows service to format the drive, and made it dependent on the imdisk service, so it wouldn't start until the imdisk service was already running. I used AutoExNT, but you can also use srvany. You need to use these fancy things, because the service manager expects the service to communicate with it. So in this case, I couldn't just use a batch file to format the z:\ drive, I needed a service wrapper for this batch file.

The batch file is simply:

start format z: /q /x /v:ramdisk /fs:fat32
net stop AutoExNT
exit

You can set Firefox / Pale Moon to use the ramdrive for the cache, as follows ( source):

  1. Type about:config into the location bar and press enter
  2. Right-click somewhere in the list and select “New > String”
  3. For the name of the preference type browser.cache.disk.parent_directory
  4. For its value type the path to where you want to store the cache (use a folder within z:\, such as z:\palemoon)
  5. Next locate the preference browser.cache.disk.enable, it must be set to true, if it is not, double-click on it to change its value

If you disable the browser cache, there can be unwanted side effects. Also, you will lose the logged-in status of many websites, and other goodies that are stored in the cache (now exclusively stored in RAM), upon closing the web browser. Which can be tedious if you are restarting the web browser periodically. I restart the browser, without restarting the computer, because the web browser tends to consume more and more RAM the longer you use it. Having the cache in the ramdrive, rather than outright disabling it, gives me continuity. Web browsing is also faster, as mentioned previously, because it takes longer to download a website file than it does to read it from RAM.

You could also move the Windows temp folder to the ramdrive, but sometimes when you install software that needs a reboot, files that are in the temp folder are needed upon reboot. If they were located in the temp folder on the ramdrive, they will no longer exist when the computer restarts. Temp files are also files that you may want to recover if your system crashes. They may have something you were working on but had not saved yet.

information-technology/2018-ramdrive.txt · Last modified: 2019/06/06 08:58 by marcos