A Windows 11 system is configured with two physical storage devices. The first has a typical layout, of boot, reserved, and data partitions, whereas the second is partitioned exclusively for a page file, and due to the physical topology of the system is appropriate for nonpermanent data. Virtual memory for the system is configured to use the entire partition of the second device, and none of any partition of the first. (See below for capture of configuration.)
Despite the configuration, Windows repeatedly creates, at the root of the main file system, a file called swapfile.sys
, sized of roughly 268 MB, which may not be deleted in Windows, but rather only by mounting from a non-Windows recovery environment. Even so, when Windows starts, it recreates the file.
How may I permanently remove this file, or designate its location on the secondary storage device allocated for transient storage?
C:\>dir /a
Volume in drive C is Windows
Volume Serial Number is B426-88EF
Directory of C:\
04/07/2022 02:44 PM <DIR> $Recycle.Bin
10/27/2022 12:14 AM <DIR> $WinREAgent
10/16/2022 11:36 PM 1,024 AMTAG.BIN
10/06/2021 10:09 PM 112 bootTel.dat
10/27/2022 03:12 PM <DIR> Config.Msi
04/07/2022 03:27 PM <DIR> cygwin64
09/15/2019 06:12 AM <JUNCTION> Documents and Settings [C:\Users]
10/01/2022 03:33 AM 12,288 DumpStack.log
10/27/2022 05:46 PM 12,288 DumpStack.log.tmp
09/15/2019 05:41 AM <DIR> hp
06/07/2021 03:48 PM <DIR> Intel
06/05/2021 07:10 AM <DIR> PerfLogs
10/27/2022 03:11 PM <DIR> Program Files
10/16/2022 06:13 PM <DIR> Program Files (x86)
11/08/2022 01:42 AM <DIR> ProgramData
04/07/2022 04:36 PM <DIR> Recovery
11/08/2022 01:42 AM 268,435,456 swapfile.sys
10/27/2022 03:21 PM <DIR> SWSetup
10/01/2022 04:25 PM <DIR> System Volume Information
04/07/2022 01:41 PM <DIR> system.sav
10/06/2021 07:01 PM <DIR> Users
10/27/2022 12:28 AM <DIR> Windows
5 File(s) 268,461,168 bytes
17 Dir(s) 45,940,146,176 bytes free