[BeagleBone Black] Expand File System Capacity on the MicroSD

In the previous section, we set up the BeagleBone Black Rev B to boot Debian OS off an MicroSD card. Here, we are going to expand the storage capacity in order to update the software and install apps.

Pretty much, I followed the instruction on the eLinux website, and it works perfectly! So you can read the details there, I will list the basic steps here.

Since the Debian image is only roughly 2 GB, I still have 6 GB left on my SD card. Therefore, I am going to use those as file system storage. To do that, I essentially delete the original storage partition on the SD card and create a bigger one that use the remainder of the space. Note, this is only work for booting off the MicroSD card. I still have to figure out how to expand the File System if I boot from eMMC.

1. We connect to the BBB through whatever program you preferred. As I mentioned before, I like SSH SecureShell Client, if you’re on Linux or Mac, PuTTY might work better.

hostname: 192.168.7.2
user: debian
password: temppwd

ssh login

2. Switch to superuser for root access, type the following and press enter:

 sudo su

*Note, if you want to switch back to another user account like debian, just type

 su debian

3. Open the SD card partition with the fdisk utility

 fdisk /dev/mmcblk0 

Press m to display the help menu…
Press p to display the partitions we got on the sd card.

You sould get something like this but with different size for mmcblk0p2:

fdisk p

We can see that in totial, this card got 7742 MB of room. The first partition, mmcblk0p1, is the boot partition, so we don’t want to mess with that. mmcblk0p2 is the file system storage drive. The Blocks are essentially kbs, so you can see, mine is roughly 7.4 GB, that’s after I went through this process, yours will be much smaller.

4. So, we are going to delete the second partition by entering to go into delete mode and then 2 to delete partition number 2. We are going to create a new partition by entering n, setting it to primary with p, selecting partition number 2, hit enter and enter to expand the partition to the remainder of the space and finally write to the drive with w. If for any reason you screwed up, just enter q at the main menu to quit without saving, then you can restart. Note that no changes are made until w is entered.

5. Reboot the device for changes to take effects, since we are using the partition now.

 reboot

6. After the BBB come back online (you might have to unplug power, plug back in, press the power button), log back into the superuser account and resize partition.


sudo su

resize2fs /dev/mmcblk0p2

7. Then, finally, we can check to see all of the storage available to us and go back to normal user to prevent further changes.


su debian

df -h

you should get something like this:

file system

BeagleBone Black Setup Series

Advertisements

4 thoughts on “[BeagleBone Black] Expand File System Capacity on the MicroSD

  1. Pingback: [BeagleBone Black] Enable USB Internet Sharing from Windows | Billwaa's Blog

  2. Pingback: [BeagleBone Black] Boot Debian OS from Image | Billwaa's Blog

  3. Pingback: [Beaglebone Black] Enable On-Board Serial UART | Billwaa's Blog

  4. I booted from the 32gb sd card..

    Since the linux image (debian 8.4) is only 4gb, I wanted to expand it so that I can install more programs.. unfortunately afer adding a primary partition
    (/dev/mmcblk0p1* 3.3GB , /dev/mmcblk0p2 26.6GB) and rebooting..

    I get an error message doing resize2fs /dev/mmcblk0p2 : Bad magic number in super-block while trying to open /dev/mmcblk0p2 Couldn’t find valid filesystem superblock

    Is there another way to grow the first (boot) partition so that it uses all 32gb? xfs_growfs doesn’t seem to be available.

    Would removing rall partitions (/dev/mmcblk0p*) and create a new partition that uses all the available space, will that kill the bootable filesystem?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s