14

I have a USB FAT32 drive that is on /dev/sda2. I've mounted it as /media/bigdrive however, I get permission denied whenever I try to touch a file there as a non root user.

When I run mount I can see this line:

/dev/sda2 on /media/bigdrive type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro)

My /etc/fstab has this line:

/dev/sda2       /media/bigdrive vfat    rw,user,exec,umask=000  0       0

I've tried running sudo chmod 777 /media/bigdrive and sudo chmod 777 -R /media/bigdrive

Neither one changes anything.

Is there anything I'm missing?

This is on a rasberry pi running raspbian BTW.

Alex
  • 241
  • 1
  • 2
  • 5
  • Can you show us `ls -ld /media/bigdrive`? – ckhan Sep 07 '12 at 07:17
  • Mount it with `uid` and/or `gid` values, e.g. append `uid=YOUR_ID` (find `YOUR_ID` with `id`) to the options in `fstab`. A better choice would be to make `udev` handle this or at least refer to the partition by its UUID name (see `ls -l /dev/disk/by-uuid`) and instead of `/dev/sda2` use `UUID=...` in `fstab`. – Thor Sep 07 '12 at 09:08
  • Are you mounting the filesystem by typing `mount /dev/sda2` or something else? – Gilles 'SO- stop being evil' Sep 07 '12 at 23:16

2 Answers2

13

I had exactly the same problem and the only thing that actually worked for me was:

mount -t vfat  /dev/sda2 /media/bigdrive -o rw,umask=0000

However, umask=000 and umask=0000 both worked for me.

So after having set up your /etc/fstab, type the following commands (the first one unmount the drive, the second remounts it) :

# umount /dev/sda2
# mount -a

The second command could be replaced with:

# mount -t vfat  /dev/sda2 /media/bigdrive -o rw,umask=000

See also that answer

lauhub
  • 914
  • 2
  • 11
  • 24
2

After editing /etc/fstab, you have to mount everything that has been added to it. The manual page for mount gives the following hint.

   -a, --all
          Mount all filesystems (of the given types) mentioned in fstab.

simply run the following instead of rebooting and you should be good to go.

# mount -a
Silverrocker
  • 1,815
  • 1
  • 15
  • 23