Hi All,
Right, here's a copy/paste of my draft document describing how I create and use Ram Disks...
I recently posted about my experimentation with ram disks resulting in my purchase of an extra 16gb of ram
solely for use as Ram Disk space. Original post is here:
Link
This additional topic is just a little guide of how I did it so other can have a play if they so desire.
Requirements:
- ImDisk, a FREE open source RamDisk Tool – available here: Link
Simply download the Windows Install package – it adds an ImDIsk Icon to your Control Panel – you can create a shortcut to this if you want, I did.
- Some spare ram. I tested initially with a 4gb maximum Ram Disk on my system with 8gb. I was just running applications / demos and testing. For my gamer I bought an additional 16gb of ram taking me to 24gb in total, so a plentiful 8gb for system and gaming and up to 16gb for my ram disk.
- An interest in playing around with a ram disk lol.
Setting up:
Download and install ImDisk from the link above, I’d recommend creating a shortcut on your desktop (or a toolbar if you prefer) to the ImDisk Icon in Control Panel.
Launching ImDisk from your shortcut (or direct from Control Panel) will present you with the basic ImDisk GUI. From here is very simple to create new Ram Disk following these steps:
- Select File -> Mount New Virtual Disk… or just click the “Mount New” button at the bottom.
- You can specify an Image File (to mount a previously saved Ram Disk) – leave blank for a new one.
- Pick a Drive Letter to use. (e.g. J)
- Enter the size of the drive, (e.g. 10)
- Select the unit to use from Bytes, Blocks, Kilobytes, Megabytes or Gigabytes
- Select Device Type, auto or Hard disk Volume work fine for a Ram Disk.
- Click OK.
- Your new Virtual Device will be mounted and you’ll be prompted to format it. Simply do a quick format, NTFS partition.
- Your drive is now ready to use as you see fit.
Automating stuff
So, you have a new virtual drive available. You can simply copy stuff to it manually and then run what you’ve copied directly from it. Some apps will only run from their
installed location; however the majority of stuff doesn’t seem to mind being copied and run from elsewhere in my experience. Just be aware of this though. Additionally, if you’re intending to copy a game, DRM might not like you running from a different location.
Now, you can copy stuff to your virtual drive and, via the GUI, easily save an Image of what you’ve added for loading later. This is fine and works well but in my case I’m doing this with a large (up to 16gb) ram disk for gaming purposes. I already have a working install of my games on my hard drive so I want that copied to my ram disk before I play. Rather than copying everything, saving the Ram Disk Image, then having to reload that image each time I decided to use a different method. This is because I mod my games so often change or tweak things, this means my saved Image would become obsolete fairly quickly and I’d need to create another.
With this in mind I decided to set up automated scripts (simple .bat files) to both initially create a Ram Disk of an appropriate size for the game I plan to run, as well as copy the data to the Ram Disk from my “master” game folder.
To create a simple ram disk you can use the following command line…erm, commands:
Code:
ImDisk -a -s 1G -m H: -p "/fs:ntfs /q /y"
label H: TESTDrive
I’ll explain what that means:
ImDIsk – the tool we’re using
-a – Attach virtual Disk (required)
-s 1G – Size 1 GigaByte, 1M would be one Megabtye
-m H: - Mount as H:
-p “/fs:ntfs /q /y” – Format Parameters , File System (fs) NTFS, Quick Format (/q) and confirm (/y)
Label H: TESTDrive – Give your new virtual drive H: a label
Next you actually want to copy some content to the drive. You can do this manually of course as previously mentioned. However I chose to use RoboCopy (a fast windows file copy method run from the command line) to populate my ram disk. See my example below.
Code:
Robocopy "D:\Games\Skyrim" "H:\Games\Skyrim" *.* /s /purge /MT:4 /r:1 /COPYALL /log+:h:\Robocopylog.log
The above explained:
Robocopy – the copy command, run from a command prompt
“D:\Games\Skyrim” – the location of my Skyrim game folder on my hard drive.
“H:\Games\Skyrim” – where I’m copying Skyrim to on my new Ram Disk.
*.* - all files to be copied
/s – Include sub-folders
/purge – remove any folders in the destination that no longer exist in the source (just being tidy)
/MT:4 – Number of threads to use to manage the copy job – 4 for my quad core.
/r:1 – Number of retries if there’s an error – default is like a million for some reason.
/COPYALL – a copy method.
Pop the above two in a .bat file and you can just double click the create scripts to create the ramdisk and format it. Then you can double clock the second one to populate the drive. Personally I’ve set up a new toolbar to hold these for all my games. Note: I also, after the copy, create a shortcut the the game for ease of running once everything is in place. These shortcuts should NOT be on a virtual drive of course lol.
Now, powering off or resetting your system will of course kill the ram disk. However, you can also script this too, if for example you need to free up that ram for something else. See the following code:
This translates to:
-D – Force Detach Ram drive, no saving of Image!
-m T: - it’s the drive mounted as T: we’re interested in.
Ok, these are the dead basics off automating setting up a ram disk and loading data to it. I’ve not covered saving and using images, other than a brief mention, as that can be done via the GUI. For me the Robocopy method from my current hard drive “master” game folder works nicely. It means that my ram disk will always be created with the latest version of my game folder.
If you have very static content you always want to copy to the ram disk, or you’ve actually done a proper Install to the ram drive, you’d likely want to SAVE the drive image and reload from it. I can document this approach later if needed. Note: when you save an image it will save the ENTIRE ram disk, so, if you had a 16gb ram disk, but only 10gb of it used, it will save a full 16gb .img file to disk. During testing we found this to be a little slower than the Robocopy method – even when the ram disk and content sizes were bang on. Odd but true.
Cheers,
Scoob.