Raspberry to run resin.io from Hard disk

Until this issue is resolved in balena OS, if you want to run balenaOS from a USB stick on a raspberryPi 3 you will need to manually increase the size of the disk partitions.
I tested this on a raspberryPi 3 model B v1.2 using balenaOS 2.29.0+rev1:

  1. Log into the Host OS (I used the webterminal, but the CLI would work as well)
  2. Download and run a debian docker container in privileged mode
    balena run --privileged --name parted -dit debian
  3. Enter a bash session in the container
    balena exec -it parted bash
  4. Update packages
    apt-get update
  5. Install parted
    apt-get install parted
  6. Resize partition 4 using parted
    parted /dev/sda -- resizepart 4
  7. You will see a warning saying Warning: Partition /dev/sda6 is being used. Are you sure you want to continue?, this is ok, just type Yes and continue.
  8. You will be prompted for an end value for the resize (it will look like this End? [1808MB]?), here you need to type -1s (-1s specifies exactly the last sector).
  9. Follow the same steps (7 & 8) for partition 6 using parted /dev/sda -- resizepart 6
  10. exit the docker container back to the Host OS
  11. run partprobe to re-read the partition table and then check the sizes of the partitions
    partprobe && fdisk -l
  12. You should now see that the partition sizes match up with the size of your USB drive
  13. Finally, clean up the docker container and image
    balena stop parted && balena rm parted && balena rmi debian

It should, in theory, be possible to skip the interactive mode of parted using the -s flag, however I couldn’t get it to work. The only way I could get the parted commands to run was using the interactive mode.

3 Likes