Has anybody got any advice on setting the permissions for an external USB HD ?
My Raspberry sees the device but I can only read from it - the OS prevents me from writing to it !
I've tried several solutions suggested by Google but to no avail.
LXDE's file manager sees the device but wont let me write to it. it never appears in etc/fstab - adding it just makes it disappear in LXDE. I've followed a tutorial adding it to Samba but that also didn't work. I've reformatted it to ext2 in parted (hoping erasing any trace of windows would help). I've tried many chown & chmod settings,from various websites, again with no luck ?
Any hints/ideas appreciated as an 8Gb SD card is a bit restrictive when I've got a 200Gb drive at the ready?
Many thanks Simon
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
I'm struggling with this issue too, did you find an answer?
- Licaon_Kter
- Posts: 240
- Joined: Wed Sep 05, 2012 10:12 am
- Location: Between the keyboard and the chair.
Re: USB Hard Drive Permissions
Licaon_Kter wrote:install ntfs-3g
in fstab change ntfs to ntfs-3g
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)
Re: USB Hard Drive Permissions
You have to mount it as owner. What distro are you using?
In Squeeze you had to do it all manually. In Raspbian wheezy it should be taken care of automatically.
This blog post shows how to manually mount and unmount a usb hdd.http://raspi.tv/2012/how-to-mount-and-u ... spberry-pi
I had the exact same issue before I found out how to mount the drive as owner.
In Squeeze you had to do it all manually. In Raspbian wheezy it should be taken care of automatically.
This blog post shows how to manually mount and unmount a usb hdd.http://raspi.tv/2012/how-to-mount-and-u ... spberry-pi
I had the exact same issue before I found out how to mount the drive as owner.
having first created /media/usbdrive directory and set the permission on it.If you are logged on as the default Raspberry Pi Debian user, pi, you will need to use this command to mount the drive with read/write permission.
Code: Select all
sudo mount -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
Alex Eames RasPi.TV, RasP.iO
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
Thanks very much for this blog post by the way, I found it via a Google search and it taught me how to access my external drive. The only thing missing however was the requirement to install ntfs-3g using "sudo apt-get install ntfs-3g".alexeames wrote:This blog post shows how to manually mount and unmount a usb hdd.http://raspi.tv/2012/how-to-mount-and-u ... spberry-pi
Quick question, and sorry to hijack the thread but it is related, your blog post advises to create a directory in /media/USBHDD, however other instructions I've found advise /mnt/USBHDD. What's the difference?
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
I've got to thank you for this tip too!Licaon_Kter wrote:install ntfs-3g
in fstab change ntfs to ntfs-3g
Re: USB Hard Drive Permissions
This is down to personal preference as to where devices should be mounted, so go with whatever you find most intuitive (if Linux can ever be called thatbigdavethehorn wrote:alexeames wrote: Quick question, and sorry to hijack the thread but it is related, your blog post advises to create a directory in /media/USBHDD, however other instructions I've found advise /mnt/USBHDD. What's the difference?

- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
Thanks, coming from a plug n play Windows background, Linux is certainly not intuitive yet! I still have to learn how to permanantly, or automatically mount my external HDD and safely unmount it (or is it demount?).itimpi wrote:This is down to personal preference as to where devices should be mounted, so go with whatever you find most intuitive (if Linux can ever be called that)
Re: USB Hard Drive Permissions
Exactly - it's down to personal preference.
I think you can mount a drive pretty much anywhere you want as long as you have permissions in that location (and it exists).
I believe you can generally omit the -t ntfs-3g altogether in the manual mount - not sure about fstab. I hadn't come across the need to install ntfs-3g. I wonder if that's a Raspbian issue? The blog post was written for squeeze, but works in wheezy beta too. Not tried it in Raspbian as everything seems to mount automatically for me.
If you type after attaching a drive you should be able to see where it's been mounted.
My USB HDD auto-mounts at /media/label, where label is the name of the drive. I'm puzzled why yours is not auto mounting correctly. Are you using a username you created or the pi account?

I believe you can generally omit the -t ntfs-3g altogether in the manual mount - not sure about fstab. I hadn't come across the need to install ntfs-3g. I wonder if that's a Raspbian issue? The blog post was written for squeeze, but works in wheezy beta too. Not tried it in Raspbian as everything seems to mount automatically for me.

If you type
Code: Select all
df -h
My USB HDD auto-mounts at /media/label, where label is the name of the drive. I'm puzzled why yours is not auto mounting correctly. Are you using a username you created or the pi account?
Alex Eames RasPi.TV, RasP.iO
Re: USB Hard Drive Permissions
unmounting manually is fairly easy...bigdavethehorn wrote: I still have to learn how to permanantly, or automatically mount my external HDD and safely unmount it (or is it demount?).
if your drive is mounted at /media/USBHDD
Code: Select all
sudo umount /media/USBHDD
Alex Eames RasPi.TV, RasP.iO
-
- Posts: 44
- Joined: Tue Mar 13, 2012 10:23 am
Re: USB Hard Drive Permissions
I just do it in roots crontab
sudo crontab -e
@reboot /usr/bin/mount -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
a bit easier than fiddling with fstab
sudo crontab -e
@reboot /usr/bin/mount -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
a bit easier than fiddling with fstab
Re: USB Hard Drive Permissions
Interstingly enough, last night I reformatted a 500G USBHDD to Ext4, which massively speeds up the performance on a Pi. I encountered the same issue you guys have had with the permissions.
I could read from it but not write to it with the pi ID.
After much piddling about reading up on ext4 and fstab, I managed to get read-write access through pi
by doing a
and now pi has ownership and all users should have full r/w/x permissions
This might not be the safest way to go, but it got the job done.
I also added this line to fstab, but it seems to work even after rebooting with it commented out, so not sure it's needed. Except that if commented out, the drive is auto mounted at usbhdd_ instead of usbhdd
I could read from it but not write to it with the pi ID.
After much piddling about reading up on ext4 and fstab, I managed to get read-write access through pi
by doing a
Code: Select all
sudo chown pi:pi /media/usbhdd
sudo chmod 777 /media/usbhdd
This might not be the safest way to go, but it got the job done.

I also added this line to fstab, but it seems to work even after rebooting with it commented out, so not sure it's needed. Except that if commented out, the drive is auto mounted at usbhdd_ instead of usbhdd
Code: Select all
/dev/sda1 /media/usbhdd ext4 rw,suid,dev,exec,auto,user,async 0 0
Alex Eames RasPi.TV, RasP.iO
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
Got any figures?alexeames wrote:Interstingly enough, last night I reformatted a 500G USBHDD to Ext4, which massively speeds up the performance on a Pi.
Re: USB Hard Drive Permissions
I wrote a whole post about it here. Will probably blog it at some point. But basically I get about 8.3 megs/s copying a large file from my NAS to my USBHDD and 6.75 megs/s from USBHDD to NAS.bigdavethehorn wrote:Got any figures?alexeames wrote:Interstingly enough, last night I reformatted a 500G USBHDD to Ext4, which massively speeds up the performance on a Pi.
On NTFS (with the exact same drive but through sftp) I was getting something of the order of 2 megs/s. It's a massive improvement. The Pi's ethernet port is theoretically capable of 12.5 megs/s but we're getting closer. In the thread linked above, using a cut down kernel is said to improve things further, but since I already have a NAS, I don't really need that. All I wanted was a nice big HDD accessible from anywhere - personal cloud - if you like.

Alex Eames RasPi.TV, RasP.iO
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
Thanks for pointing me toward your other thread, off for a read now.
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
To my non-linux eyes, that looks like a script to enable auto mount at boot. Is that correct?startreksteve wrote:I just do it in roots crontab
sudo crontab -e
@reboot /usr/bin/mount -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
a bit easier than fiddling with fstab
Re: USB Hard Drive Permissions
kind of. crontab is a way of running scripts or commands at specific times/events e.g. rebootbigdavethehorn wrote:To my non-linux eyes, that looks like a script to enable auto mount at boot. Is that correct?startreksteve wrote:I just do it in roots crontab
sudo crontab -e
@reboot /usr/bin/mount -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/
a bit easier than fiddling with fstab
for example a lot of web servers will use crontab to run their nightly backups at a specific time
Alex Eames RasPi.TV, RasP.iO
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
Sounds ideal for my purposes, shut down Pi and unplug HDD. Plug HDD into laptop and transfer data, plug HDD back into Pi and restart Pi.
No more faffing with mnt commands or fstabs!
No more faffing with mnt commands or fstabs!
Re: USB Hard Drive Permissions
If your laptop is windows, you might be better off not doing the ext4 thing, as I think ext4 can't be read by windows.bigdavethehorn wrote:Sounds ideal for my purposes, shut down Pi and unplug HDD. Plug HDD into laptop and transfer data, plug HDD back into Pi and restart Pi.
No more faffing with mnt commands or fstabs!
Alex Eames RasPi.TV, RasP.iO
Re: USB Hard Drive Permissions
I'd like to say, that I too am having an issue.
I tried the /mount -o pid=pi,gid=pi etc...
Didnt work
Any ideas?
I tried the /mount -o pid=pi,gid=pi etc...
Didnt work

Any ideas?
- Licaon_Kter
- Posts: 240
- Joined: Wed Sep 05, 2012 10:12 am
- Location: Between the keyboard and the chair.
Re: USB Hard Drive Permissions
lsusb ?
installed ntfs-3g already if NTFS?
installed ntfs-3g already if NTFS?
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
A good point. I'll leave the HDD as NTFS for easy reading in Windows.alexeames wrote:If your laptop is windows, you might be better off not doing the ext4 thing, as I think ext4 can't be read by windows.
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
I'm using the default Pi account on a very much untouched Wheezy install. My HDD auto-mounts at boot, however I don't have write access to it.alexeames wrote:My USB HDD auto-mounts at /media/label, where label is the name of the drive. I'm puzzled why yours is not auto mounting correctly. Are you using a username you created or the pi account?
My solution at the moment is to VNC into the Pi, unmount the HDD, then re-mount it from terminal using the info from your blog "sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/"
There has to be an easier way!
Re: USB Hard Drive Permissions
It's probably mounting as root. Do you get r/w if you put sudo in front of your cp, mv etc. commands?bigdavethehorn wrote:I'm using the default Pi account on a very much untouched Wheezy install. My HDD auto-mounts at boot, however I don't have write access to it.alexeames wrote:My USB HDD auto-mounts at /media/label, where label is the name of the drive. I'm puzzled why yours is not auto mounting correctly. Are you using a username you created or the pi account?
My solution at the moment is to VNC into the Pi, unmount the HDD, then re-mount it from terminal using the info from your blog "sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /media/usbdrive/"
There has to be an easier way!
There is a way to make it mount as pi using fstab. Unfortunately I'm not very versed in fstab.
You could put your umount and mount commands in a little file, make it executable (chmod +x filename) and run it as a script, to shorten the process, but fstab is probably the best permanent way to go, to be honest. Did you see this post yesterday? http://www.raspberrypi.org/phpBB3/viewt ... 95#p172395
It might help you a bit (or a lot).

Alex Eames RasPi.TV, RasP.iO
- bigdavethehorn
- Posts: 56
- Joined: Thu Jan 19, 2012 8:46 pm
- Location: Scotland
Re: USB Hard Drive Permissions
I haven't tried creating, moving or deleting files via the terminal, a simple right-click "create folder" was my r/w test!alexeames wrote:It's probably mounting as root. Do you get r/w if you put sudo in front of your cp, mv etc. commands?
Yes I did thanks, however I need to get a better understanding about manual mounting, auto mounting by Wheezy and the role of the fstab.alexeames wrote:Did you see this post yesterday? http://www.raspberrypi.org/phpBB3/viewt ... 95#p172395
For example, if I run a "sudo mount..." crontab script at boot, will this script be superseded, and the drive unmounted, when Wheezy boots to the desktop?