The macOS file system is designed for Mac computers to provide optimal usage of storage
space and simplicity for users while preventing unauthorized users from changing files intentionally
or inadvertently.
This is Jeremy and I'll walk you through the macOS file storage structure so you can better
understand.
Each storage device, or disk, is comprised of a partition map, or scheme, which sets
the rules for how partitions function within the entire disk.
Today, most operating systems, including macOS, make use of the GUID partition table.
This allows a single disk to have one or more partitions.
A partition is a portion of a disk with a fixed size, traditionally formatted using
HFS+, that can be used as another bootable operating system or even password protected
storage.
However, the HFS+ file system has several limitations like supporting only a single
volume per partition and the inability to share free space across partitions.
Beginning with macOS High Sierra, Apple File System, or APFS, replaces HFS+ as the default
file system.
The macOS installer creates what's called an APFS container.
Unlike an HFS+ partition, an APFS container can have more than one volume.
A volume is similar to a partition in that it can also be used as a bootable operating
system or encrypted storage.
When a single container has multiple volumes, the container's free space is shared between
volumes.
Each volume can grow and shrink independently, so space that's freed when one volume shrinks
can be used when another volume grows.
Disk Utility provides an interface to visualize disk partitions and volumes, and can be found
in Applications and Utilities.
In macOS Catalina, two volumes will appear in the sidebar of Disk Utility.
This is because macOS Catalina runs on a dedicated, read-only system volume called Macintosh HD.
A separate volume is created to store your files and data, aptly named Macintosh HD - Data.
Before APFS, the partition button was used to add, remove, or resize partitions.
While it's still possible to repartition a disk, Disk Utility will recommend adding a
volume instead of partitioning the disk since APFS volumes share storage space within a
container.
Adding a volume is quick and easy - and can even be encrypted, requiring a password to
access any data stored there.
Let's take a look at a volume with macOS installed.
As you navigate through the file system, each directory (commonly called folders) can be
represented in text form with a file path, which typically begins with a forward slash.
A forward slash at the beginning of a file path indicates the first directory in the
file system hierarchy, known as the root directory.
Similar to a tree, the root directory is the part of a file system from which all branches,
or directories, originate.
Each directory within a directory is separated by another forward slash.
Consider the path to the Disk Utility app.
It's nested in the Utilities directory, inside Applications, in the root directory.
So the file path to Disk Utility would be /Applications/Utilities/Disk Utility.app.
This example is considered an absolute path because it contains the full path beginning
at the root level.
The Finder is used to access the file system in a user-oriented view by hiding or renaming
some files and directories.
Beginning at the root directory, there are four visible folders, or directories: Applications,
Library, System, and Users.
In macOS, these directories are a part of domains to separate them based on how they're
used.
For example, the Applications and Library directories are a part of the Local domain
which contains apps and preferences shared by all users on this computer.
The Users directory is a part of the User domain which contains files and preferences
specific to each user on the computer.
Each user has access to their own home directory within the Users directory.
This prevents one user from making changes to another user's files and preferences.
Mentioned earlier, the Finder hides some directories and a perfect example is a user's Library
directory.
Many commonly used directories can be found by clicking Go in the Finder menu bar.
Now watch what happens when I press and hold the Option key.
Notice Library is now an option.
This directory can also be found using the file path with the Go to Folder option in
the Go menu.
When considering file paths, the current user's home directory can be represented with a tilde.
So if I wanted to reference the current user's Library directory, the file path would be
~/Library.
Otherwise, the absolute path would be /Users/Jeremy/Library.
The System directory is a part of the System domain which contains the system software
installed by Apple.
These files are required by the system to run, and users aren't able to add, delete,
or modify any items; even if they're administrators.
This is thanks to a security technology introduced in OS X El Capitan called System Integrity
Protection.
Before System Integrity Protection, software installers that required administrators to
enter their username and password could obtain root-level access and have free rein across
the entire file system.
System Integrity Protection is designed to protect certain directories, like the System
directory and native macOS apps, and only allow changes by processes signed by Apple
to help safeguard your Mac from malicious software.
Even administrators with root-level access can't delete or modify protected items.
That's all on the macOS file storage structure.
Thanks for watching, and we encourage you to continue learning!