Due to the sad demise of my main machine, I'm booting a much less capable system from an external drive to keep myself going while I await a replacement. The machine itself has its own internal drive. Both the machine's own internal drive, and my recovered (now external) drive, are formatted APFS, and both have the full set of system volumes (preboot, recovery and VM).
The problem is, when booting from the external drive, macOS wants to store swapfiles on it, even though the performance is poor when doing this, especially since this emergency setup has a lot less RAM making swapping a lot more likely.
What I'd like to know is; can I tell macOS Mojave to mount the internal drive's VM volume and use that for swap-files, rather than using the external disk?
One oddity is that although the external drive has its own VM volume (not that I want to use it), macOS Mojave isn't utilising that either, instead it's storing swap-files under
/vm, rather than mounting the VM volume at
/private/var/vm as normal.
In case it's easier to visualise, my drives look like this, where
disk0 is internal, and
disk2 is external, and was pulled from my dead machine:
diskutil list /dev/disk0 (internal, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *320.1 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_APFS Container disk1 319.9 GB disk0s2 /dev/disk1 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +319.9 GB disk1 Physical Store disk0s2 1: APFS Volume Macintosh HD 34.4 GB disk1s1 2: APFS Volume Preboot 41.8 MB disk1s2 3: APFS Volume Recovery 507.4 MB disk1s3 4: APFS Volume VM 20.5 KB disk1s4 /dev/disk2 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1.0 TB disk2 1: EFI EFI 209.7 MB disk2s1 2: Apple_APFS Container disk3 1000.0 GB disk2s2 /dev/disk3 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +1000.0 GB disk3 Physical Store disk2s2 1: APFS Volume macOS 102.5 GB disk3s1 2: APFS Volume Preboot 64.3 MB disk3s2 3: APFS Volume Recovery 1.0 GB disk3s3 4: APFS Volume VM 20.5 KB disk3s4 5: APFS Volume Users 321.0 GB disk3s5
To clarify; I'm not looking to disable swapping entirely, but to use the internal drive as the swap-file location. Indeed, swapping is necessary on the older machine I'm using, as it was never used for much more than a media-centre, and only has 4gb of RAM, which fills fast!