Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Last Week on My Mac: Giving a fsck

By: hoakley
23 March 2025 at 16:00

Sometimes Macs behave in ways that you don’t forget. It was nearly six years ago, in 2019 when my iMac Pro was still running macOS Mojave, that it took over half an hour to start up in Safe mode. As became obvious, that was because it checked the integrity of every snapshot, including its long series of Time Machine backups. That behaviour stopped with the release of Catalina later that year, and revisiting the experience last week was interesting, when I examined what Safe mode does now in Sequoia.

Safe mode fsck

Checking disk integrity has long been a feature claimed of Safe mode, although Apple has only recently clarified that its checks are “similar to the more comprehensive check performed by the First Aid feature of Disk Utility,” unlike those in the days of Mojave.

Because these are run when starting up into Safe mode, macOS can’t report them directly to the user. There are only two places for their results to be recorded: in the fsck_apfs log at /var/log/fsck_apfs.log (and its error log at /var/log/fsck_apfs_error.log), and in the Unified log, neither of which are likely to be visited by users. It doesn’t seem possible that checks could be run before entries are made in the Unified log, and if they were their results would be inaccessible, and of no value to the user.

If you do look there, you might be surprised to discover that the checks run by fsck_apfs are ‘quick checks’, described as a “check whether the device is `clean’. If device is an APFS volume, fsck_apfs will quickly check the APFS container and the specified APFS volume. If device is an APFS container, fsck_apfs will quickly check the APFS container and all the APFS volumes in it. By default, no repairs are attempted during a quick check.” Thankfully they also no longer include Time Machine snapshots or backups.

For users, the most important of volumes to be checked is the Data volume in the current boot volume group. Yet careful examination of both log records reveals that such checks fail, returning error 65, because the device is mounted with write access. Although they could be performed using fsck_apfs‘s live verification, no attempt is made to do that. From the active boot volume group, only the Recovery and Update volumes are checked, together with all accessible external volumes.

Normal user fsck

Before you think that’s better than making no checks at all, the sequence of fsck_apfs checks run at the start of Safe mode appears to be identical to those made during startup into normal user mode, and reports the same failures. Thus, in this respect Safe mode is no different from normal, despite Apple listing this as a feature of Safe mode.

It’s worth reading the fsck_apfs man page to see the many options available in this command, which is the basis for all checks and repairs made to APFS volumes and containers. There are two in particular that you may prefer to invoke rather than using Disk Utility’s single option to both check and repair. My favourites that make it worth opening Terminal instead of Disk Utility are -n to prevent it from attempting to make any repairs, and -S to skip snapshots.

Given that fsck_apfs appears unable to repair any errors it finds in snapshots and admits to that in its man page where it states that “no repairs can be made”, it puzzles me that without the -S option it will still check all snapshots it comes across when running its checks. Perhaps it’s time to alter that default behaviour and make checking snapshots the explicit option.

First Aid

Disk Utility’s First Aid is descended from a succession of utilities starting with the Disk First Aid app in Classic Mac OS, which separated disk Verify and Repair features.

diskutil001

Mac OS X merged the two Classic apps Drive Setup and Disk First Aid, but kept them as distinct tools within its new Disk Utility app and retained separate Verify and Repair features.

diskutil002

diskutilg

Those two features were still present in Mountain Lion or Mavericks, shown here, but soon afterwards only Repair was available.

Now that APFS is mature and has proven itself more than a worthy successor to HFS+, the need to both check and repair its containers and volumes should be abating. This would be a good time to return to separate controls, allowing users to check APFS in the expectation that there are no errors to be found. This is more important now because of the absence of any alternatives.

Monopoly

Disk Utility is in a unique position. Apple has chosen to lock third-parties out of developing competing disk repair utilities, in particular those that can be used in Recovery mode. Users can’t opt for apps with more or better features, putting the onus on Apple to provide a comprehensive solution that meets users’ wishes, not its idea of essential requirements.

Conclusions

  • Apple needs to be explicit about what disk checks are run in Safe mode, and where users can inspect their results.
  • fsck_apfs is flexible and powerful, but has strange defaults that merit reconsideration.
  • Disk Utility should offer more options beyond its single ‘check and repair’, in particular to check only and with snapshots excluded. Those are most important in Recovery mode, where there can be no alternative.

What is System Data in Storage Settings?

By: hoakley
11 February 2025 at 15:30

If you have an Apple device, you’ll be familiar with the idea behind Storage Settings in System Settings > General. What you might not be prepared for is what you’ll see there. Like its equivalent in the General section of the Settings app, the bar chart at the top often shows that much of your Mac’s storage is filled with System Data, and it neither breaks that down into anything more meaningful, nor does it offer a tool to do anything about it.

Storage Settings on macOS has a troubled history. It used to be part of About This Mac, and often took so long to complete its bar chart that folk gave up waiting. In some cases, it even crashed in the process. More often than not, the totals it gave for used and free space on the startup disk were substantially different from those reported by the Finder or Disk Utility.

In recent versions of macOS, Storage Settings has improved steadily. It does now complete its analysis in a reasonable period, and in most cases its figures aren’t too different from Disk Utility’s. But System Data remains a puzzle that confuses rather than enlightens.

What is System Data?

From the information given by Apple, it’s most likely that this isn’t really what we’d consider to be data used or required by macOS, but the often substantial difference between how much space is used, and how much can be attributed to other categories, like Books and Music. It’s not a real category, but an etcetera, a ragbag including all sorts of files and other data.

Calculating some of the other categories seems difficult enough. For example, my Music folder contains over 100 GB of individual audio files and my Music library, but Storage Settings recognises less than 50 GB of that in its Music category. The remaining 50 GB has to be accounted for elsewhere, and that’s likely to be buried in System Data. With Photos and TV it’s the other way around, with almost all my libraries stored on an external SSD, but Storage Settings still claims I have 36 GB in TV and doesn’t even mention Photos.

So the categories it does list don’t always match with what we know is on the disk. When it adds all those together and takes that total away from the amount of disk space used, that difference is little more than a guesstimate, and unlikely to contain much data required by macOS. No wonder Storage Settings can’t suggest any way to reduce that size.

Dynamic storage

Unlike more traditional file systems, APFS is dynamic in its use of storage space, and macOS now uses aggressive caching policies. One of those came to light when we thought the Finder had a large memory leak, only to be told that, in the right circumstances, it can retain GB of Quick Look thumbnails in memory, so that scrolling through them can be smooth. When there’s sufficient free disk space, macOS can maintain large caches without using any swap space on disk.

APFS features like snapshots can retain data we presumed had been deleted, but has to be kept until the snapshot referencing it has been deleted up to 24 hours later. That space has to be accounted for somewhere, and in many cases that too goes into the System Data category, although it has actually been created by Time Machine, which oddly doesn’t have its own category.

Although not given in the Storage bar chart, both the Finder and Disk Utility should state the amount of purgeable space in use. This could be freed when necessary, but that’s determined by macOS rather than the user. I have previously looked at how purgeable some features like snapshots are, and in practice you shouldn’t rely on their automatic removal when you think your Mac needs more free space.

What is Storage Settings good for?

Like its equivalent on iPhones and iPads, some of the tools it provides are of great value in housekeeping. Click on the ⓘ Info button for each of them to get further information and for actions you can take. Categories with the more useful tools include:

  • Applications, shows apps by size, and which are Intel-only, and duplicates;
  • Developer, if you have Xcode installed, can clean up build files and device support;
  • Documents, lists by size and type, 32-bit apps;
  • Messages, lists larger attachments and lets you delete them;
  • Music Creation, helps you remove sound libraries;
  • macOS, tells you how much space is used by Apple Intelligence.

Although Music might seem promising, it’s only interested in music video files you can remove.

How to check free space

Don’t trust Storage Settings or the Finder to provide an accurate estimate of free space available on disk. Instead, open Disk Utility (with Show All Devices selected in its view) and in the list at the left in its main window, pick the volume you’re interested in, then go up to its container in the list and select that. Free space shown there is the most accurate estimate of that available to all volumes within that container, as in APFS volumes within the same container all share the same free space.

Select one of those volumes, and you’ll see free space given as a higher value, with a figure for the space that’s purgeable in brackets. That represents the maximum space that could be freed if all purgeable contents were to be deleted.

For example, free space shown here for a container is 619.72 GB, which is the space available without any purging. One volume within that container is given as having 864.5 GB available, with 244.78 GB purgeable:
864.5 = 619.72 + 244.78 GB

Figures given by the Finder are only refreshed periodically, while Disk Utility should recalculate them whenever you select a volume or container, so should always be up to date.

Summary

  • System Data in Storage Settings isn’t just files and data for macOS, but everything not listed in another category, and even that is only approximate, a rough estimate.
  • Storage Settings has useful tools for managing the contents of your startup disk.
  • For an accurate estimate of free space, use Disk Utility, and the free space given there for the volume’s container.
  • Don’t expect macOS to free up any purgeable space for you.

Start planning your Mac’s Spring clean

By: hoakley
6 February 2025 at 15:30

Although it may not seem that winter is drawing to a close, Spring isn’t that far away, and now is the best time to start planning your Spring cleaning. That’s an opportunity to give your Mac a good physical clean, and to catch up on software housekeeping as outlined in this article. Ideally you should spend a little time each month or so doing the housekeeping on your Mac. Although it’s usually a rewarding investment of your time, it’s often neglected. If you can’t follow the little-and-often principle, at least set aside some time once a year.

Housekeeping can tackle different types of maintenance, among them

  • cleaning up after old apps
  • tidying up working folders such as ~/Documents
  • archiving and cleaning up emails and Messages
  • maintaining media libraries including those of Photos
  • checking for orphaned snapshots
  • checking System Settings.

If you prefer, you can leave most of those to a paid-for housekeeping utility, but most of those now require a substantial subscription, and placing your trust in them. As I’d never choose to invite someone in to tidy through my personal papers and possessions and discard any they think I don’t need, you might want to consider whether you’d trust software to do the same task with your files and data. While I might not be as thorough as a housekeeping app, I’m responsible for making my own errors.

Clean up old apps

If you don’t remove many old apps from your Mac, this shouldn’t involve much work. If, like me, you have a large library migrated from old Macs and regularly try out new apps, then they can leave significant amounts of junk. The more obvious locations to check in both the top-level Library folder and that in your Home folder include Application Support and Preferences. Don’t forget disused and unnecessary logs in ~/Library/Logs. Any that haven’t been modified for the last year or so should be disposable, and any from apps you no longer use can also be cleared away. There’s more detail here.

Almost all App Store apps and many others now run in their own sandbox, and macOS creates for them a container folder stored in ~/Library/Containers. These are a complex hybrid of real and symlinked folders and files that form the contents of the app’s sandbox. In some cases they may contain documents and other files of more lasting value, so you shouldn’t remove or tamper with them unless you’re sure you know what you’re doing. Similar containers in ~/Library/Daemon Containers are for helper services, while those in Group Folders are shared across apps. There’s more detail here. Containers and Daemon Containers are protected in Sonoma and later, and Group Containers are in Sequoia.

You’ll find further discussion of cleaning up from apps here, and old preference settings here.

Tidy up working folders

Finding and removing duplicate files has long been one of the mainstays of Mac housekeeping. Not only did they waste space on the disk they were stored on, but they wasted it again when they were backed up. The activity has even won its own name: deduplication. Since APFS came to Macs, that has changed. One of its more subtle features is the clone file, making deduplication at best questionable, if not a waste of time and effort.

Unlike hard links, clone files are separate files, with their own inodes, but when first created they share the same data. If you then make changes to either the original or the copy, only the changed data is saved. The more changes are made to a clone, the more new data blocks it uses, until eventually all its data could be different, and the two files each occupy their own space, equal to the sum of the sizes of those two files.

Clone files can only exist in the same volume, though. Copy one of them to another volume, and the whole file is copied. Clone files don’t take any additional space in a snapshot, and Time Machine backups should recognise cloned files, and only back up one set of data for them. So not only do clone files not waste any space on their volume, but they don’t waste any in backups either. This is explained in more detail here.

You’re better off spending your time organising your working documents and other files more efficiently than trying to deduplicate in APFS. When you want to identify which files are occupying the most space on disk, DaisyDisk from the App Store is justly popular.

Archive and clean up emails and Messages

Many of us have accumulated thousands of old messages in our email clients, such as Apple’s Mail. While we don’t want to lose access to those old emails, we don’t do anything to archive them properly and get them out of the way of our active emails. All good email clients, even Mail, support the archiving of old messages to keep them for reference and get them out of our current Inboxes and Sent mailboxes. There are also apps dedicated to doing this, including Moth Software’s Mail Archiver X.

The Messages app is more of a problem, although for most it’s usually a matter of removing old movies, images and other large attachments. macOS, iOS and iPadOS provide useful aids to identifying the largest and removing them without having to trawl though hundreds of old messages. In macOS, open the Storage section of General in System Settings, and click on the Info button for Messages. Although Storage isn’t often an accurate measure of space used on disk, for which you should rely on Disk Utility, its individual tools can be useful.

Archiving the contents of data shared in iCloud is more complex, and explored here.

Maintain media libraries

Although duplicate files may not be worth pursuing in APFS, you are more likely to come across duplicates that can be removed from media libraries, particularly those used by Photos. Recent versions have a Duplicates feature in Photos’ Utilities collection that offers to merge what seem to be identical images to save space and make your library more efficient. There are also third-party apps that claim to do that even better.

Check for orphaned snapshots

All apps that make snapshots are supposed to remove them automatically, in the case of Time Machine after 24 hours. Sometimes, usually because of a minor error in them, one or more snapshots escapes this. Left for more than another day or two, its size will steadily increase until it could occupy the whole of that container.

Checking old snapshots is quick and simple in Disk Utility. If you haven’t already enabled their display, select the Show APFS Snapshots item in its View menu. Then select each of the mounted volumes in turn, and the main window will list all the snapshots on that volume. If any are older than intended, you can select them and use the contextual menu from Control-click to delete them. Don’t try deleting any on the volume Time Machine uses to store its backups, though, as snapshots there are its backups and should be maintained by Time Machine.

Check System Settings

When you’re doing your housekeeping you should also take the opportunity to check through some of System Settings to ensure they’re up to date. This applies particularly to Privacy & Security, and General > Login Items & Extensions.

Privacy & Security allows apps to access protected data, from Calendars to Reminders, or features that could be abused, from the camera to audio recording. One of the more important is Full Disk Access, where you’ll see strange entries, typically including XProtect, which you didn’t add and doesn’t need full disk access anyway. Don’t forget to check through those apps given access to Location Services in the top section.

Login Items & Extensions controls which apps and their services are opened automatically when you log in, and among other things puts some of them into the right side of the menu bar. Background items are other services that run in the background, but can be difficult to identify. Extensions are a varied collection of tools that do anything from adding to contextual menus to augmenting Quick Look or Spotlight. To see which are enabled, you need to click the Info symbol for each.

Summary

  • Clean up after removing old apps in Application Support, Preferences and ~/Library/Logs.
  • Tidy up working folders such as ~/Documents, but it’s probably not worth deduplicating.
  • Archive and clean up emails and Messages, in the latter removing old videos and images through Storage settings.
  • Maintain media libraries including those of Photos, where you should check for duplicates.
  • Check for orphaned snapshots using Disk Utility.
  • Check through System Settings, in Privacy & Security and Login Items & Extensions.

Good housekeeping isn’t about freeing up disk space, it’s about making your Mac more efficient in use.

❌
❌