1. Partitioning the uSD card for uSD card booting in Beaglebone Black
Use adaptor or card reader for accessing micro sd card in PC, Insert the card to the PC and
open the terminal for partioning the sd card.
Use the below command for partitioning/viewing the partitions already present in sd card:
$sudo fdisk /dev/sdb
It is not neccessary to be “sdb”, if you were using one or two usb ports already, check which
is your card port, it may be “sdb” or “sdc” depends on your usage of ports. After using the
above command, you will get like this:
Command (m for help):
Now use option 'p' to view the partitions of sd card, since we are using new sd card, it will
display like this below:
Command (m for help): p
Disk /dev/sdb: 7901 MB, 7901020160 bytes
244 heads, 62 sectors/track, 1020 cylinders, total 15431680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
Command (m for help):
Note the number of bytes : 7901020160, it will be used while calculation of cylinder.
Now use the option 'x' , it will goes to the Expert command mode, give values as below
Command (m for help): x
Expert command (m for help): h
Number of heads (1256, default 244): 255
Expert command (m for help): s
Number of sectors (163, default 62): 63
Expert command (m for help): c
Number of cylinders (11048576, default 1020): 961
Expert command (m for help): r
Command (m for help):
After entering the values option 'r' use to return to normal mode.
2. Partitioning the uSD card for uSD card booting in Beaglebone Black
Calculation for No.of.cylinders = Total.no.of.bytes on sd card/head/sector/512
= 7901020160/255/63/612 = 961 (rounded)
1. Creation of First Partition:
To create a new partition, use option 'n' , it will ask for partion type - select 'p' for primary,
then give the partition number and sector value.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (14, default 1): 1
First sector (204815431679, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (204815431679, default
15431679): +116M
Then make the first partition as FAT and bootable, for that use 't' and 'a' options as follows:
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): L
You will get a big list of codes from that select code “c” for “W95 FAT32 (LBA)”
To make partition to 'bootable' use 'a' option and give the partition number as follows:
Command (m for help): a
Partition number (14): 1
Now first partition is created and to check that use 'p' option as below:
Command (m for help): p
Disk /dev/sdb: 7901 MB, 7901020160 bytes
255 heads, 63 sectors/track, 961 cylinders, total 15431680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 239615 118784 c W95 FAT32 (LBA)
3. Partitioning the uSD card for uSD card booting in Beaglebone Black
2. Creation of Second Partition:
Follow the same procedure as we done for first partition except the FAT and Bootable.
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (14, default 2): 2
First sector (23961615431679, default 239616):
Using default value 239616
Last sector, +sectors or +size{K,M,G} (23961615431679, default
15431679): +3G
To check partition after creating second partition, do option 'p' as follows:
Command (m for help): p
Disk /dev/sdb: 7901 MB, 7901020160 bytes
255 heads, 63 sectors/track, 961 cylinders, total 15431680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 239615 118784 c W95 FAT32 (LBA)
/dev/sdb2 239616 6531071 3145728 83 Linux
3. Creation of Third partition:
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (14, default 3):
Using default value 3
First sector (653107215431679, default 6531072):
Using default value 6531072
Last sector, +sectors or +size{K,M,G} (653107215431679, default
15431679):
Using default value 15431679
4. Partitioning the uSD card for uSD card booting in Beaglebone Black
After creating three partitions, it will be like this as below:
Command (m for help): p
Disk /dev/sdb: 7901 MB, 7901020160 bytes
255 heads, 63 sectors/track, 961 cylinders, total 15431680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 239615 118784 c W95 FAT32 (LBA)
/dev/sdb2 239616 6531071 3145728 83 Linux
/dev/sdb3 6531072 15431679 4450304 83 Linux
4. Writing the created partitions to card:
Finally we have to do option 'w' to write all partitions we have created to card
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
5. Unmount the Sdcard partitions as below:
$ umount /dev/sdb1
$ umount /dev/sdb2
$ umount /dev/sdb3
5. Partitioning the uSD card for uSD card booting in Beaglebone Black
6. Creating File Systems on New Partitions:
After creating partitions in micro SD card, we have to create appropriate file system
corresponding to the partitions. Follow the below commands as below:
$ sudo mkfs.vfat -F 32 /dev/sdb1 -n boot
mkfs.vfat 3.0.12 (29 Oct 2011)
$ sudo mke2fs -L FirstRootFs /dev/sdb2
mke2fs 1.42 (29-Nov-2011)
Filesystem label=FirstRootFs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
196608 inodes, 786432 blocks
39321 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=805306368
24 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
$ sudo mke2fs -L SecondRootFs /dev/sdb3
mke2fs 1.42 (29-Nov-2011)
Filesystem label=SecondRootFs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
278528 inodes, 1112576 blocks
55628 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1140850688
34 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done