I am trying to mount a USB HDD. A create a folder here:

/media/pi/HDD

My HDD is formated to ext2

After that, I modified my /etc/fstab and add this line:

/dev/sda1       /media/pi/HDD   ext2    rw,defaults,user     0       0

Then reboot, and I can see, the mounted HDD, but the owner and the group is root.

Thus, any app can't write this folder. For example, Chromium cannot download anything to this folder, and I also can't use transmission to download in this folder neither.

If i check the /media folder belongs to pi:pi

My question is, how can I mount this HDD as pi user on boot?

  • Please run lsblk --fs from the command line, and include the output of that command in your question. – Seamus May 30 at 23:42

When you have unplugged the HDD, run chown pi:pi on the actual mount pount not just the parent folder, so in your case /media/pi/HDD.

In Linux a subfolder or a file can have totally different file access flags than its parent folder.

  • hello, if i unplug the HDD and run sudo chown pi:pi /media/pi/HDD nothing happens. And afther check who is the owner of the folder i can see it's pi. But if i replug the hdd the system mount it to media but with this name: 2c9227b9-1f54-4971-bae2-f8bfaa16ae8b at this state i can write.. Then i restart and fstab mount the device again o /media/pi/HDD and this 2c9227b9-1f54-4971-bae2-f8bfaa16ae8b drive not shown anymore and canno write he mounted folder again.. :( what shold i do ? – solarenqu Oct 20 '17 at 16:05
  • Are you sure, your device name is sda1? To check this, plug in your HDD and run df -h – dasch Oct 21 '17 at 16:31

Better than use 'sda1' is to know the UUID with this command:

sudo blkid /dev/sda1

Using this number go and edit 'fstab' file:

UUID=whathever_you_obtain_from_blkid /media/pi/HDD  ext2  defaults,user  0  0

And give permission to everybody (777) to try, after that you can search to fine tune permission to HDD folder:

sudo chmod 777 /media/pi/HDD

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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