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