I have a couple of different problems with
ls /Volumes. 1st, I have an AppleScript that could mount only 10 of my 13 volumes. The 3 I could not mount were named Data 1, Data 2, and Data 3. I renamed those 3 volumes to Data 11, Data 22, and Data 33 and now my Applescript can mount all 13 of the volumes.
To debug this, I ran the following AppleScript:
set mountList to do shell script "ls -l /Volumes" display dialog mountList set thisDisk to "Data 1" if thisDisk is in mountList then display dialog thisDisk end if do shell script "diskutil unmount " & quoted form of ("/Volumes/" & thisDisk)
The result of display
dialog mountList was:
total 0 drwxrwxr-x@ 29 root admin 928 Nov 20 21:40 Data drwxrwxr-x@ 30 bud staff 1088 Nov 20 21:40 Data 11 drwxrwxr-x@ 31 bud staff 1122 Nov 21 18:48 Data 22 drwxrwxr-x@ 28 bud staff 896 Nov 20 21:40 Data 33 lrwxr-xr-x 1 root wheel 1 Nov 19 20:02 MacHD -> / drwxr-xr-x@ 15 bud staff 480 Nov 20 21:40 Parallels drwxrwxr-x@ 11 bud staff 352 Nov 20 21:40 Photo Data drwxrwxrwx+ 3 root wheel 96 Nov 17 2018 TTSS drwxr-xr-x@ 56 root wheel 1972 Nov 20 21:40 TTSS 2
TTSS is a volume I erased 2 years ago. This is the first phantom volume I noticed.
The result of
display dialog thisDisk was Data 1.
This is the 2nd phantom volume I observed. Remember, I have renamed Data 1 to Data 11. I presume this phantom Data 1 is what caused my original mount script to fail to mount Data 1: the OS thinks Data 1 is already mounted.
The do shell script resulted in the error message
Unmount failed for /Volumes/Data 1
The result if I run
display dialog mountList again is the same list as above.
I reran the debug script with thisDisk set to TTSS. It, too, returned the error message that Unmount failed.
Somehow, Data 1 is in the list of volumes but it doesn't appear. Somehow TTSS is in the list of volumes, and it shouldn't be. How do I get rid of the phantom volumes? Data 2 and Data 3 behave just like Data 1.
I should mention that I barely understand AppleScript and Terminal commands, so I will probably need step-by-step help.