Dock is stopping me from unmounting a hard drive

I just upgraded to Catalina and am using an external drive as a system drive and need to unmount my internal drive, but I can't. I try sudo diskutil umount /Volumes/Macintosh\ HD/ and it asks for my password, tries, then tells me:

Volume Macintosh HD on disk0s2 failed to unmount: dissented by PID 2793
(/System/Library/CoreServices/Dock.app/Contents/XPCServices/com.apple.dock.
extra.xpc/Contents/MacOS/com.apple.dock.extra)
Dissenter parent PPID 1 (/sbin/launchd)

When I use ps aux to find out about PID 2793, here's the appropriate information:

hal               2793   0.0  0.1  5253644  34068   ??  Ss    1:06AM   0:00.14
/System/Library/CoreServices/Dock.app/Contents/XPCServices/com.apple.dock.extra.xpc
/Contents/MacOS/com.apple.dock.extra

The only app (and I checked with lsof) that is using anything on that drive is the dock - and it's using the iTunes icon. I found that out with lsof, here's the related output line:

com.apple 2793  hal  txt       REG                1,2      23760             2640732
/Volumes/Macintosh HD/Applications/iTunes.app/Contents/PlugIns/iTunesDockTile.docktileplugin
/Contents/MacOS/iTunesDockTile

That confirms that the only app using anything on that internal drive is the Dock and that the only file being used is the iTunesDockTile. When I first saw this, I removed Apple Music from the Dock, but it still wants that tile and, rather than getting it from the external drive, that is the system drive, it's using the one on the old internal drive.

I tried killall dock; sudo diskutil umount /Volumes/Macintosh\ HD and get the same message as above. (I hoped that it would unmount the drive while Dock was restarting and before it got a file lock.) I've considered just deleting that file, but I don't know what consequences that would create.

I need to unmount that drive so I can reformat it.

Extra (probably unnecessary) details:

This is part of an upgrade from Mojave to Catalina. I tried to start the update and it wouldn't, since my system drive was not in APFS. I had an extra drive, so I hooked it up via USB and formatted it in APFS, then used SuperDuper to copy my internal drive to the external. I upgraded the external to Catalina. My next step was going to be to reformat the internal in AFPS, then use SuperDuper again and copy everything on the external drive (Which is now a new Catalina update) to the internal drive. It appears EVERYTHING else is using the external for all system resources and the ONLY tile the Dock is not getting from the internal drive is this one iTunes tile.

So what is the best and safest way to deal with this to unmount the internal drive? I've considered using a forced unmount, but that doesn't always work and can cause problems. I don't want to just delete the tile file until I know what it'll do or if there are unexpected consequences.


Can you try boot in Safe Mode (press Shift key when boot) and retry with the terminal : Below adapt the name of internal Drive with diskutil listcommand, try :

diskutil umountdisk force diskX

If ok you can reformat this internal disk. Keep in mind that the system need an internal disk with a EFI partition (formatted GUID) because it's the only way for future Firmwares Updates.


[This answer cropped up earlier in the week for a totally different question, but it seems appropriate again here…]

I would be more inclined to prevent the volume from mounting in the first place, then it won't need to be ejected.

You can prevent it from mounting using fstab.
I wrote an earlier answer on using this, so I'll link to that rather than covering the same ground again. The question itself is entirely unrelated, but the answer contains step by step for fstab

Time Machine restore to new partition, different computer