Six Colors
Six Colors

Apple, technology, and other stuff

This Week's Sponsor

Magic Lasso AdblockBlock ads in iPhone, iPad and Mac apps

By Jason Snell

Quick Tip: Prevent a disk from auto-mounting

A clone task begins

One of the consequences of switching to a laptop from a desktop is that my old method of cloning my disk daily has been thrown out of whack.

Previously, I kept a USB disk attached to my Mac Studio at all times. Once a day, Carbon Copy Cloner would launch and clone the disk. But now, if I attach that USB drive to the hub my MacBook Pro will be connected to, I get a bad bit of behavior: the disk mounts the moment my Mac is attached, and then if I want to unplug my Mac, it’ll yell at me for unmounting that disk improperly.

Fortunately, there’s a solution. It begins by telling my Mac to not automatically mount the USB disk when it attaches to my Mac. It’s a multi-step, Terminal-based process. It begins by using the command diskutil info "volume name", which will generate a lot of information about the disk—including its Volume UUID, a long string of characters.

Next, I need to edit the file /etc/fstab and add a line that specifically tells the system not to mount this particular drive, so I enter in sudo vifs and then add this line at the bottom of the file:

UUID=[long UUID of the disk] none apfs rw,noauto

This configuration line tells the system not to automount a disk with that UUID.

CCC offers to unmount the disk again when it’s done.

Carbon Copy Cloner handles the rest. It automatically mounts the disk when it’s time to run the clone job, and can be set to automatically dismount the disk when it’s done. So long as I don’t unplug my Mac during a clone task, the clones happen more or less invisibly in the background and I don’t need to make any effort to attach, mount, detach, or dismount the USB drive. (I believe you can get the same effect in the cloning utility SuperDuper! via its pre- and post-flight scripts.)

If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.


Search Six Colors