How to remove a Volume using Terminal?

A few weeks ago I mounted an external hard drive with a volume named "CJ 1TB" I ejected it and thought everything was fine, but my system (11.2.1) has not forgotten about it.

When I run "ls" in Terminal, it shows my boot volume "Bamboo", and "CJ 1TB":

lrwxr-xr-x  1 root  wheel   1 Feb 17 13:58 Bamboo -> /
d--x--x--x  3 root  wheel  96 Feb  9 11:59 CJ 1TB

But when I run "diskutil list" the "CJ 1TB" does not show up:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk0
   1:                        EFI ⁨EFI⁩                     314.6 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         2.0 TB     disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +2.0 TB     disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Bamboo - Data⁩           1.0 TB     disk1s1
   2:                APFS Volume ⁨Preboot⁩                 324.0 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                613.7 MB   disk1s3
   4:                APFS Volume ⁨VM⁩                      1.1 GB     disk1s4
   5:                APFS Volume ⁨Bamboo⁩                  15.1 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.1 GB    disk1s5s1
   7:                APFS Volume ⁨SOT-BU⁩                  9.0 GB     disk1s7

Grateful for a solution...


Solution 1:

What looks like a folder in /Volumes is not a real folder. Everything inside /Volumes looks (at first glance) to be folders, but in reality are what are called mount points. These are just places to join disks into the tree of folders starting from /Volumes.

When you mount a disk, macOS creates a mount point in /Volumes and connects the disk to that mount point.

When you cleanly dismount a disk the mount point is removed.

But sometimes the mount point gets left behind. For example, following a physical disconnect without a preceding dismount.

The last few comments in this blog post show someone who has 3 such mount points left behind. Howard Oakley's blog

You have two choices:

  1. Don't worry about it. The mount point is not taking up space on your disk.

  2. Attempt to remove the mount point.

Howard Oakley advises not to mess with it. The danger when tampering with /Volumes is that you will mess up your whole folder structure and end up with an unbootable system.

Solution 2:

OK, I figured this out (with thanks to @Gilby):

In the Finder I used Cmd+Shift+. to show hidden items and navigated to the Volumes folder.

The leftover Mount Point was listed there. A simple cmd+delete removed the Mount Point.