Error writing to USB mounted on Raspberry Pi

2

I have a Raspberry Pi which I recently bought, and am planning to use it as a torrent box. While setting it up (over SSH) I tried to mount a 8GB SanDisk USB Drive I had connected to it earlier.

sudo mount /dev/sda1 /home/pi/usb It occurred successfully. However, when I navigated to it's mount-point, I was unable to create a folder or file.

cd /home/pi/usb

mkdir lel It threw a "no permission error". I tried making another folder in /home/pi with normal privileges, and everything works fine. Only in the /home/pi/usb direcctory where my drive is mounted nothing seems to happen, though I can create files using sudo

Since I have a torrent client (deluge) which is unable to write to the flash drive that is mounted, I am facing problems.

I tried sudo chmod 777 -R /home/pi/usb with no success

Please help (Also I'm a linux noob)

UPDATE: I've found this to work:

sudo mount /dev/sda1 /home/pi/usb -o umask=000

It allows me to mkdir and stuff. How can I automate this for every time it boots up? (What do I need to do in fstab)

poiasd

Posted 2014-11-21T14:37:29.677

Reputation: 57

Can you show us the result of the mount command in the terminal? – Rik Verbeek – 2014-11-21T14:38:54.900

Answers

1

A few things could be happening.

What format is the USB? Is it NTFS, FAT or ext? If you reformat to ext, it could seriously degrade the performance, but it will be a little more compatible with Linux.

If it is NTFS, are you sure you have the NTFS drivers loaded? I recall once that I needed to explicitly load the drivers to access NTFS.

Are you running Raspian on the Pi? or Arch?

Raspian is more complete, and should give you better results.

Finally. I know from first hand experience that the Pi/Raspian has a problem with filesystems going read only after hundreds of small writes. I was logging data to my Pi and it hung because the SD card went read only. I moved the root fs to a USB and it did the same thing. I tried another Pi. Same thing again. I moved the logging to another host (via ssh command) and the problems stopped. I think it is a kernel thing.

Timbo

Posted 2014-11-21T14:37:29.677

Reputation: 390

FAT32 USB, regular raspbian. I'll try formatting to ext and get back to you – poiasd – 2014-11-23T09:23:41.720

1

Ubuntu - do not know how much of this works on a 'rasp' (both are Debian based though, so chances are fair).

$ lsblk                # lists known block devices 

$ sudo mount ...       # mount it
$ cd /mountpoint/      # make it be the current dir

$ sudo chown -R $USER:$USER .     # take ownership
$ sudo chmod -R 755 .             # reset RWX flags

chown --help will display terse help,
info chown for more...
note: these might not be available due to space savings. Look on the net in that case.

Hannu

Posted 2014-11-21T14:37:29.677

Reputation: 4 950

tried chown, after every file, i.e. changing ownership of xxx.txt: Operation not permitted. I used sudo but still – poiasd – 2014-11-22T06:57:21.790