Connecting the paging file (SWAP) in MAC OS X when using an external SSD-drive as a system

Good day, dear comrades!

I want to leave a very short message here, so that people who have a problem similar to mine do not spend too much time on its solution.

Once, I had to think about one small puzzle. There is an iMac computer, there is a successfully installed OS X Sierra on an external, USB-connected SSD-drive, and there is a strange, surprising, and at the same time - complete, lack of a paging file.

I will not go here into the details of monitoring, determining, and confirming this fact, so as not to waste precious readers' time. In our, the Russian "desert", it is pointless to look for something about this. For at the moment - there is simply nothing intelligible. The English-speaking sector of the Internet is also not pleased with anything significant.

As time went. The problem was like a “dumb reproach”. And suddenly, unexpectedly, around the beginning of October, an OS X update was released, which is called “Mojave”. Hope, as they say, dies last. I was not the only one to “cry” on the Internet, as Mac OS X technical support was stupid and inert. And, my sad experience of calling “straight there”, I decided to never repeat in order to save my own time. As it was expected, Mojave not only failed to fix the problem with constant falling off after waking up the keyboard and mouse from sleep, but also did not solve anything with the paging file or at least adding the ability to manage this very important, in my opinion, function.

It turned out that I had to make a copy of large, but at the same time ugly small data, from a remote server to my local storage via the SSH protocol. I used for this purpose a fairly well-known product called Cyberduck. Everything about him is good and beautiful. In addition, when working with a large number of small files, it is likely to control transmission errors, it maintains its own, temporary log, which is likely to be accumulated in temporary files (or system cache) and reaches sizes comparable to loadable data. Which, of course, immediately affects the performance of the system. And this log "lives", at the same time, not somewhere - but directly in RAM. In my system, the RAM is 8 GB. But in work with the system, I see constantly busy about 6-7 GB. and came the next morning to see "how is it there?", I immediately realized that something was wrong. After two or three movements with the mouse and keyboard, the system got a stake. and came the next morning to see "how is it there?", I immediately realized that something was wrong. After two or three movements with the mouse and keyboard, the system got a stake.

I am sure that so many people are surprised in principle, as it is generally possible - a complete stop of OS X. But when there is not enough RAM, it is very much the case. At the same time, the system still (!!!) does not warn the user that he has problems with free RAM, and all these things can simply lead to a complete collapse.

Now, I think, dear comrades, you are all absolutely clear, transparent, and clear, the degree of my motivation in solving this problem.

end of the preamble

After much anguish, it finally turned out to write in one line a mount command for the disk marked OS X as unmounted and as allocated by the system for the use of virtual memory (VM).

Mostly thanks to a single response on the Toaster . And a hundred more read pages of forums and blogs on the Internet.

sudo diskutil mount -mountPoint /private/var/vm `diskutil ap list | grep VM | awk -F ' ''/d/ {print $5}'`

I ask you to draw your attention to the back quotes that limit the filter itself after linking several commands, which simply define the output of the mount command with its output - the exact name (number) of the disk, which in the set with others, is marked as VM. At the moment, what I see is disk4s4. But when a second or another third external disk is connected to the all-in-one, the name of the disk labeled as VM can easily be like this: disk5s4, and like this: disk6s4. One more thing. Between simple vertical quotes in the "awk -F ''" fragment - (immediately after the letter F, two quotes) - there is a space. That is, once again - between single quotes after F - SPACE (!). But, just in case. Experienced beavers will immediately find the way out of their hut. :-)

For those people who do not have any connected external drives, or their set is always constant - everything is much simpler. For automation, you can use just one mount command for a completely specific disk, having previously obtained its name using

diskutil ap list

Sorry, hands have not yet reached absolute automation, but I hope to add more soon.

If someone with a similar problem - “does not take off” - well, let's try to discuss it ...
UPD: the line for AppleScript will look like this:
(do shell script “diskutil mount -mountPoint / private / var / vm `diskutil ap list | grep VM | awk -F '' '/ d / {print $ 5}'` "with administrator privileges) display dialog

Also popular now: