20

I'm trying to set up a Raspberry Pi to run BitTorrent Sync to back up my files to an external hard drive, but I'm running into some frustrating issues.

First, I need to set up the USB hard drive to auto-mount on boot, because the power frequently goes out where I live. So, I added a line to /etc/fstab

/dev/sda1   /media/josiah    vfat    defaults   0   0

I rebooted, and it mounted the drive, but then btsync couldn't write to it. So, I did a little reading and found that you have to specify the user option, so I tried this;

/dev/sda1   /media/josiah    vfat    defaults,user   0   0

That didn't seem to work either, so I tried specifying all of the defaults manually

/dev/sda1   /media/josiah    vfat    rw,auto,user,async,suid,dev,exec    0   0

I thought it was working, but then btsync started complaining again that it couldn't write to the drive, and when I tried to unmount it as a normal user it said that only a super user can unmount the drive.

That's confusing to me, since I thought that's what the user option was for. What am I missing, or doing wrong?

4 Answers 4

30

You can do a chmod after you mounted the partition, but that wouldn't be persistent accross reboots.

You should try this fstab line:

/dev/sda1   /media/josiah    vfat    user,umask=0000   0   0

Or this mount options:

mount -t vfat -ouser,umask=0000 /dev/sda1 /media/josiah

That will make the mounted partition world readable and writable.

If you need a less permissive setup, you should create a new group and mount as follows:

mount -t vfat -ouser,gid=1010,umask=0007 /dev/sda1 /media/josiah

It assumes your new group's gid is 1010. All users that need access to the mountpoint will need to be added to the new group.

0
8

Edit the permissions for the mount directory.

In your case, chmod 777 /media/josiah ought to do the trick quite nicely.

7
  • Which line should I be using in /etc/fstab to auto mount the drive? Commented Jul 10, 2013 at 3:55
  • Also, that command still isn't allowing me to write to the drive. Commented Jul 10, 2013 at 3:58
  • have you tried mounting the directory manually and attempted a basic copy/write with a standard user?
    – Scandalist
    Commented Jul 10, 2013 at 4:02
  • Manually works fine. I'm trying to get it to work automatically on boot. Commented Jul 10, 2013 at 4:04
  • 2
    @JosiahSprague : Scandalists answer is not correct. You can't chmod a vfat mount. You can for NTFS if it's configured correctly. You will have to set the permission in the fstab. Refs: arstechnica.com/civis/viewtopic.php?f=16&t=724261 ... forums.justlinux.com/…
    – Michael M
    Commented Sep 29, 2013 at 5:39
1

The "user" option just let the user mount the device, it has no relation to access rights for the file.

As in gnp answer, see "uid"/"gid" and "umask" option.

0

FWIW: “when I tried to unmount it as a normal user it said that only a super user can unmount the drive. That's confusing to me, since I thought that's what the user option was for.”

User option means that only the user that mounted a filesystem can unmount it again. In your case, it seems that the drive was mounted during the startup, before you login – it means it was a super user mount. If any user should be able to unmount it, then use users instead of user in the fstab line. For more details, see man mount and/or man fstab.

(The solution of the problem itself was already explained – to make the drive all users writable, use umask/dmask/fmask options in fstab, eventually combined with uid/gid options. Again, man mount and/or man fstab will help. Chmod on vfat is really impossible, as a fat filesystem simply knows nothing about access rights.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .