SD Storage Partitions

This article introduce the device storage partitions. There are three topics: device compatibility, partition description and create steps.

1. Compatibility

1.1 Hardware Device

  1. ICM/ICS-2010
  2. ICM/ICS-2011

1.2 OS

  1. Yocto 1.6.2 (U-boot 2014.04, Kernel 3.10.53)
  2. Ubuntu 12.04 (U-boot 2014.04, Kernel 3.10.53)

2. Partition Description

The layout of the MMC/SD/TF card for device is shown below:

  • [Partition type/index] is which defined in the MBR.
  • [Name] is only meaningful in Android. You can ignore it when creating these partitions.
  • [Start Offset] shows where partition is started, unit in MB.
Num Type Name start offset Size File System Content
1 N/A boot 1 KB 1 MB N/A u-boot.imx
2 Primary 1 rootfs 16 MB 7.2 G ext4 root file system
3 Primary 2 recovery after rootfs 32 MB ext4 Reserved
4 Extended
5 Logical 5 system after recovery 1 MB Reserved
6 Logical 6 cache after system 1 MB Reserved
6 Logical 7 device after cache 1 MB Reserved
8 Logical 8 misc after device 1 MB Reserved
9 Logical 9 storage after misc 500 MB fat16
10 Logical 10 env after storage 90 MB fat16 boot-script, uImage and device-tree file

3. Steps

3.1 Requirement

An SD/MMC card reader, like a USB card reader, is required. It will be used to transfer the boot loader and kernel images to initialize the partition table and copy the root file system. To simplify the instructions, it is assumed that a 8GB SD/MMC card is used.

To identify the device node assigned to the SD/MMC card, enter the command:

$ cat /proc/partitions
major minor  #blocks  name
   8     0   78124000 sda
   8     1   75095811 sda1  
   8     2          1 sda2
   8     5    3028221 sda5
   8    32   43232323 sdb1
   8    18    3905535 sdc1
1
2
3
4
5
6
In this example, the device node assigned is /dev/sdc (a block is 512B large).
### 3.2 Create Partition
To create a partition, at offset 16384 (in sectors of 512 bytes) enter the following command:
$ sudo fdisk /dev/sdb u [switch the unit to sectors instead of cylinders] d [repeat this until no partition is reported by the 'p' command ] n [create a new partition] p [create a primary partition] 1 [the first partition] 16384 [starting at offset sector #16384, i.e. 8MB, which leaves enough space for thekernel, the boot loader and its configuration data] <enter> [using the default value will create a partition that spans to the last sector of the medium] w [ this writes the partition table to the medium and fdisk exits]

The file system format ext3 or ext4 is a good option for removable media due to the built- in journaling. Run the following command to format the partition:

$ sudo mkfs.ext3 /dev/sdb1

Or

$ sudo mkfs.ext4 /dev/sdb1

More info: Reference