Skip to main content
4 of 4
added 546 characters in body
sunknudsen
  • 982
  • 10
  • 21

This is how I disable auto mounting of APFS volumes on macOS Catalina.

For macOS volumes, both Macintosh HD - Data and Macintosh HD type volumes need to be referenced in /etc/fstab.

Find volume(s) using diskutil list and set VOLUME_PATH accordingly.

# Disable auto mounting of "macOS - Data" volume
VOLUME_PATH="/Volumes/macOS - Data"
VOLUME_UUID=`diskutil info "$VOLUME_PATH" | awk '/Volume UUID:/ { print $3 }'`
cat << EOF | sudo tee -a /etc/fstab
UUID=$VOLUME_UUID none apfs rw,noauto
EOF

# Disable auto mounting of "macOS" volume
VOLUME_PATH="/Volumes/macOS"
VOLUME_UUID=`diskutil info "$VOLUME_PATH" | awk '/Volume UUID:/ { print $3 }'`
cat << EOF | sudo tee -a /etc/fstab
UUID=$VOLUME_UUID none apfs rw,noauto
EOF

Here is what is going when running above commands:

Set VOLUME_PATH variable to /Volumes/macOS - Data

VOLUME_PATH="/Volumes/macOS - Data"

Set VOLUME_UUID variable to volume UUID of /Volumes/macOS - Data volume

Running diskutil info "$VOLUME_PATH" outputs volume details of /Volumes/macOS - Data (which includes its UUID).

Piping (|) these details to awk '/Volume UUID:/ { print $3 }' extracts the UUID.

VOLUME_UUID=`diskutil info "$VOLUME_PATH" | awk '/Volume UUID:/ { print $3 }'`

Append UUID=$VOLUME_UUID none apfs rw,noauto to /etc/fstab and output to console (see tee)

cat << EOF | sudo tee -a /etc/fstab
UUID=$VOLUME_UUID none apfs rw,noauto
EOF
sunknudsen
  • 982
  • 10
  • 21