UPDATED 2012-01-17: MPECS Inc. Blog: Server Core–How to Properly Move the Swap File
This one was a really tough find ...
From the Microsoft TechNet Server 2008 Core online documentation on managing Server Core we get (square brackets because Blogger can't seem to interpret greater than or less than symbols properly):
Disable paging file management: At a command prompt, type:So, in our Core command line we type on one line (ignore text wrapping):
wmic computersystem where name="[computername]" set AutomaticManagedPagefile=False
wmic computersystem where name="MyCoreServerName" set AutomaticManagedPagefile=FalseWMI tells us that the command was successful.
On to step 2:
Configure the paging file: At a command prompt, type:Okay, no matter how we interpret the above command, we cannot get a success message from WMI.
wmic pagefileset where name=”[path/filename]” set InitialSize=[initialsize] ,MaximumSize=[maxsize]
Where:
path/filename is the path to and name of the paging file
initialsize is the starting size of the paging file in bytes.
maxsize is the maximum size of the page file in bytes.
The errors we were getting the following two errors consistently:
- No Instances Available
- Error Code = 0x80041017
Description = Invalid query
Facility = WMI
After a number of different searches using a number of different search engines, we finally stumbled on the following on the Server Core blog: Tips and Tricks Vol. 4:
- wmic computersystem where name=”[computername]
” set AutomaticManagedPagefile=False - wmic pagefileset where name=”C:\\pagefile.sys” set InitialSize=500,MaximumSize=1000
We are fortunate that we have blogs to turn to in this day and age. Here is a good example where the documentation for a product is not so good, but the product team's blog documentation is very good.
This is not the first time we have run into poor product documentation for a new Microsoft product. It probably will not be the last. This is truly unfortunate because we then need to waste a bunch of time searching out the answer to something that should be right in front of us in the first place. :(
UPDATE 2008-06-25: For clarification on the above: Assuming that we have created a partition with the S: label:
- wmic computersystem where name=”MyCoreServer” set AutomaticManagedPagefile=False
- wmic pagefileset where name=”S:\\pagefile.sys” set InitialSize=2500,MaximumSize=10240
Also note, if the command continues to fail, reboot after disabling the automatic pagefile management and run the command again. We are finding that the command does not always run successfully after disabling the automatic management.
Philip Elder
MPECS Inc.
Microsoft Small Business Specialists
*All Mac on SBS posts are posted on our in-house iMac via the Safari Web browser.
Exactly what I was looking for after struggling with Code = 0x80041017 Error message.
ReplyDeleteGreat work. Thanx
Are those sizes bytes or MB?
ReplyDeleteDave,
ReplyDeleteThey are in MB. The last example was to set a 2.5GB (2500) to 10GB (10240) page file.
Philip
Hello.
ReplyDeleteI have followed your instructions and everything appreasrs to be as expected. Except :-
after a reboot if I rung the pagefile command (instead of pagefileset) the fagefile appears to still be on the c drive.
Andy ideas?
Thanks in advance
Andy
Andy,
ReplyDeleteWhen you do an attrib *.* on the swap file partition do you see the pagefile.sys there?
Philip
Hello.
ReplyDeleteYes, there is a pagefile on the c drive and a pagefile on the z drive.
Andy
Andy,
ReplyDeleteattrib -h -s on the C:\pagefile.sys
Rename the file to pagefile.old.
If that works, then you can safely delete it as the OS is no longer using it.
Philip
Due to the 4,096 character limit I can only manage to post this. I'm using Server 2008 R2 x64Server Core.
ReplyDeletehttp://blogs.dirteam.com/blogs/sanderberkouwer/Default.aspx?p=10
Changing page file location
Another management option is to move the page file to another partition (or volume). Moving a page file involves deleting an existing page file and making a new one somewhere else. I used the following set of commands to move the Page File from the C: drive to the D: drive on my test system.
diskpart.exe
DISKPART> select disk 0
DISKPART> select partition 1
DISKPART> shrink desired=2280
DISKPART> create partition primary
DISKPART> select partition 2
DISKPART> format fs=ntfs label="Swap"
DISKPART> assign letter=E
DISKPART> exit
wmic.exe pagefileset create name="E:\pagefile.sys"
wmic.exe pagefileset where name="E:\\pagefile.sys" set InitialSize=2048,MaximumSize=2048
wmic.exe pagefileset where name="C:\\pagefile.sys" delete
You can replace values to suit your situation. Your settings will take effect after a reboot of the system.
A,
ReplyDeleteThank you for the update. That first command to create the file on the swap partition was definitely missing in our instructions here.
Philip
Hi,
ReplyDeleteat least on Windows 2008 R2 x64 you have to add another command.
wmic.exe computersystem where name="WIN-WHAT-O-EVER" set AutomaticManagedPagefile=False
wmic.exe pagefileset create name="E:\pagefile.sys"
wmic.exe pagefileset where name="E:\\pagefile.sys" set InitialSize=2047,MaximumSize=4095
wmic.exe pagefileset where name="C:\\pagefile.sys" delete
Without the create command I just get the famous "No Instance(s)" error.
Cheers,
Christoph
Your first pagefileset command uses one backslash and the next two pagefilesets use two backslashes. Is this really correct?
ReplyDeleteFound an interesting gotcha
ReplyDeletehttp://support.microsoft.com/kb/979386
Running Hyper-V and trying to move the pagefile to a SCSI attached VHD will not work as SCSI isn't initialized when windows tries to setup the pagefile.
Other than that... a great article
A.,
ReplyDeleteThere is no gotcha that we know of.
We are talking about moving the swap file on the Hyper-V host which would normally be deployed using physical disks configured in RAID arrays.
Philip
This is what I ended up using:
ReplyDeletewmic computersystem where name="%computername%" set AutomaticManagedPageFile=false
wmic pagefileset create name="P:\\pagefile.sys",InitialSize=3434,MaximumSize=3434
wmic pagefileset where name="C:\\pagefile.sys" delete