Mounting with sync Handbook is incorrect

23 Apr 2017

I'm not too sure where to post this so I just decided to post it as a suggestion.

In the Mounting with Sync handbook (https://developer.mbed.org/handbook/Mounting-with-sync), under the Linux section, it says to add "/dev/sdb /media/MBED vfat rw,user,sync 0 0" to your fstab file. This will NOT work. This is because vfat does not use regular permissions like other partition types (such as ext2), so the rw and user modifiers will not affect it. The issue with using an mbed with Linux is that Linux typically does not automatically save files onto a drive until it is unmounted. To set up an mbed to work on a Linux machine without having to constantly unmount and mount the device, the following should be added to the fstab file:

/dev/sdb /media/MBED vfat sync,noauto,umask=007 0 0

The sync modifier will allow it to automaticall save (like in Windows), the noauto will tell it to not automatically sync on startup (just in case) and the umask=007 will set the permissions to be 777-007 = 770. This gives the user and group full read, write, and execute permissions, but not the world.

16 Feb 2018

Hi Ben Kim,

Thank you for the post. It led me to the working solution for Debian 9 with one slight change. In both cases, user and group for the mounted filesystem is root, so it is inaccessible for others unless umask is set to 000. Setting filesystem accessible to everyone is a security issue, but at least uploading firmware to the mbed is working correctly. But if umask stays 007, as you suggested, uid and gid should be added and set. So the following should be added to the fstab file:

/dev/sdb /media/MBED vfat sync,noauto,umask=007,uid=1000,gid=1000 0 0

The uid and gid are the user and group indentifiers. Usually, they are 1000 for the first user and its group but could be found using "id" command.

05 Nov 2019

Hi. I know it's been years since it was discussed. As an Arm engineer, I made update to the relevant document you mentioned. https://os.mbed.com/handbook/Mounting-with-sync?action=view&revision=269947