swap\pagefile of 2 levels

0

Lets assume I want to assign 2GB to swap(linux)/pagefile(windows) on SSD, and 16GB more on HDD.
Is that possible to use the space on SSD as level 1 of virtual memory, and the space on HDD as level 2 ? [I'm asking about both Linux and Windows]

Dani-Br

Posted 2014-10-19T11:13:39.750

Reputation: 103

1I would be cautious about putting any swap on SSD. I can understand why you would want to, for performance reasons, but you are concentrating all the heaviest disc activity in a small area of the disc, which will very much shorten its life-time. If you do go ahead, I would recommend regularly moving the swap file's location to a different area of the SSD, to try to minimise ageing. As for prioritising the use of swap, I am not sure it makes a lot of sense: if rarely active programs fill level 1, then all the swap activity will be in level 2 anyway. – AFH – 2014-10-19T11:59:48.070

1AFH's information was incorrect then and is even more incorrect today. All SSDs have built-in wear-levelling that is specifically designed to automatically move data around to avoid any part of the disk ever being overused. There's no way to turn it off and manually "moving" a swap file location is totally pointless. – qasdfdsaq – 2015-06-23T11:23:55.123

Answers

1

For Windows, this is not possible. You can create pagefiles on multiple drives, but Windows will not prefer one drive over another based on drive type, nor can you set a preference.

What it will do: when it is time to decide where to write pagefile-bound stuff that hasn't been allocated pagefile space before, Windows will pick the pagefile that's on the disk with the lowest recent average usage. This is done with a rolling average on the I/O queue depth to the drives.

If you want to use an SSD for your pagefile but not wear out your main SSD, your best bet is to get a cheap small SSD and put your pagefile on that. If it wears out, get another one, which will be even cheaper then.

But actually your best way to optimize pagefile behavior is to not need it so much. If you're doing a lot of pagefile IO, it's a sign that you should add more RAM.

Jamie Hanrahan

Posted 2014-10-19T11:13:39.750

Reputation: 19 777