3

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?

Aurora0001
  • 6,357
  • 3
  • 25
  • 39
solarenqu
  • 131
  • 1
  • 2

3 Answers3

2

Since you already have user in the options of your fstab, I'd suggest you try to run sudo chown -R pi:pi /media/pi/HDD once it is mounted. This applies the owner recursively to all files and directories of the drive.

I'm not sure if this is appropriate if you have some user rights management going on on the drive though.

Aarkon
  • 121
  • 4
0

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.

nee6AGag
  • 21
  • 2
0

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
manuti
  • 44
  • 5