External USB Refuses to Mount on macOS

I was working on some cryptography homework and remembered that I wanted to plug my iPhone into my iMac to charge it up.  I have a USB dongle that gives me room for 4 more ports.  I have noticed that the dongle is rather pathetic and can’t handle much throughput or utilization.  It doesn’t have enough for all of my peripherals so I try to use it for light-weight things like a wireless receiver for my Microsoft mouse and other stuff.  Well, this time I had a USB drive plugged in in addition to my iPhone, wireless sensor, and something else.  I opened Finder and checked my iPhone and noticed that it hadn’t been backed up for over two months.  I started an encrypted backup of my phone.  A few moments later, my external hard drive unmounted on its own.  I think the dongle basically stopped communicating with it because of the communication requirements of the iPhone backup.  I decided to move that USB drive to a port that is on my iMac directly.  When I plugged it in, after roughly two or three minutes, I recieved the error that the disk could not be mounted.

Could not mount DiskManagement disenter error 0
Could not mount DiskManagement disenter error 0

I tried to mount it by hand from the command line and got “Resource busy”.  Interesting.  What’s using it?  I’m not.

What disks are attached?

$ diskutil list
/dev/disk0 (internal, physical):
#:                     TYPE NAME                SIZE     IDENTIFIER
0:    GUID_partition_scheme                    *3.0 TB   disk0
1:                      EFI EFI                 209.7 MB disk0s1
2:               Apple_APFS Container disk2     3.0 TB   disk0s2

/dev/disk1 (internal, physical):
#:                     TYPE NAME                SIZE     IDENTIFIER
0:    GUID_partition_scheme                    *121.3 GB disk1
1:                      EFI EFI                 209.7 MB disk1s1
2:               Apple_APFS Container disk2     121.1 GB disk1s2

/dev/disk2 (synthesized):
#:                     TYPE NAME                SIZE     IDENTIFIER
0:    APFS Container Scheme -                  +3.1 TB   disk2
                            Physical Stores disk1s2, disk0s2
1:              APFS Volume Macintosh HD - Data 728.4 GB disk2s1
2:              APFS Volume Preboot             81.8 MB  disk2s2
3:              APFS Volume Recovery            526.6 MB disk2s3
4:              APFS Volume VM                  9.7 GB   disk2s4
5:              APFS Volume Macintosh HD        11.0 GB  disk2s5

/dev/disk3 (external, physical):
#:                     TYPE NAME                SIZE     IDENTIFIER
0:    GUID_partition_scheme                    *2.0 TB   disk3
1:                      EFI EFI                 209.7 MB disk3s1
2:     Microsoft Basic Data PJADATA             2.0 TB   disk3s2

Let’s do a generalized search for “disk” because a) I know /dev/disk3s2 isn’t mounted; and b) if something is using that device, it is using the device itself, not a disk as a mount:

$ sudo lsof | grep disk
UserEvent 155 root txt REG 1,7 29360 1152921500312401745 /System/Library/UserEventPlugins/com.apple.diskarbitration.plugin/Contents/MacOS/com.apple.diskarbitration
diskarbit 184 root cwd DIR 1,7 704 2 /
diskarbit 184 root txt REG 1,7 161760 1152921500312399232 /usr/libexec/diskarbitrationd
diskarbit 184 root txt REG 1,7 28056 12987595370 /Library/Preferences/Logging/.plist-cache.8jY7AXDN
diskarbit 184 root txt REG 1,7 28504528 1152921500312401357 /usr/share/icu/icudt64l.dat
diskarbit 184 root txt REG 1,7 1558736 1152921500312400397 /usr/lib/dyld
diskarbit 184 root 0r CHR 3,2 0t0 319 /dev/null
diskarbit 184 root 1u CHR 3,2 0t0 319 /dev/null
diskarbit 184 root 2u CHR 3,2 0t846 319 /dev/null
diskmanag 388 root cwd DIR 1,7 704 2 /
diskmanag 388 root txt REG 1,7 2190864 1152921500312399722 /usr/libexec/diskmanagementd
diskmanag 388 root txt REG 1,7 28056 12987595370 /Library/Preferences/Logging/.plist-cache.8jY7AXDN
diskmanag 388 root txt REG 1,7 1558736 1152921500312400397 /usr/lib/dyld
diskmanag 388 root 0r CHR 3,2 0t0 319 /dev/null
diskmanag 388 root 1u CHR 3,2 0t0 319 /dev/null
diskmanag 388 root 2u CHR 3,2 0t0 319 /dev/null
UserEvent 511 pja txt REG 1,7 29360 1152921500312401745 /System/Library/UserEventPlugins/com.apple.diskarbitration.plugin/Contents/MacOS/com.apple.diskarbitration
fsck_exfa 50042 root 3u CHR 1,13 0t0 2223 /dev/rdisk3s2

Ah! fsck is running!  The disk filesystem is being checked.  Now, let’s narrow our search just out of curiosity of what else fsck is doing:

$ sudo lsof | grep fsck
fsck_exfa 50042 root cwd DIR 1,7 704 2 /
fsck_exfa 50042 root txt REG 1,7 90400 1152921500312404229 /System/Library/Filesystems/exfat.fs/Contents/Resources/fsck_exfat
fsck_exfa 50042 root txt REG 1,7 1558736 1152921500312400397 /usr/lib/dyld
fsck_exfa 50042 root 0u CHR 3,2 0t180 319 /dev/null
fsck_exfa 50042 root 1u CHR 3,2 0t180 319 /dev/null
fsck_exfa 50042 root 2u CHR 3,2 0t180 319 /dev/null
fsck_exfa 50042 root 3u CHR 1,13 0t0 2223 /dev/rdisk3s2

When it was finished, my disk mounted all by itself.

$ mount |grep disk3
/dev/disk3s2 on /Volumes/PJADATA (exfat, local, nodev, nosuid, noowners)