Why can’t I create a directory on a mounted USB drive after mkdir, but finder new directory works

finderpermissionsudoterminal

I'm trying to create a directory on a USB3 mounted hard disk drive and it is failing even though the permissions are open:

bash-3.2$ ls -al
total 0
drwxrwxrwx+ 2 user  user    68 Jun  3 18:24 .
drwxrwxrwx+ 3 user  admin  102 Jun  3 18:17 ..
bash-3.2$ mkdir local1_test
mkdir: local1_test: Permission denied
bash-3.2$ pwd
/Volumes/MiniPro\ 2/test

The same operation works fine on the built in disk, but when I'm in a directory of the mounted USB drive it fails. Is this due to my drive containing a space in the name? Is this due to the drive somehow being mounted as read-only? From the finder I cannot see the test directory. I can also create it from the command line with sudo, but as myself, it fails.

I was able to work around, by creating a folder in the finder named test which seems to have erased the old test folder but mkdir still fails. Why did I have to use the finder to create the folder?


I went to do the test requested by fd0, plugged my USB drive back in again, and the issue is no longer showing:

bash-3.2$ ls -al
total 0
drwxr-xr-x   2 user  staff   68 Jun  5 10:12 .
drwxrwxr-x  13 user  staff  510 Jun  3 18:36 ..
bash-3.2$ mkdir local1_test
bash-3.2$ pwd
/Volumes/MiniPro 2/test

I did notice an odd item though:

bash-3.2$ cd /Volumes
bash-3.2$ ls -al
total 24
drwxrwxrwt@  7 root  admin   238 Jun  5 10:11 .
drwxr-xr-x  41 root  wheel  1462 Jun  3 18:29 ..
drwxrwxr-x  13 user   staff   510 Jun  3 18:36 MiniPro 2
drwxrwxrwx+  3 user   admin   102 Jun  3 18:17 MiniPro\ 2

Why do I have to entries, could that have been the source of the issue? Both show the same contents of the USB drive, why are there two entries?

Here is fd0's test results:

bash-3.2$ mount
/dev/disk1 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
localhost:/UFZ8fiBtsQjvo5MXlysi8r on /Volumes/MobileBackups (mtmfs, nosuid, read-only, nobrowse)
/dev/disk2s1 on /Volumes/MiniPro 2 (hfs, local, nodev, nosuid, journaled, noowners)
bash-3.2$ sudo ls -ld /Volumes/MiniPro\ 2
drwxrwxr-x  13 root  wheel  510 Jun  3 18:36 /Volumes/MiniPro 2

Best Answer

mount without any options gives an overview of the mounted file systems with information such as the type of file systems, location, and mount options. In your case, you have one file system mounted in /Volumes called MiniPro 2 which is a HFS file system mounted noowners (ignore permissions). Your list (ls) command reveals that you also have a directory named MiniPro\ 2 in /Volumes. Once you have determined that the directory MiniPro\ 2 does not contain any files that are not backed up and you can safely remove the directory MiniPro\ 2 then remove the directory. Do this without MiniPro 2 mounted.