How to get mbed to sync quickly on Ubuntu?

13 Apr 2010

Quick question. I want to add a line to my fstab so that new file writes to the mbed get synced more quickly. Does anyone know what the line should look like that I should add to fstab?

I did find a post from Mike Sheldon that hints at the possibility. Below is the post that I found.

Thanks for any helpful tips,

Jim

Mike Sheldon wrote:

By default most linux distributions won't write data immediately to disk, they'll do it at various intervals and when the device is unmounted. So you can either run the "sync" command to force writing of data, or unmount the device before resetting it, or as a long term solution make an entry in /etc/fstab for the mbed and add the "sync" option so that it always writes data synchronously to that device (you'll need root privileges for this though).

Cheers,

Mike.

13 Apr 2010 . Edited: 13 Apr 2010

Unfortunately, with modern distros like Ubuntu, this is made very much more complicated thanks to the interactions of HAL, udev and friends.

I don't have a ubuntu desktop machine in front of me right now to test, but (theorising) it's possible that you can simply override how HAL decides to mount a filesystem by adding a line to your /etc/fstab -

First find out the id of your mbed using 'blkid'

Having that, the line may look something like:

UUID=d096014a-182a-4c4c-bf71-0da773c8d876 /media/mymbed auto sync 0 0

You'll want to ensure you have created /media/mymbed

(Completely untested, and probably will not work!)

Update: Turns out this was in the FAQ's all along! http://mbed.org/support/FAQ0006

13 Apr 2010

Bingo,

It works!

Here is the magic string for fstab that worked for me:

/dev/sdb        /media/MBED     vfat    rw,user,sync    0       0

 

Thanks for the FAQ link - that was excatly what I needed.