How to use external mass storage devices

From RidgeRun Developer Connection
Revision as of 15:54, 25 May 2011 by Mmadrigal (Talk | contribs)

Jump to: navigation, search


This whitepaper shows how to use a SD card or an USB drive as an storage media when using a LeopardBoard DM36x.

How to use a SD card as storage media?

In order to use a SD card as a storage media you must insert it into the MMC/SD card slot located in the LeopardBoard DM365 as is shown in the Figure 1.

Figure 1. MMC/SD Card connection.

Once you have inserted the SD card into the slot you will be able to see an output like the showed below, if you started the board with the SD card plugged, you must type the dmesg command in your target and look for the output into the log message.

mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new high speed SD card at address 0002
mmcblk0: mmc0:0002 00000 1.86 GiB 
 mmcblk0: p1

In the example showed the SD card was detected with the device name mmcblk0 and there was only one partition detected p1. In order to get access to the SD card you must mount it first following the next steps:

1. Create a directory where to mount the device

mkdir <directory> i.e. ''mkdir -p /media/sd''

2. Mount the device

mount /dev/<device name> <target directory> i.e. ''mount /dev/mmcblk0p1 /media/sd''

Once your SD have been mounted, you can access its content by entering into the directory where you mounted it. Everything you write into this directory will be written into the SD card. When you finish to write data into the SD card you must unmount it before you extract it by running the following command:

umount <directory> i.e. umount /media/sd

How to use a USB drive as storage media?

In order to use your LeopardBoard's USB port to connect a USB drive device you must first setup your board in USB Host mode. See How to configure DM365 for USB host, device and OTG support for details.

Once your board has been configured in Host mode you can connect your USB drive to the board and get the an output similar to the shown below.

usb 1-1: new high speed USB device using musb_hdrc and address 3
usb 1-1: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
scsi 1:0:0:0: Direct-Access     Kingston DataTraveler G3  1.00 PQ: 0 ANSI: 2
sd 1:0:0:0: [sda] 3913664 512-byte logical blocks: (2.00 GB/1.86 GiB)
sd 1:0:0:0: [sda] Write Protect is off
sd 1:0:0:0: [sda] Assuming drive cache: write through
sd 1:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: [sda] Assuming drive cache: write through
sd 1:0:0:0: [sda] Attached SCSI removable disk

In the previous output it is possible to see that the USB drive was recognized with the device name sda with just one partition: sda1. Once you get the name of the partition you want to use you can follow the next steps in order to get access to it from your target.