Partition eMMC and create new mount point for a directory

I have a Beaglebone Black which collects a large amount of data, periodically sends the data off and then deletes it. Occasionally, the network connectivity is poor and the Beagle disk space completely fills up. The data collection script should stop as the disk fills up but I’d like to add another level of protection against a full disk.

Is is possible and advisable to create a small partition (perhaps 250MB) in the eMMC that could be mounted to a /data directory? I’d prefer to not to write the data to the SD card for performance reasons.

My understanding of the general process:

  1. Unmount the /dev/mmcblk0p1 partition

  2. Shrink the /dev/mmcblk0p1 partition by the desired amount

  3. Create a new partition in the free space and assign a file system

  4. Mount the new partition to a path

  5. Remount the /dev/mmcblk0p1 partition
    Some problems I haven’t resolved:

  6. Is it possible to boot off the SD card and access the Beagle eMMC with fdisk so it can be shrunk?

  7. Are there any pitfalls to be aware of when shrinking the /dev/mmcblk0p1 partition?

  8. Is it possible to modify either Rob Nelson’s flasher script or functions.sh to accomplish the creation of another partition when the image is initially burned into the eMMC?

  9. Is there a better approach to ensuring the disk doesn’t overflow?
    I’m using the Debian 9.4 2018-06-17 4GB SD IoT image.

Any insights or code examples would be greatly appreciated. Thank you very much.

Hi Tyler,

I have a Beaglebone Black which collects a large amount of data,
periodically sends the data off and then deletes it. Occasionally, the
network connectivity is poor and the Beagle disk space completely fills up.
The data collection script should stop as the disk fills up but I'd like to
add another level of protection against a full disk.

Is is possible and advisable to create a small partition (perhaps 250MB) in
the eMMC that could be mounted to a /data directory? I'd prefer to not to
write the data to the SD card for performance reasons.

My understanding of the general process:

Unmount the /dev/mmcblk0p1 partition
Shrink the /dev/mmcblk0p1 partition by the desired amount
Create a new partition in the free space and assign a file system
Mount the new partition to a path
Remount the /dev/mmcblk0p1 partition

Some problems I haven't resolved:

Is it possible to boot off the SD card and access the Beagle eMMC with fdisk
so it can be shrunk?

That will work just fine:

redhat has a good overview here.

https://access.redhat.com/articles/1196333

Are there any pitfalls to be aware of when shrinking the /dev/mmcblk0p1
partition?

Just be careful with fdisk when you specify the new partition size..

If you use "uuid" for booting that could change, but most people use
hard coded /dev/mmcblk0pX's now. :wink:

Is it possible to modify either Rob Nelson's flasher script or functions.sh
to accomplish the creation of another partition when the image is initially
burned into the eMMC?

That could be done, that script isn't really trivial anymore to make a
small change..

Is there a better approach to ensuring the disk doesn't overflow?

You could also look at btrfs partition with compression, which might
give you a little more room...

Regards,

Fantastic. Thank you very much, Robert!

Tyler