2

I am hoping someone might be able to help explain an issue I have with regards to directory permissions I am getting when trying to mount 2 external USB HDDs. For reference this is on Raspbian but I believe this to be a general linux/debian question.

First off I have created two mount points under /media/

pi@mypi:/media $ ls -l
total 8
drwxr-xr-x 2 root root 4096 Jun 29 12:38 hdd
drwxr-xr-x 2 root root 4096 Jun 29 12:37 hdd2

I then identified the UUID of the two disks I wanted to mount:

pi@mypi:/media $ sudo lsblk -f
NAME        FSTYPE LABEL       UUID                             MOUNTPOINT
sda         ext4   HomeBackup  2e3ece57-6526-4acd-aba3-79f0937ecad0
sde
└─sde1      ext4   HomeBackup2 f54dad28-04a8-4bad-9d84-38571b2e2155

Which I then used to update my /etc/fstab file:

pi@mypi:/media $ cat /etc/fstab
...
UUID=2e3ece57-6526-4acd-aba3-79f0937ecad0 /media/hdd ext4 noatime,nofail,defaults 0 0
UUID=f54dad28-04a8-4bad-9d84-38571b2e2155 /media/hdd2 ext4 noatime,nofail,defaults 0 0

However when I then mount the drives one of them is changed owner ship to my user pi whilst the other one remains as owned by root which makes no sense to me as the setup is identical for both of them..

pi@mypi:/media $ sudo mount -a
pi@mypi:/media $ ls -l
total 8
drwxrwxr-x 10 pi   pi   4096 Jun 29 13:45 hdd
drwxr-xr-x  3 root root 4096 Jun 29 12:29 hdd2

Please can someone help point out what I've missed here ?

  • Do the 2 folders /media/hdd and /media/hdd2 exist before boot-up? – Paul Benson Jun 29 at 13:53
4

When you mount a file system, the mount point assumes the ownership and permissions of the root directory of the mounted file system. What you’re seeing indicates that /dev/sda’s root directory is owned by pi:pi (or rather, its uid and gid match pi’s on your system), while /dev/sde1’s is owned by root.

chown will fix things for you if necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.