Raspberry to run resin.io from Hard disk

Tested on another board with Resin OS 2.13.6+rev1: same problem.
The other board is running Resin OS 2.13.6+rev1 and support access has been granted until Aug 16th 2018, 5:38 pm.
@lekkas feel free to access the device when you want!

@daghemo Can you please send me a private message with the device URL?

@daghemo Thanks. Can I reboot the device a couple of times?

Feel free to do whatever you need! Also, you can destroy any application on the device if you want, really!

Do you have a serial console at your disposal? Can you flash a dev image and boot with a serial console attached?

Not right now, but I can try to get one. Any other option to boot flash the dev image, then save output to file?

I don’t understand what you mean. Could you detail?

Sorry @agherzan, I mean that I do not have a console cable ready at hand, but I will try to get one in some days.
Using a console cable is the only option or we can collect some information from logs on the board? That is, can we redirect console output to a file?

The problem seems to have the roots in the fact that the initramfs fails to expand the extended partition (and the data partition). I would need to provide you with a custom image that outputs logs in a file and copies after mounting the rootfs (or somewhere else). I would get a little complicated. I’ll try to see if I can reproduce on Monday though.

1 Like

Hi @agherzan, I’m back at home from holidays.
Any news? If not, I can put my hands on a console cable between today and tomorrow.

Hi @agherzan. As already said, I now have a console cable and I’m ready to do some testing.
Right now the Raspberry Pis are able to boot via USB, but the filesystem on it does not get resized.

Hi daghemo:

My Resin+HomeAssistant is killing almost every single SD card I use, so I was trying to run ot from USB. ¿Did you manage to boot the RPI 3+ with the USB balena image?


Last time I tested I was using Resin OS 2.15.1+rev1. Same problem.
@Kloonich, have you tried to flash a USB pen drive in place of a MicroSD card and try to boot your 3 B+?
Please note it should be a 3B+, not a 3B, as the this would require some extra work.

@agherzan, as you may remember, I am available for testing too. I think that replacing microSD with USB can save users from boot disk corruption.

Hey there. Been struggling to boot via USB. Gets to 98% downloaded then restarts with a not enough space error. What has your experience been?

I’ve used 2 different brand 32GB USB drives and a 3B+ RPi.


Hi @rick. Have you tried with the lasted Resin OS 2.29.0+rev1?
It sounds like the issue https://github.com/balena-os/balena-os/issues/396 has not been solved by @agherzan or someone else from the Balena team, yet. I opened the issue in October 2017, but the people at Balena have a lot of things to done and even done a lot of things. I suppose this cannot be seen as high priority on their side.
You may even try with a bigger device, but the problem here is that the image you’ve flashed needs to repartition the whole device, but this operation fails, so you only get the first N GB of your 32 GB USB pen drive. That’s why you see a not enough space error.

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.


Currently failing to run debian. Getting this error after downloading:

balena: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused “exec: “–privileged”: executable file not found in $PATH”: unknown.

@rick My mistake, the command should be balena run --privileged --name parted -dit debian. I’ll update my original instructions.

Yep! Worked perfectly for me, can’t thank you enough.

Hi, thanks for the help with getting Balena work on Raspberry Pi’s booting off of USB. I am using the latest version for the Pi 3, balenaOS 2.29.2+rev2. I just wanted to write up what I ended up doing.

First, I download the img file from Balena web dashboard.

Second, use Balena Etcher to burn the image to the SSD. Ignoring the warnings that it may not be what I want to do.

Third, open up the drive using Gparted on Linux. Below is a picture of the partition table.

Fourth, I expanded /dev/sdc4, which is of type extended. Which I learned means: " An extended partition is a special type of partition that can hold multiple logical partitions . It’s is like a container/wrapper of all logical partitions ."

Now it becomes a task of resizing the partitions in the correct order. My goal is for a huge resin-data directory, and also to solve the issue where I cannot push new code. Therefore I need to extend resin-state, and also resin-data.

So expand extended partition, expand resin-state, and expand resin-data. It didnt work completely that cleanly for me, I had to adjust “free space proceeding”, “new size”, and “free space following” a couple times until the structure matched what was before, but just with new sizes.


Hope that helps others!
Sorry I had to remove my other pictures, post limits am i right? Edit: Nice Im basic now!