YodaVonBeck
Posts: 38
Joined: Wed Mar 16, 2016 10:03 am

Cant write to external drive

Tue Sep 27, 2016 8:47 am

Hi

Im setting up a timelapse have the code read for that.
Now I am trying to attached an external USB HD (FAT32) and I can mount it for boot using fstab - so far so good.
However when I try to write to it, I get an access denied.

This is the fstab code:
/dev/sda1 /mnt /vfat defaults 0 0

What am I missing?

User avatar
RaTTuS
Posts: 10554
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Cant write to external drive

Tue Sep 27, 2016 9:00 am

ls -la /mnt/vfat

I assume you have not got a space in /mnt/vfat in your fstab

in general fat does not have permissions correctly setup so you could write via sudo
however you can change the ownership of the mount to be the user pi and that will work
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

YodaVonBeck
Posts: 38
Joined: Wed Mar 16, 2016 10:03 am

Re: Cant write to external drive

Tue Sep 27, 2016 9:25 am

In the fstab I have matched it to the other entries so I had to use some spaces. Is that a problem?

The drive is accessed via a Python script triggered via crontab . Do I need to find a way to use sudo

YodaVonBeck
Posts: 38
Joined: Wed Mar 16, 2016 10:03 am

Re: Cant write to external drive

Tue Sep 27, 2016 12:54 pm

I found a way to make it work.

The crontab I had used so far was the pi crontab (I new to this, so I assumed theres was only one).
Instead I edited the roo/sudo crontab so the code would run as such. That meant that the right permissions were in place :)

Works like a charm now

User avatar
rpdom
Posts: 16961
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Cant write to external drive

Tue Sep 27, 2016 6:57 pm

YodaVonBeck wrote:Hi

Im setting up a timelapse have the code read for that.
Now I am trying to attached an external USB HD (FAT32) and I can mount it for boot using fstab - so far so good.
However when I try to write to it, I get an access denied.

This is the fstab code:
/dev/sda1 /mnt /vfat defaults 0 0

What am I missing?
That looks wrong. The filesystem type (third field) should be "vfat", not "/vfat".

Code: Select all

/dev/sda1 /mnt vfat defaults 0 0

Return to “Troubleshooting”