The Broadband Guide
SG
search advanced

Ramdisk Guide

It's lightning fast, it's cool, it's... Volatile !
2003-05-05 (updated: 2009-11-06) by
Tags:

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:

  1. Download and uncompress the Ramdisk driver in an empty directory you can remember: Ramdisk Driver  
     
  2. 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.
     
  3. 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.)

Click to expand
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.

  User Reviews/Comments:
    rate:
   avg:
by anonymous - 2006-02-15 11:37
doesnt work on windows 2003 R2 x64:(
by Ravinder - 2006-03-05 16:48
Need a better RAM drive! Somethnig like VRAMDIR which:

-Allows you to assign ANY hard disk folders to the RAM drive
-Needs no memory pre-allocation
-Memory allocation expands/contracts automatically with addition/deletion of files.

VRAMDIR works great in Win98. Can anyone create same product for Win2k/XP? Then I can finally upgrade to XP! :)
by anonymous - 2006-04-23 03:25
I couldn't get the TCP/IP thing to work for windows xp it brought up the TCP thing and the ramdisk works fine and it even copied the two files like it was supposed to, but the internet wouldn't work and later on it get some message about the DHCP or something and ipconfig part in order for it to get the two files to be copied as well I had to modify the TCP.BAT file like so text between the lines anyways all that was changed was the c:\windows instead of c:\wintt or whatever it was since it's a different os and the directories are different for the drivers.

----------------------------------------------------------------------

@echo on

copy c:\windows\System32\DRIVERS\tcpip.sys Z:\
copy c:\windows\System32\DRIVERS\afd.sys Z:\

net start afd
net start tcpip
net start dhcp

ipconfig
@pause

-----------------------------------------------------------------------

Honestly I'm not sure what the mod is supposed to help/improve anyways but was thought it was worth trying it's just too bad it didn't work for me for some reason.
by anonymous - 2006-04-23 21:52
got it to work with the follow TCP.BAT also changed the registry for netbt and ipnat to point to the ramdrive the same way you do with afd and tcpip and it works now with windows xp, but the only thing I don't get is for some reason whenever windows starts the firewall is off by default and I have to enable it again each boot I wish I knew a fix for that

-------------------------------------------------------------------
@echo on

Echo Starting TCP/IP Services

copy c:\windows\System32\DRIVERS\netbt.sys z:\
copy c:\windows\System32\DRIVERS\tcpip.sys z:\
copy c:\windows\System32\DRIVERS\afd.sys z:\
copy c:\windows\System32\DRIVERS\ipnat.sys z:\
net start afd
net start tcpip
net start netbt
net start dhcp
by magnumb69 - 2006-04-26 22:17
I noticed that etrust suite is linked to netbt... windows firewall may be likewise... without driver loaded, firewall can't
by magnumb69 - 2006-04-26 22:18
I just got mine to work... load image of sys files on ramdisk, no net starts... the reg hacks take care of that.
by Enginere - 2006-07-06 13:31
Might want to explain yourself in more detail like wise loading sys files to ram disk some folks can follow directions very well when they are given the right path to take with good information. Add some detail to your suggestions even like wise short defined explanation wold be usefull very good information though.
by anonymous - 2007-01-19 11:55
i have tried this tweak on my xp sp2 machine & the network icon fails to get an IP. im thinking that this is because this guide seems to be for windows 2000, and the registries are probably very different. could you please indicate the proper registry entries as thewy apply to windows xp?

thank you
by vipulkadia - 2007-07-04 05:02
I have used the trial version of RAM Disk. I am quite happy with its functionality
by anonymous - 2007-09-12 11:43
Where is the SOURCE? I´m trying to create a 6GB ram drive, and I would like to start with your version as opposed to the MS one.
by anonymous - 2008-06-02 11:57
way too tiny to be of any use
by WardXmodem - 2008-06-21 10:26
I, too found the ram disk too small for MY uses.

I was wanting to capture directories of entire disks:
dir c:\ /s >z:080621-all-c..........dir
or export my entire registry, etc.

I wanted to do these things to avoid the disk seeking back and forth between the source and the redirected output file.

If anyone finds a large RAM disk (I have 2G on my machine and could give say 256M to it) Please reply.

Good site! Thanks!
by anonymous - 2008-11-21 13:06
This has instructions and provides drivers and a GUI for configuring larger ramdisks

http://www.mydigitallife.info/2007/05/27/free-ramdisk-for-windows-vista-xp-2000-and-2003-server/

I would make sure you uninstall any other ramdisk drivers you may already have installed, and then reboot. I had some problems, but once I removed all the drivers and use the GUI to install the driver from the archive, everything worked fine.

Good luck
by anonymous - 2009-12-13 22:00
Neat idea. I'll try on the few.

It's working under Ubuntu Linux too.

Step 1. Simply use the drive /dev/shm that comes preinstalled in every installation.
Don't worry about sizing, it's dynamic and will expand as needed, up to half of your
total memory.
by pyrax - 2009-12-30 23:16
Here is your fix my friends ...

to the batch file, you just have to add the following line ==>

net start sharedaccess


(this will start the internet connection sharing (ICS) service, so you won't have to do it manually each time)

Cheers !
News Glossary of Terms FAQs Polls Cool Links SpeedGuide Teams SG Premium Services SG Gear Store
Registry Tweaks Broadband Tools Downloads/Patches Broadband Hardware SG Ports Database Security Default Passwords User Stories
Broadband Routers Wireless Firewalls / VPNs Software Hardware User Reviews
Broadband Security Editorials General User Articles Quick Reference
Broadband Forums General Discussions
Advertising Awards Link to us Server Statistics Helping SG About