Basics: Using persistent storage /data

Hi there

I still have problems understanding how the persistant storage works.
So far I understand, that the /data is part of a docker volume, which is kind of an instance of a docker image…

And my resin app also runs in a docker volume, but another one, right?

When I do a git push resin master it builds everything. After that the image is deployed to the device. After the deploy resin will use docker to «mount» it

So only after the app is running the /data is available, because before there is no image and cannot be run?

Now there is a lot of description about mounting sd cards with persistent storage… https://docs.resin.io/learn/develop/runtime/#persistent-storage
But I think this does not even apply for my case.
I don’t have any additional USB or SD Card. I just have the one SD Card with my resinified raspberry system on it.
Is the assumption correct that the chapter about mounting /data is only important for additional SD Cards and USB sticks?

In my case, I just want to copy a file to the /data to be used by the application.
I tried to connect the SD Card to my mac with an app to mount ext4 linux file systems.

This does indeed show me 5 volumes, but I could not figure out which one would hold the /data folder.
Will I even see it by doing this, or do I have to mount it in a special way, as desribed in the documentation?

Thanks for any help on this matter…

Cheers

I’d also be happy to provide more information if needed, but at the moment, I don’t even know, what else could be important. o.O

Can we access the /data accessibly from the services from the HostOS? What is the path?

Hi
I can try to set this right:
We are looking at 3 different docker items: images, containers, and volumes.
An image is kind of a blueprint of a container. It defines everything that will exist in the container when it is first started.
A container is what you get when you call docker start on an image. It is an instance of the image running and it will contain runtime data too but this data only lives as long as the container. You can stop and restart the container but once you delete it all the data it has gathered is gone.
Volumes are a way of mounting persistent data storage in a container. The volume has its own lifecycle and will exist independently from the container until you delete the volume.

If you want to access your /data directory from the host OS you will have to put it in a volume.
To define a volume for your container you will need to use a docker-compose.yml file. You can look at the sample in


which also defines a volume.

Once the container is active you can call

balena container inspect <container-id>

and find the “Mounts” section in the output. There you should see something like the following:

{
"Type": "volume",
"Name": "b62f0be538800d0299444546a9bb9369609ae035ff3b6a5bfc6a0534c9ec4525",
"Source": "/var/lib/docker/volumes/b62f0be538800d0299444546a9bb9369609ae035ff3b6a5bfc6a0534c9ec4525/_data",
"Destination": "/sys/fs/cgroup",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}

where “Source” is the path to the physical location of the volume files in the host OS.

By the way

JAN 10, 11:55 AM

Thank you! Because the service (container) was running, but I couldn’t connect to it using the balena dashboard I used:

find / -name mylog.log -print

to find the place where the log files in /data were being written with respect to the HostOS.

By the way if you want to access volumes on the SD card from another device you will have to access the 6th partition = /dev/mmcblk0p6
resin-data because /var/lib/docker/volumes is mounted in /docker/volumes/ on that partition

1 Like