How to create a RAM disk in RAM using Windows Server
A RAM disk is a virtual disk created in a free area of RAM that is perceived by the operating system as a separate physical disk. Due to the fact that the RAM disk is stored in fast RAM, all read / write operations from such a disk are performed almost instantly, even faster than when using an SSD drive (for the most productive SSD, the data transfer rate is now about 560MB / s, while DDR4 memory has 12000-25000MB / s).
RAM disk usage is advisable in systems with an excess of RAM. On such a RAM disk, you can place the cache and temporary files of applications / systems, temporary SQL databases, thus you can achieve a significant increase in application performance.
There are no built-in RAM disk creation tools in the Windows operating system, so for this purpose you have to use third-party programs (AMD RAMDisk, ImDisk, PassMark OSFMount, StarWind RAM Disk, etc.).
However, in Windows Server you can create a RAM disk without using third-party programs. To do this, you can use the iSCSI driver.
First of all, the iSCSI Target Server component (included in the File and Storage Services role) must be installed on the server.
If your Windows firewall is enabled, you must allow traffic for the iSCSI Service.
To allow traffic to the loopback interface for iSCSI, in the HKLM \ Software \ Microsoft \ iSCSI Target registry branch, change the DWORD value of the AllowLoopBack parameter to 1. You can change the registry key from PowerShell with one command:
Set-ItemProperty -Path ‘HKLM: \ SOFTWARE \ Microsoft \ iSCSI Target’ -Name AllowLoopBack -Value 1
Now open the PowerShell console and create a 5 GB virtual RAM disk with the command:
New-IscsiVirtualDisk -Path “ramdisk: testRAM.vhdx” -Size 5GB
Now you need to create an iSCSI target:
New-IscsiServerTarget -TargetName targetRAMDisk -InitiatorIds @ (“IPAddress: 10.1.1.200”)
Connect the RAM disk to the created iSCSI target
Add-IscsiVirtualDiskTargetMapping -TargetName targetRAMDisk -DevicePath “ramdisk: testRAM.vhdx”
Now you need to run the iSCSI Initiator console through Server Manager
On the Targets tab, specify the IP address of your server, click Quick Connect and connect your iSCSI target.
Now open the disk management console and check that you have a new 5 GB disk. This is the same RAM disk. Initialize, partition and format this disk. Assign him a drive letter.
Now you can transfer the necessary files to the RAM disk and reconfigure the software to use this disk.
After the server reloads, the RAM disk is deleted (along with all its contents) and it needs to be recreated again.
In some third-party programs for creating RAM disks, it is possible to save RAM disk data to a file on a hard disk. After the system is rebooted, the data is extracted and placed on the RAM disk.