第6章 Storage

6.1. Devices Which Can Be Used As Storage

The devices shown in 表6.1「Storage Devices」 can be used as storage on Armadillo.

表6.1 Storage Devices

Device TypeDisk DeviceFirst Partition
USB Flash Memory/dev/sd*/dev/sd*1
microMMC / microSD Cards/dev/mmcblk*/dev/mmcblk*p1

6.2. Storage Initialization and Mounting

Using a microSD card as an example, the following explains how to initialize and mount storage.

6.2.1. Disk Initialization

Make one partition on the microSD card.

[armadillo ~]# fdisk /dev/mmcblk0

Command (m for help): d
No partition is defined yet!

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-7375, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-7375, default 7375):
Using default value 7375

Command (m for help): p

Disk /dev/mmcblk0: 1004 MB, 1004535808 bytes
7 heads, 38 sectors/track, 7375 cylinders
Units = cylinders of 266 * 512 = 136192 bytes

        Device Boot    Start       End    Blocks   Id  System
/dev/mmcblk0p1               1        7375      980856   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
 mmcblk0: p1
 mmcblk0: p1
Syncing disks.

図6.1 Disk Initialization Method


6.2.2. Filesystem Creation

Create a filesystem on the newly initialized disk partition. Here, an ext3 filesystem is created on partition one of the microSD card (/dev/mmcplk0).

[armadillo ~]# mke2fs -j /dev/mmcblk0p1
mke2fs 1.25 (20-Sep-2001)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
122624 inodes, 245214 blocks
12260 blocks (4%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
15328 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180.00 days, whichever comes first.  Use tune2fs -c or -i to override.

図6.2 Filesystem Creation


6.2.3. Mounting

After creating the ext3 filesystem at /dev/mmcblk0p1 it can be mounted at /mnt by executing the command as shown in 図6.3「Mount Method」.

[armadillo ~]# mount -t ext3 /dev/mmcblk0p1 /mnt

図6.3 Mount Method


6.3. Operational Check

Using a microSD card as an example, the following explains how to perform an operational check of storage. The steps in 「Storage Initialization and Mounting」 must have been performed first.

6.3.1. Writing Data

Write data to the storage. The command below copies the busybox executable file to storage.

[armadillo ~]# cp /bin/busybox /mnt/

図6.4 Writing Data To Storage


To ensure that the data is written to storage, unmount and then remount the storage.

[armadillo ~]# umount /mnt
[armadillo ~]# mount -t ext3 /dev/mmcblk0p1 /mnt

図6.5 Writing Data To Storage


6.3.2. Checking Data

Check the data previously written to storage. If executing the commands below produces the same MD5 checksums for both /bin/busybox and /mnt/busybox, then this confirms that the storage is operating correctly.

[armadillo ~]# md5sum /bin/busybox
124f7023cd7714b2ac15ae4e0a735244  /bin/busybox
[armadillo ~]# md5sum /mnt/busybox
124f7023cd7714b2ac15ae4e0a735244  /mnt/busybox

図6.6 Storage Data Check