Tuesday, 7 February 2012

how to create a RAM disk in Windows 7 Professional 64-bit....

i've just taken delivery of a shiny new laptop with an SSD primary drive and a large amount of RAM.

in order to reduce the frequency of writes to the SSD i have decided to use a RAMDisk for my browser cache and for programs to have as a scratch directory....

i had a look around and decided that the free version of Dataram RAMDisk is probably sufficient for my needs, offering a free way to create up to a 4GB RAM disk.

however, being free it has its limitations and a problem that quickly became apparent is that since the ramdisk is created fresh at every reboot the drive letter that is assigned to the RAMdisk is dynamic. this is a problem because most programs write to a specific path for their temp directory....

so....in order to overcome this issue we can do the following:

1. fix the label of the RAMDisk using the configuration utility

2. create a batch script that searches for the RAMDisk volume and then manually assigns a drive letter to it. this can be done with the diskpart utility that is available from the command line. my script looks for a volume named RAMDISK and assigns the drive letter R: to it. (if you re-create the batch script from pastebin and decide to test it, be sure to run it from a command prompt that is run as an administrator, otherwise it won't work)
put the batch script somewhere easily accessible...like C:\

3. configure your computer to run the batch script on startup.....

hit Win + R (or Start > Run) and run gpedit.msc (if you're running Windows 7 Home you probably won't have gpedit.msc so you'll have to use Task Scheduler instead....google it)

under Local Computer Policy > Computer Configuration > Windows Settings > Scripts (Startup/Shutdown) double click on Startup.

Click Add, browse to the location of the script, leave the parameters box blank and click OK.

It should look something like.....

that's it.....reboot and the ramdisk will always be assigned the correct drive letter

No comments:

Post a Comment