You are viewing an older revision! See the latest version

Mounting with sync

Table of Contents

  1. OS X
  2. Linux

Mbed OS 2 and Mbed OS 5

This is the handbook for Mbed OS 2. If you’re working with Mbed OS 5, please see the new handbook.

This page describes how to configure Linux or OS X to mount the mbed Microcontroller with the 'sync' option, this ensures files copied to the board are written immediately and without having to 'Eject' the drive.

Note: It is not necessary on all systems, but we haven't made up a list yet. Use this if you found you needed to "eject" before the file was properly transfered

OS X

Open a Terminal window and edit (or create) the file /etc/fstab with a text editor such as pico for example with the command:

sudo pico /etc/fstab

Add an entry to the end of the existing fstab file for the mbed device,

LABEL=MBED none msdos rw,sync

Do not change any other entries in /etc/fstab.

Save the updated /etc/fstab then reconnect the mbed board so that the drive is mounted with the new configuration.

Note that you must update the text following LABEL= in fstab if you change the volume label of your mbed board.

Linux

There are several possible ways to achieve this on Linux but the most reliable seems to be to simply add a static entry in fstab. For distributions that use tools like pmount or gnome-mount to automatically mount removable devices you may be able to configure these to get a similar result.

You might want to consider using no change to `/etc/fstab` at all. Because it will still work with mounting to `/media/<username>/DAPLINK#` mount points. Check if it's working for you. However, it may not reliably work for Mbed automated tests like Greentea. If then, please consider following option.

Open a Terminal window (shell) and run mount to get a list of the currently mounted file systems, you should see a entry for the mbed board like this:

/dev/sdb on /media/MBED type vfat (rw,nosuid,nodev,shortname=mixed,uid=1000,utf8,umask=077)

edit /etc/fstab with a text editor such as pico, for example, with the command:

sudo pico /etc/fstab

NOTE: You might want to use `vi` as well.

Add an entry to the end of the existing fstab file for the mbed device, changing /dev/sdb if necessary.

/dev/sdb /media/MBED_B vfat rw,user,sync,nofail,umask=007,gid=20 0 0
/dev/sdc /media/MBED_C vfat rw,user,sync,nofail,umask=007,gid=20 0 0

Depending on some system, your /etc/fstab may fail. And /etc/fstab failure may cause system boot failure. In order to check validity of your /etc/fstab, please try running `sudo mount -a` before rebooting the system. `nofail` will try to ignore mounting failure. `umask=007` will only block `others` from access. `gid=20` will only allow group access of `dialout=20`. If you have other group access need, please improvise. FYI, you can check your id and gid via `id` command.

Please do not try to create like `MBED_D` to `MBED_Z`. Just create enough entries in `/etc/fstab`, you never know and you don't want to debug or connect D to Z devices to your machine. If you have 4 ~ 5 Mbed devices, then you will only want to create until `MBED_G`.

Do not change any other entries in `/etc/fstab`.

Save the updated `/etc/fstab` then create the mount point with:

sudo mkdir -p /media/MBED_B
sudo mkdir -p /media/MBED_C

And you will need to add your id to `dialout` group.

sudo usermod -a -G dialout <username>

Reconnect the mbed board so that the drive is mounted with the new configuration. There may be glitches of old configuration applying instead of the new configuration. In such case try `sudo umount -a; sudo mount -a`.

If you have several removable devices you may find that the mbed board is not always /dev/sdb. If so, you can replace /dev/sdb with a symbolic link from /dev/disk/by-id which uniquely identifies one mbed board using its serial number or create a udev rule to create a persistant name like /dev/mbed1.


All wikipages