Since Beaglebone Black(BBB) internal memory is limited to 4GB and further more, 3.5 GB is already allocated to system and other process. Hence for us to install new modules/programs very less space is left. So it is good idea to use 8/16 GB SD card instead. We can boot from SD card and use the left over space in card to install other modules and programs.
To enable this feature, we must format, partition, resize the SD card. Please follow below steps to achieve this:
1) Format the 8 GB card using SD Formatter tool
2) Download the latest Beaglebone image from: http://beagleboard.org/latest-images
3) This image will be a zip file that MUST BE unzipped using 7-Zip tool.
Get it here: http://www.7-zip.org/download.html
4) Once image file is unzipped, burn this image to the formatted SD card using Win32DiskImager utility.
Get it here: https://win32-disk-imager.en.uptodown.com/windows
5) Plug the SD card to BBB, keep pressing the boot button and then power on. Remove the hold from boot button when you see all the USR LEDs are lit. This step will allow BBB to boot up from SD card than the eMMC flash
6) Once boot is over, you can verify that the root file system is the SD card now by using below command (first switch to root user using su - root):
root@beaglebone:~# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p1 3.3G 2.8G 296M 91% /
You can see /dev/mmcblk0p1 (i.e. SD card) is mounted on root i.e. ‘\’ . But the space is shown as ~4GB only while our SD card is 8GB. To get the full space, we now need to do the partitioning and resizing. Follow below steps to do this (first switch to root user using su - root):
root@beaglebone:~# sudo fdisk /dev/mmcblk0
This will start the fdisk utility. Below are the steps for this utility. Please note the bold magneta text that we need to input when prompted by the utility.
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p // to print the status
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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
Disklabel type: dos
Disk identifier: 0xca52207f
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 8192 6963199 6955008 3.3G 83 Linux
Command (m for help): d //to delete the partition
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n // to create new the partition
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p // ‘p’ for the primary partition
Partition number (1-4, default 1):
First sector (2048-15523839, default 2048): 8192 // the ‘Start’ sector. See the result ot ‘p’ at the very begining
Last sector, +sectors or +size{K,M,G,T,P} (8192-15523839, default 15523839):
Created a new partition 1 of type 'Linux' and of size 7.4 GiB.
Command (m for help): p // to print the status
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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
Disklabel type: dos
Disk identifier: 0xca52207f
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 15523839 15515648 7.4G 83 Linux
Command (m for help): w // to save and quit the fdisk utility
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: 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).
NOTE: You might receive the above error message in red. For this, you need to run below commands:
sudo partprobe
Now the partition has been created and only thing remaining is to resize it. Use below command for this:
sudo resize2fs /dev/mmcblk0p1
And you will see the output like below:
resize2fs 1.43 (17-May-2016)
Filesystem at /dev/mmcblk0p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p1 is now 1939456 (4k) blocks long.
Now recheck below command:
df -h|grep '/dev/mmcblk0\|Avail'