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
2. Switch to superuser for root access, type the following and press enter:
*Note, if you want to switch back to another user account like debian, just type
3. Open the SD card partition with the fdisk utility
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:
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 d 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.
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:
BeagleBone Black Setup Series
- Boot Debian from MicroSD
- Expand Debian File Capacity from MicroSD
- Enable USB Internet Sharing
- Enable On-Board Serial UART Ports