This guide provides easy to follow, step by step instructions on installing a RAM Disk in Win 2k/XP/2k3. Most of the general information applies to Windows 9x and most other operating systems as well, you'll just need to find/install your own RAM Disk driver.
First of all, make sure you've read this guide in its entirety and have a fairly good understanding of the benefits, pitfalls, as well as the process of installing the driver BEFORE actually implementing it. Please don't blame us if you decide to put your Windows directory in a RAM disk and can't locate it the next time you reboot your computer.
What is a RAM Disk ?
Ramdisk is a virtual drive created in RAM. The advantage being it's much faster than a Hard disk drive can ever be, since it has no moving parts - transfers are all electronic. There is a catch, however, RAM Disk is volatile storage, meaning data on it is lost the moment you lose power, or reboot the computer. RAM Disks also take away from your system's available RAM. Once you reserve a portion of the RAM for such disk, it is no longer available for your running programs.
How do I create one ?
The Ramdisk driver we use for this guide is almost identical and based on the Microsoft sample driver described here: Microsoft KB 257405. The version we use in this article fixes a bug with Windows XP and NTFS partitions (described in the MS KB article) and adds the ability to change drive letter and disk size in a more user-friendly way, using the Device Manager.
We can install/configure the Ramdisk in three simple steps:
- Download and uncompress the Ramdisk driver in an empty directory you can remember: Ramdisk Driver
- 2. In Control Panel -> Add/Remove Hardware, select Add a new device -> select hardware from a list -> Other(All) devices -> Have Disk, then point to the folder that contains the RAMDisk.inf file you extracted in step 1. Click next/finish to complete the driver installation.
- You can change the size / drive letter of your new Ramdisk from the Device manager: Right-click on My Computer, select Properties -> Hardware -> Device Manager -> expand the RAM Disk -> Properties
At this point you have successfuly installed and configured a RAM Disk drive on your system. Keep in mind that the contents of the RAM disk are lost when changing its size and/or drive letter in Device Manager! They are also lost if power is lost, computer rebooted, etc. You might want to reboot and copy some files to your new RAM disk from within Windows Explorer to ensure it's operating properly.
Notes: In Windows XP, you might have to go to Control Panel -> System to access the device manager. Depending on your OS, you might be prompted to reboot after the drive is installed. Keep in mind that the size of your Ramdisk is substracted from the available RAM, so don't use any wild values. Depending on the intended use, 1 - 16 MB should be the enough, even in systems with plenty of RAM.
What can use it for ?
It can be used to store temporary internet files, history, cookies, basically any information that's expendable and you need fast access to. Storing such files in a Ramdisk speeds up access time, extends the life of your Hard disk, and reduces fragmentation.
Below are some recommended uses for your new RAM Disk:
Internet Explorer temorary files
To move your IE temp files, do the following: From within IE, choose Tools -> Internet Options -> General -> Settins. Make sure the "Amount of disk space" slider shows fewer MB than your RAM Disk. I wouldn't use a value over 15-20 MB. Choose Move Folder, and your RAM Disk drive letter, click OK.
There are plenty of other uses for your new RAM Disk, try some and let us know how you use it. And if all this was not challenging enough for your taste, if you feel really adventurous, read on
Moving TCP/IP to the RAM Disk
Note this is an involved tweak intended only for advanced users comfortable with editing the Windows Registry (and backing it up), as well as reinstalling their OS as needed ;). It might provide only marginal performance gains, since drivers are supposedly ran from memory anyway. We're including it as it was actually developed in our forums with the help of many users, and it did seem to stabilize downloads somewhat. Don't shoot the messenger, make of it what you will.
1. Create a new text file (using Notepad, or any other text editor). Paste the text between the lines in it:
-----------------------------------------------------------------
@echo on
copy c:\winnt\System32\DRIVERS\tcpip.sys Z:\
copy c:\winnt\System32\DRIVERS\afd.sys Z:\
net start afd
net start tcpip
net start dhcp
ipconfig
@pause
-----------------------------------------------------------------
If you are using a different drive letter than "Z:" for your RAAM Disk, change it accordingly in the file above. Save the text file as tcp.bat, or somethingelse.bat and place it on your desktop or in a directory you can remember. Note the extension needs to be ".bat". You can double-click on the newly-created file and check your RAM Disk, it should contain the two files tcpip.sys and afd.sys copied to it.
2. Open your registry using Regedit, BACKUP (or export those two keys) in a directory you can remember before changing the following two values:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD
ImagePath = \??\Z:\afd.sys (where "Z" is your RAM Disk letter. Leave all other characters/question marks intact or it will not work.)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\ImagePath
ImagePath = \??\Z:\tcpip.sys (again, leave all special characters intact. The ?? before drive letters is critical.)
 |  NOTE: If you fail to backup the AFD and Tcpip keys, you won't be able to reverse any of the changes later. |
3. Create a shortcut for the tcp.bat file (or whatever you named it) and put it in your Startup menu (drag it to the START -> Programs -> Startup ) so it will be executed when you reboot the system. 4. Reboot and look at the black MS Dos screen that comes up, see whether you are getting an IP address and make sure you are able to go online.
5. If everything seems in order, remove the last two lines of code in the tcp.bat file, ( the "ipconfig" and "@pause"). They're there just for diagnostic purposes.
6. Enjoy, you made it.
If you want to reverse all this, you need to stop loading the script and reverse the two registry entries to their original paths. Simply restore your two Registry keys from the Backup you made and delete the shortcut to tcp.bat from your START -> Programs -> Startup menu. For those few that didn't backup the keys as asked, format your HD and reinstall Windows. Or... The Windows 2k3 Server default values are as follows:
HKLM\SYSTEM\CurrentControlSet\Services\AFD\ ImagePath = "\SystemRoot\System32\drivers\afd.sys"
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ ImagePath = "system32\DRIVERS\tcpip.sys"
Note the different capitalization and lack of backslash in the Tcpip key... This is a direct paste from the Win2k3 Registry, and since it's done by Microsoft it has to be correct ;)
Enjoy,
Philip
Note: This guide has been revised to support Windows 2003 Server and Windows XP NTFS partitions.