MacOS High Sierra's Black Holes Revealed



You live yourself, you don’t scratch your turnips, you don’t blow your mustache. And then all of a sudden you need to move from a dilapidated iPhone 6 to the brand new iPhone X. And since your whole life has been stored in the photos and videos of your old smartphone over the past seven years, you really don't want to lose this stuff. And now you backup your economy via iTunes on Mac, try to move to a new “balalaika” and suddenly it turns out that there is no longer any place to backup a new phone on your computer’s hard drive. You start frantically clearing the Augean stables disk space, but the result is "dumb". Moreover, deleting “left files” and emptying the recycle bin does not lead to anything. Here's a thriller played out recently with Parallels Vice President Nikolai Dobrovolsky. Under the cut, a detective story about his discovery of a “black hole” in macOS High Sierra, the search for truth and a happy ending that the main characters of the movie “Titanic” could envy.

Further in the colors and pictures from the words of the protagonist, a narrative will follow about the collapsed illness and methods of miraculous healing.



In search of the "black hole"


Having decided to backup the contents of my new iPhone X via iTunes, I immediately needed 70GB of free disk space on my computer. Without thinking twice, I deleted most of the junk files. Films, pictures and other masterpieces of modern art. I deleted it for a long time and painfully. As a result, instead of the required 70 gigs, more than 100 GB was cleared. I cleaned the basket. And what was my surprise when, with subsequent attempts to backup, the system showed me a three-finger shape. "There is no place, boy, blow into the garden, smoke bamboo." All subsequent attempts to free up additional disk space and backup did not lead to anything. On the one hand, there is more than enough space, but on the other hand, it is not. Wonders. “See the gopher?” Not? But he is! ” Classic.

He walked around all the Apple fans, climbed Russian and overseas forums. At the first stage, no one added clarity. There were no versions. From exotic ones: “These are the wrong bees, they make the wrong honey” to “Wait it will fall away.” As time went. The sore did not disappear. At the end of the week, one of the American forums managed to read that APFS (Apple Files System), materialized recently on macOS High Sierra and the implementation of Time Machine snapshots on it, were to blame. Today, this good is installed on all new laptops by default. Also, with updates you can roll it.

So this same “smart squiggle” when interacting with Time Machine works to put it mildly a little differently. What happened before? Previously, there was a very simple scheme. There are some extra files on the poppy, you delete them, they end up in the trash. You empty the trash, files are completely deleted, keep free space.

Now with Time Machine turned on and backup to an external drive or to Time Capsule on macOS High Sierra and APFS, she begins to "freak out." In addition to the fact that Time Machine starts backing up data and leaves it on an external drive, it also makes on the hard drive some local backups (Local Snapshots), which store the history of changes recently. So that you could theoretically search the Time Machine in the wilds in the future, even if you do not have this external drive with backups. Those. it not only stores information on an external drive, but also reserves a place somewhere and tries to show you what you had there in the recent past. Therefore, a situation arises in which a “black hole” forms on the hard drive of your computer. Thus, somewhere in the depths of your computer, additional disk space is reserved. Moreover, its volume and location in the right mind and sober memory cannot be determined. Удалить и почистить это хозяйство по-простому у вас тоже вряд ли получится.

Perhaps my situation will seem atypical to you. My Time Machine backs up to an external drive. I also have macOS High Sierra and APFS. But, as they say, you won’t erase words from a song.

So, using the “scientific stick” method, it turned out that there are certain commands that allow you to manage these same almost mystical Local Snapshots in macOS High Sierra. By the way, despite the fact that everywhere they write that if you have ten percent of free space, APFS will delete them yourself, in fact, nothing will happen until you clean them with pens. Theoretically, they are once removed, but forecasts and systemicity in this charitable process were not found.

A reasonable question arises, why don’t you immediately remove the found Local Snapshots? And the garden does not fence? Everything is simple. It is impossible to get to them, because they live in a certain reserved area where no one has direct access. "Black hole", not otherwise. You can’t get there through the Finder. This is some kind of hidden area that even DaisyDisk shows as a system area. She does not know how to get there, but she knows that she exists.

“Sleight of hand and no fraud” (c).


I propose to go to a session of magic with its subsequent exposure. As they say it is better to see once than hear a hundred times.

So, you have a computer with a 128GB hard drive. Under the hood macOS High Sierra c APFS.


In order to recreate the situation of low disk space, take Disk Image and create three large files of 30 GB each.






As we can see, our files took up more than 103GB. Full box. Next we launch Time Machine.



At this stage, we understand that for the subsequent backup we need to free up disk space. We delete unnecessary files. In this case, delete one of the three 30GB disk images.



Feel free to delete the unnecessary, because we need free space. Then, without regrets, we clean the basket.



And you have theoretically freed up 30GB of free space. Let's fill it with a new image of a disk of the appropriate size.



And lo! There is no place.



Moreover, in the “Documents” and “Recycle Bin” there are no references to the “ghost file”.



We launch DaisyDisk and see that “Hidden Space” (“Black Hole”) has formed on our hard drive. The size of this beauty is similar in size to the files that we deleted earlier. I repeat, to understand that there and somehow it is problematic to remove without dancing with tambourines.




And here, Russian ingenuity comes to your aid, a few mantras to the computer mother, and here is such a nice script:

tmutil listlocalsnapshotdates § | while read line;
do
tmutil deletelocalsnapshots $ line
done
It displays a list of Local Snapshots and deletes them, which can also be done directly with your hands in Terminal:
For a clean experiment, create a new 30GB disk image. We understand that everything is earning!





The end!

Z.Y. Write if you have similar problems or even weirder squiggles. It will be interesting to discuss them in the comments.