Create a windows RAM disk

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.

The issue is that the ramdisk will not be persistent as it will be removed once the machine is stopped.

version: 2.1

  win: circleci/windows@2.2.0

      name: win/default
      shell: powershell.exe
      - 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"

choco install imdisk will install the imdisk software.

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

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.