Home > Computer (HW and SW) > BEAGLEBONE BLACK: ACCESSING uSD AND USB STORAGE

BEAGLEBONE BLACK: ACCESSING uSD AND USB STORAGE

ACCESSING THE uSD CARD

Once the operating system is flashed to the internal eMMC, the uSD card can be used as storage and it is a convenient means to store music tracks.

The command “fdisk -l” will list all the storage devices seen by the operating system:

Here is without any devices in the uSD slot. Listed is the internal eMMC storage device (listing only relevant parts):

fdisk-l-noSD

After inserting a 32MB uSD card we see this additional device:

fdisk-l-32MSD

After inserting a 2 GB uSD card we see this device instead:

fdisk-l-2GSD

We realize that the any card inserted in the uSD slot is characterized by “/dev/mmcblk1p1″. “mmc” stands for “multimedia card” -both SD cards and eMMC devices conform to the “multimedia card” specification. “blk1″ I think represents “block device 1″ and “p1″ is “partition 1″

However, if the uSD card is already inserted during, we see the following:

fdisk-l-beforeboot

The device is assigned /dev/mmcblk0p1. It appears the the order the device numbers are assigned at boot time is uSD card first, then internal eMMC.

Mounting the uSD card

In order to access the contents on the uSD card, the device must be first mounted. First create a “mount point” (a folder). Here I use the directory /media which is already present. Under /media create a directory to mount the uSD card.  I created /media/card, /media/usb and /media/nas to represent the 3 different places where music tracks can be stored.

Use the command “mount”

mount.card

The “-v” flag in “mount” is optional. Means “verbose”. Notice that after mounting the uSD card, I can see the “smallmusic” directory and 1 mp3 track.

Keep in mind that if the uSD card is already inserted at boot time, it is assigned “mmcblk0p1″ instead of “mmcblk1p1″

ACCESSING USB MEMORY STICK

If digital audio is transmitted through the I2S interface, then the USB host can also be used for a USB memory device.

The same procedure can be used to mount a usb memory stick:

  1. Insert a USB storage to the USB host connector
  2. Type “fdisk -l” to identify the device. Notice that it is /dev/sda1
  3. Type mount /dev/sda1 /”mount point” in my case, mount /dev/sda1 /media/usb

Inserting a USB storage device will show up as:

fdiskUSB

Since there is only one usb host port, a USB memory device will always appear as /dev/sda1 whether it is present during boot or not.

AUTOMATING THE MOUNT PROCESS

It becomes cumbersome to have to access the board through the command line in order to mount a storage device. For a music device, the ideal is to have these storage devices mounted automatically.

I tried different ways to auto-mount the devices when they are inserted:

  • Autofs: looks like the most promising but did not work in my installation while following this excellent guide [link]
  • usbmount: works well with uSD cards and USB storage at any time after boot, but when deleting the X11 package, it wound fail to mount uSD cards. usbmount was last updated in 2007 and is currently unmaintained.
  • Add mount instructions in /etc/fstab which is invoked only during boot time.

For now the “best” option in my environment seems using /etc/fstab and ensuring the storage devices are present during boot. This seems a reasonable configuration for an audio player: Insert the storage devices and turn-on the device. Even if switching to another storage device requiring a reboot, the booting process is very short.

usbmount has better functionality because it works after boot. I didn’t like the fact that it stopped working for SD cards after I removed the X11 package (which I do not need). I’ll wait for more help on autofs and then I think I’ll switch to autofs.

For USB I added the following line to the /etc/fstab file.

usbFstab

Note the following:

  • Add the “nofail” option. Without it the board will not be able to boot if no USB memory is present in the USB port.
  • Ensure that the USB memory has a single partition since we are assuming it is always /dev/sda1. A newly formatted USB memory device will have a single partition

For the uSD Card and assuming that the card is inserted prior to boot, I added the following line:

fstab-card

Insert a uSD card and a USB memory device, boot the board and they will be mounted under /media/card and /media/usb (or whatever directory you had specified in /etc/fstab.

About these ads
  1. Salvo
    2014/03/19 at 18:28

    Just to know, in the hope to be not useless, each time you would need to mount agn a unmounted data disk that wasn’t there at the boot time do it with:
    root# mount -a
    The same will work if you have exchanged any data unmountable disk, doing at first, i.e.
    root#umount /media/usb
    Then the next command after you have inserted a new one media card/key (even the same you had umounted BTW) will be easy and clever:
    root# mount -a
    Maybe it is like mount automate, reads the /etc/fstab and mount any valid entry found
    Almost the same as at the boot time. This would mean that on each bout /etc/fstab will be read and all the disk partitions – mount points are to be mounted exactly in the same order and in the same places for the OS at the specified boot level.

    Maybe also the ‘df’ command, with all its switches …, will work.
    That’s much easy than using ‘fdisk -l’ … on my poor mind.

    That’s since BSD, mount, the first. I don’t remember about ‘df’. Several UNIX flavours have had changes for that last.

    Ciao.

    Salvo

    PS TU for all UR work, that’s really interesting from several points of view.

    • BlgGear
      2014/03/19 at 19:25

      Thanks for sharing.
      My concern is that as a music player, I would set it up totally headless. (of course in order to play a track, I would have to use the command line, but I have not thought of this part yet :-)). I did try autofs but couldn’t figure out why it would not work, so I gave up…

  2. 2014/03/22 at 15:33

    Another great post! you mentioned “low noise power supplies”. Can you prove some links?

    • 2014/03/22 at 15:34

      errr….provide some links :)

    • BlgGear
      2014/03/22 at 22:14

      For the moment I am using a linear 5V, 1A supply that came with an old ZIP drive. A linear supply (those bigger and heavier transformer-based) are lower noise than the newer switching types.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 201 other followers