Create a windows RAM disk

Overview

Creating a RAM disk allows for a portion of your RAM to be reserved for read/write operations very much like a HDD or SSD except at faster speeds.

 

Instructions

If you would like to create a ramdisk within CircleCI you can use the windows program imdisk which can be installed using the chocolatey package manager which comes preinstalled with the Windows executor.

Below you will find an example config.yml which will install the imdisk software and then create a ramdisk within the executor.

Note: Ramdisk is not persistent as it will be removed once the machine is stopped.

version: 2.1

orbs:
  win: circleci/windows@2.2.0

jobs:
  build:
    executor:
      name: win/default
      shell: powershell.exe
    steps:
      - checkout
      - run: systeminfo
      - run:
          name: "Install imdisk"
          shell: powershell.exe
          command: |
            choco install imdisk
      - run:
          name: "Imdisk"
          command: |
            imdisk -a -s 512M -m X: -p "/fs:ntfs /q /y"

The choco install imdisk will install the imdisk software using a program called chocolatey which is included in the windows image.

A breakdown of the imdisk command from the config.yml is given below:

  • -a initializes the virtual disk.
  • -s 512M is the size, 512 MegaBytes.
    The full choices are b, k, m, g, t, K, M, G, or T.
    These denote a number of 512-byte blocks, thousand bytes, million bytes, billion bytes, trillion bytes, KB, MB, GB, and TB, respectively.
  • -m X: sets up the mount point a.k.a. the drive letter, X:.
  • -p "fs:ntfs /q /y" formats the drive.
    -p's parameters are actually for Windows' format program.
    So, if you want the RAM disk in a different filesystem, just change ntfs to fat (FAT16) or fat32 (FAT32).

For more information on imdisk please see this link

 

Additional Resources:

Was this article helpful?
1 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.