Mount Image to MicroSD

From Estone Technology Wiki
Jump to: navigation, search

Previous Section: Build Yocto Image From Scratch

Create MicroSD Image

Preparing MicroSD Card


  • Host Machine (Linux Ubuntu)
  • MicroSD Card (Minimum 8GB)
  • GParted (Filesystem Manager)

Prepare MicroSD with fdisk

1. Plug MicroSD to the host machine (Linux Ubuntu)
2. Open Terminal by pressing Ctrl+Alt+T keys in your keyboard simultaneously
3. In the terminal type in lsblk command to see what letter your MicroSD card was given
(Example: /dev/sda, /dev/sdb, /dev/sdc, etc..)

$ lsblk                                           


4. Locate the MicroSD card in the HDD menu Note: MicroSD letter (/dev/sd<x>) is dependent on the amount of HDD's that are connected to the host machine
Example: As shown in the image, MicroSD is located at /dev/sdc

5. Once MicroSD is located run the fdisk command to start MicroSD Filesystem preparation

$ sudo fdisk /dev/sd<x> 


  • Here is a list of all available options:

Command (m for help): m 
  a   toggle a bootable flag
  b   edit nested BSD disklabel
  c   toggle the dos compatibility flag
  d   delete a partition
  F   list free unpartitioned space
  l   list known partition types
  n   add a new partition
  p   print the partition table
  t   change a partition type
  v   verify the partition table
  i   print information about a partition
  m   print this menu
  u   change display/entry units
  x   extra functionality (experts only)
  I   load disk layout from sfdisk script file
  O   dump disk layout to sfdisk script file
 Save & Exit
  w   write table to disk and exit
  q   quit without saving changes
 Create a new label
  g   create a new empty GPT partition table
  G   create a new empty SGI (IRIX) partition table
  o   create a new empty DOS partition table
  s   create a new empty Sun partition table

6. We will now create the first partition for the MicroSD

Command (m for help): n 
Partition type
  p   primary (0 primary, 0 extended, 4 free)
  e   extended (container for logical partitions)
Select (default p): p 
Partition number (1-4, default 1): 1 
First sector (2048-124735487, default 2048): 10240 
Last sector, +sectors or +size{K,M,G,T,P} (10240-124735487, default 124735487): +100M 

Created a new partition 1 of type 'Linux' and of size 100 MiB.

7. Now we will create the MicroSD second partition

Command (m for help): n 
Partition type
  p   primary (1 primary, 0 extended, 3 free)
  e   extended (container for logical partitions)
Select (default p): p 
Partition number (2-4, default 2): 2 
First sector (2048-124735487, default 2048): 215040 
Last sector, +sectors or +size{K,M,G,T,P} (215040-124735487, default 124735487): Press 'Enter' key 

Created a new partition 2 of type 'Linux' and of size 59.4 GiB.

8. Once the 2nd partition is created you need to write changes to the MicroSD card

Command (m for help):  w 
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

9. Now we will add partition filesystem type to the 2 partitions that were created

For 1st Partition:

$ sudo mkfs.vfat -n 'BOOT' /dev/sd<x>1

Mkfs vfat.png

For 2nd Partition:

$ sudo mkfs.ext4 /dev/sd<x>2

Mkfs ext4.png

Prepare MicroSD with GParted

  • GParted allows to update Storage devices with GUI

1. Open the Ubuntu Software Application

2. Search and type gparted

3. Click the GParted icon and Install

4. Launch GParted by pressing the Launch button and wait for application to start

5. Once application has started, the GParted window will pop-up as shown in the image below: Gparted.png

6. Choose your MicroSD selection by pressing on the Hard Drive icon and select the location where your SDCard is located
Example: /dev/sdc

7. Once the MicroSD card is selected press on the Partition >>> new option to create 1st partition Gparted-partition-create.png