# Basics: Using persistent storage /data

**URL:** <https://forums.balena.io/t/basics-using-persistent-storage-data/2711>\
**Category:** Product support\
**Created:** [March 14, 2018, 3:58pm UTC](https://forums.balena.io/t/basics-using-persistent-storage-data/2711 "2018-03-14T15:58:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jones](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@Jones](https://forums.balena.io/u/Jones)\
**Post date:** [March 14, 2018, 3:58pm UTC](https://forums.balena.io/t/basics-using-persistent-storage-data/2711/1 "2018-03-14T15:58:25Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![jason10](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jason10/32/1464_2.png) [@jason10](https://forums.balena.io/u/jason10)\
**Post date:** [January 9, 2019, 10:28pm UTC](https://forums.balena.io/t/basics-using-persistent-storage-data/2711/2 "2019-01-09T22:28:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![samothx](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@samothx](https://forums.balena.io/u/samothx)\
**Post date:** [January 9, 2019, 11:07pm UTC](https://forums.balena.io/t/basics-using-persistent-storage-data/2711/5 "2019-01-09T23:07:37Z")

</div>

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

> **[Define a container - Balena Documentation](https://www.balena.io/docs/learn/develop/dockerfile/)**
>
> Use Dockerfiles to package your {{ $names.company.lower }} services and their dependencies

  
which also defines a volume.

Once the container is active you can call

```auto
balena container inspect <container-id>

```

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

```auto
{
"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

---

<div class="post-metadata">

**Author:** ![jason10](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jason10/32/1464_2.png) [@jason10](https://forums.balena.io/u/jason10)\
**Post date:** [January 9, 2019, 11:11pm UTC](https://forums.balena.io/t/basics-using-persistent-storage-data/2711/6 "2019-01-09T23:11:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![samothx](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@samothx](https://forums.balena.io/u/samothx)\
**Post date:** [January 9, 2019, 11:15pm UTC](https://forums.balena.io/t/basics-using-persistent-storage-data/2711/7 "2019-01-09T23:15:10Z")

</div>

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
