|
@@ -0,0 +1,168 @@
|
|
|
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
+ <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
|
|
+ <head>
|
|
|
+ <title>Windows Server 2012 2016 2019 2022 RAM Disk Setup Guide</title>
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ $(function(){
|
|
|
+ $('textarea').each(function(i,e){
|
|
|
+ theTextarea = $(this);
|
|
|
+ theTextarea.height((theTextarea[0].scrollHeight-5) +'px');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('li').each(function(i,e){
|
|
|
+ if(!$(this).hasClass('noCheckbox')){
|
|
|
+ var uuid = 'li_' + Math.floor(Math.random() * Math.floor(1000000)).toString() + '_' + i.toString();
|
|
|
+ $(this).contents().wrap('<span id="'+ uuid +'"><label for="cb_'+ uuid +'"></label></span>');
|
|
|
+ $(this).prepend('<input type="checkbox" class="completeBox" id="cb_' + uuid +'" rel="'+ uuid +'" />')
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('code,div.codeBlock,textarea.codeBlock').each(function(i,e){
|
|
|
+ theElement = $(this);
|
|
|
+ var lines = theElement.html().split("\n");
|
|
|
+ theElement.empty();
|
|
|
+ for(l=0;l<lines.length;l++){
|
|
|
+ if($.trim(lines[l]) != '' && $.trim(lines[l]).substr(0,1) != '#' && $.trim(lines[l]).indexOf(' #') == -1 && lines[l].substr(0, 4).toUpperCase() != 'REM '){
|
|
|
+ theElement.append('<input type="image" src="images/clipboard.png" value="" class="copy-text" rel="copy_'+ i +'_'+ l +'" data-clipboard-text="'+ $.trim(lines[l].replace(/"/g, '"')) +'" /><span id="copy_'+ i +'_'+ l +'">'+ lines[l] +'</span>');
|
|
|
+ } else {
|
|
|
+ theElement.append(lines[l]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click','input.copy-text',function(){
|
|
|
+ theButton = $(this);
|
|
|
+ $('input.copy-text').attr('src','images/clipboard.png');
|
|
|
+ $('span.copy-animation,span.copy-animation-ps').removeClass('copy-animation copy-animation-ps');
|
|
|
+ try {
|
|
|
+ if($('#'+ theButton.attr('rel')).parent('div').hasClass('PS')){
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation-ps');
|
|
|
+ } else if($('#'+ theButton.attr('rel')).parent('div').hasClass('CMD')){
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation-cmd');
|
|
|
+ } else {
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation');
|
|
|
+ }
|
|
|
+ navigator.clipboard.writeText(theButton.data('clipboard-text').replace(/<[^>]*>?/gm, ''));
|
|
|
+ theButton.attr('src','images/clipboard_active.png');
|
|
|
+ } catch(err) {
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click','input.completeBox',function(){
|
|
|
+ theBox = $(this);
|
|
|
+ $('#'+ theBox.attr('rel')).addClass('strikethrough');
|
|
|
+ theBox.prop('disabled',true);
|
|
|
+ theBox.parent('li').prevAll().each(function(i,e){
|
|
|
+ theLI = $(this);
|
|
|
+ if(theLI.find('input[type=checkbox]').not(':checked')){
|
|
|
+ $('#'+ theLI.find('input[type=checkbox]').attr('rel')).addClass('strikethrough');
|
|
|
+ theLI.find('input[type=checkbox]').prop('checked',true).prop('disabled',true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ if(window.self !== window.top){
|
|
|
+ window.parent.$('iframe.stepsFrame').height((this['scrollingElement']['scrollHeight']+20) +'px');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ <link href="css/steps.css" rel="stylesheet" type="text/css" />
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div id="gridContainer">
|
|
|
+ <div class="topMargin"></div>
|
|
|
+ <div id="listName" class="topMargin">
|
|
|
+ <h1>Windows Server 2012 2016 2019 2022 RAM Disk Setup Guide</h1>
|
|
|
+ </div>
|
|
|
+ <div></div>
|
|
|
+ <div id="content">
|
|
|
+ <p><em>NOTE: RAM disks by their very nature are cleared on reboot. Do not use them to store any data that cannot be lost. A suitable use case would be temporary session files for a web server</em></p>
|
|
|
+
|
|
|
+<h2>Installing iSCSI Target Server</h2>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Launch Server Manager if it does not automatically load
|
|
|
+ <ol>
|
|
|
+ <li>Click the Start button > Server Manager</li>
|
|
|
+ </ol>
|
|
|
+ </li>
|
|
|
+ <li>Click Manage > Add roles and features</li>
|
|
|
+ <li>Click Next on the Before you begin screen</li>
|
|
|
+ <li>Select Role-based or feature-based installation > Next</li>
|
|
|
+ <li>Leave Select a server from the server pool selected and select the current server > Next</li>
|
|
|
+ <li>Expand File and Storage Services > Expand File and iSCSI Services > Select iSCSI Target Server</li>
|
|
|
+ <li>A popup will appear with additional required roles and features, click the Add Features button</li>
|
|
|
+ <li>Click Next</li>
|
|
|
+ <li>Click Next on the Select features screen</li>
|
|
|
+ <li>Click Install on the confirmation screen</li>
|
|
|
+ <li>Leave the installation progress screen open until the install completes</li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<h2>Creating the RAM Disk</h2>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Launch Powershell as administrator</li>
|
|
|
+ <li>Enter the following commands to create the RAM disk, replacing the IP address with the current server's IP address
|
|
|
+ <div class="codeBlock PS"># allow iSCSI loopback registry setting<br />
|
|
|
+ Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\iSCSI Target' -Name AllowLoopBack -Value 1<br />
|
|
|
+ # start the iscsi initiator service<br />
|
|
|
+ Start-Service -Name MSiSCSI<br />
|
|
|
+ # set the iscsi initiator service to start automatically<br />
|
|
|
+ Set-Service -Name MSiSCSI -StartupType Automatic<br />
|
|
|
+ # create the ram disk, changing size as needed<br />
|
|
|
+ New-IscsiVirtualDisk -Path "ramdisk:RAMDisk.vhdx" -Size 256MB<br />
|
|
|
+ # initialize iSCSI target<br />
|
|
|
+ New-IscsiServerTarget -TargetName RAMDisk -InitiatorIds @("IPAddress:192.168.0.65")<br />
|
|
|
+ # connect to the ram disk<br />
|
|
|
+ Add-IscsiVirtualDiskTargetMapping -TargetName RAMDisk -DevicePath "ramdisk:RAMDisk.vhdx"</div>
|
|
|
+ </li>
|
|
|
+ <li>Back in Server Manager, select Tools > iSCSI Initiator</li>
|
|
|
+ <li>Enter the IP address in the Target field > Click Quick Connect...</li>
|
|
|
+ <li>Click Done</li>
|
|
|
+ <li>Back in Powershell, run the following command
|
|
|
+ <div class="codeBlock PS"># initialize the disk as NTFS<br />
|
|
|
+ Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -DriveLetter R -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "RAMDisk" -Confirm:$false</div>
|
|
|
+ </li>
|
|
|
+ <li>Open File Explorer and the new RAM disk should be listed as a usable NTFS drive</li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<h2>Re-creating the RAM Disk on Boot</h2>
|
|
|
+
|
|
|
+<p><em>After the RAM disk has been setup initially, follow the steps below to have it recreated on system boot.</em></p>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Open a text editor</li>
|
|
|
+ <li>Paste the following Powershell commands, changing the size as needed
|
|
|
+ <p>New-IscsiVirtualDisk -Path "ramdisk:RAMDisk.vhdx" -Size 256MB<br />
|
|
|
+ Add-IscsiVirtualDiskTargetMapping -TargetName RAMDisk -DevicePath "ramdisk:RAMDisk.vhdx"<br />
|
|
|
+ Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -DriveLetter R -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "RAMDisk" -Confirm:$false</p>
|
|
|
+ </li>
|
|
|
+ <li>Save the file as ramdisk.ps1 to a safe location to run from, c:\scripts for example</li>
|
|
|
+ <li>Click on the Start Button > Type task > Launch Task Scheduler</li>
|
|
|
+ <li>Right click the Task Scheduler Library folder in the left pane > Create Basic Task...</li>
|
|
|
+ <li>Set the name to RAM Disk and optionally set a Description > Click Next</li>
|
|
|
+ <li>For the Trigger, select When the computer starts > Click Next</li>
|
|
|
+ <li>For the Action, select Start a program > Click Next</li>
|
|
|
+ <li>In the Program/script field, paste the following:
|
|
|
+ <p>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</p>
|
|
|
+ </li>
|
|
|
+ <li>In the Add arguments field, paste the following, editing the path to the .ps1 file if necessary:
|
|
|
+ <p>"C:\Scripts\ramdisk.ps1"</p>
|
|
|
+ </li>
|
|
|
+ <li>Click Next</li>
|
|
|
+ <li>Check the Open the Properties dialog for this task when I click Finish box</li>
|
|
|
+ <li>Click Finish</li>
|
|
|
+ <li>In the Properties dialog, click the Change User or Group... button</li>
|
|
|
+ <li>Type system > Press Enter</li>
|
|
|
+ <li>Check the Run with highest privileges box</li>
|
|
|
+ <li>Click OK to create the scheduled task</li>
|
|
|
+ <li>Reboot the server to verify the RAM disk is re-created automatically</li>
|
|
|
+</ol>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+ </html>
|
|
|
+
|