element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Review Blogs HARTING MICA: SD Card as Shared Storage
  • Blogs
  • RoadTest Forum
  • Documents
  • RoadTests
  • Reviews
  • Polls
  • Files
  • Members
  • Sub-Groups
  • More
  • Cancel
  • New
Join RoadTests & Reviews to participate - click to join for free!
  • Share
  • More
  • Cancel
  • Author Author: Jan Cumps
  • Date Created: 9 Jun 2019 11:34 PM Date Created
  • Views 1817 views
  • Likes 6 likes
  • Comments 6 comments
Related
Recommended
  • mica
  • harting
  • sdcard
  • smb
  • cifs
  • linux

HARTING MICA: SD Card as Shared Storage

Jan Cumps
Jan Cumps
9 Jun 2019

I roadtested the Harting MICA Complete IIoT Starter Kit.

In this follow up, some experiments with the SD card: how to mount it in a container and how to share it on the network.

image

The documentation for the SD card options is terse. What you can see here are my try-outs. If you have a better solution, please comment.

 

For this exercise, It's expected that you have a formatted SD card installed in the mica, with at least one file on it - so that we can see if the content can be accessed.

 

Use the Internal Character Device to Mount the SD Card on a Container

 

Thank you Gough Lui for the help to get this working.

 

The sdcard is available as /dev/mmcblk1p1.

You can mount it by registering it in the fstab file.

However, when the init.d system calls mount at startup, the SD card device isn't ready yet.

A solution is to run it at system (re)boot, after devices are initialised. One option is to use cron.

 

You need to install 2 modules:

 

apt-get install findutils
apt-get install cron

 

Create a mount point:

 

mkdir /media/sdcard
chmod 770 /media/sdcard

 

Add the following line at the end of /etc/fstab:

 

/dev/mmcblk1p1 /media/sdcard vfat nofail,gid=46,umask=017,dmask=007  0 0

 

This registers it as a root writeable file system. Other users need sudo, except when they are in the group plugdev (46).

In the next section, I show how to grant individual users access.

umask 007 and dmask 17 are these responsiblilities:

imageimage

 

I wanted to block users from executing files from the sdcard, but they need executable right on directories or they can't access them.

By setting umask=007, files are not executable, except for root. By setting dmask=017, directories are executable and the user can navigate to them.

 

Then add this line to /etc/crontab (I added it to the begin because it's something that runs early on, but you can place it anywhere in the file):

 

@reboot root mount /media/sdcard

 

Test this. I tried several combinations, such as only rebooting the container and restarting the full mica.

Check the mount point to see if you can see - and have access to - the mount.

 

ls -l /media/sdcard

 

image

 

Giving other users access

You do that by adding those users to the plugdev group:

 

adduser jancumps plugdev

 

Next time the user account logs in, it can create and write files on the sdcard.

Here's a directory listing and successful write made by my user:

image

(I edited the picture but this reflects the reality)

 

Share the SD card on the Network

 

There's a dedicated container to give network access to the SD card. It allows you to publish the SD card as a share.

Configure it similar to this:

 

image

 

The share is now available on the network.

image

 

 

If you want to mount this shared drive into a mica container, install CIFS utilities package.

 

apt-get install cifs-utils

 

Instead of the entry in the previous chapter, add this to the /etc/fstab:

 

//NAS/<sharename you used in the NAS container> /media/sdcard cifs  credentials=/home/<youruser>/.smb 0 0

 

Make a file /home/<youruser>/.smb with the following content (password is the one you configured in the NAS container settings):

 

user=root
password=<password you used in the NAS container>
domain=home

 

I could not get this to work by using the @reboot hook in /etc/crontab. I used a 1 minute schedule:

 

* * * * * root mount /media/sdcard

 

Disadvantage, except for the resource use every minute, is that when you unmount the volume, it mounts again. It may not be what you want.

 

Related Blog
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 1: User Experience
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 2: MICA Debian Stretch Setup
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 3: Eclipse Configuration on Windows
HARTING MICA: Develop and Debug a C GPIO Example in Eclipse - Part 4: Build and Debug the GPIO Example
HARTING MICA: Make a Safe(r) MQTT Container with Certificate and TLS/SSL
HARTING MICA: Manage Access to USB and other Devices
HARTING MICA: SD Card as Shared Storage
HARTING MICA: Alpine Linux and another MQTT Container with Certificate and TLS/SSL
HARTING MICA: Connect to Amazon Web Services
HARTING MICA: Install Java 8 VM in a Debian Stretch Container
HARTING MICA: Read BOSCH CISS Sensor with Java - part 1: USB Connect and Listen
  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 6 years ago in reply to DAB +1
    DAB wrote: ... Is there a way to secure the data on the SD card? ... There's the physical security: the sdcard is mounted inside the box and it's not removed or replaced in 1-2-3. When installed in a locked…
  • Jan Cumps
    Jan Cumps over 6 years ago

    I haven't been able to set the mount rw for non-root users yet.

     

    My fstab line:

    /dev/mmcblk1p1 /media/sdcard vfat auto,user,dmask=0000,fmask=0111 0 0

    I've also tested combinations like

    • uid=1000,gid=1000
    • dir_mode=0700,file_mode=0700,nounix

     

    but it always results in not-writeable for non-root:

    root@DebianStretchRoadtest-mica-grvnb:/media# mount | grep sdc
    /dev/mmcblk1p1 on /media/sdcard type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
<
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube