# A balena container that format and create partition if not exist

**URL:** <https://forums.balena.io/t/a-balena-container-that-format-and-create-partition-if-not-exist/69667>\
**Category:** balenaEngine\
**Tags:** docker\
**Created:** [March 3, 2020, 7:23am UTC](https://forums.balena.io/t/a-balena-container-that-format-and-create-partition-if-not-exist/69667 "2020-03-03T07:23:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rasof](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rasof](https://forums.balena.io/u/rasof)\
**Post date:** [March 3, 2020, 7:23am UTC](https://forums.balena.io/t/a-balena-container-that-format-and-create-partition-if-not-exist/69667/1 "2020-03-03T07:23:36Z")

</div>

Hello

I’m trying to build a solution and it requires many storage unit to be handled by raspberry pi.  
Currently I’m stuck building a docker that detects a storage if it doesn’t have partition and then attempt to create a new one. Do you have any ideas?  
Thanks

---

<div class="post-metadata">

**Author:** ![afitzek](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/afitzek/32/359_2.png) [@afitzek](https://forums.balena.io/u/afitzek)\
**Post date:** [March 3, 2020, 10:35am UTC](https://forums.balena.io/t/a-balena-container-that-format-and-create-partition-if-not-exist/69667/2 "2020-03-03T10:35:12Z")

</div>

Hi,  
I’m not sure what you are trying to achieve, but to work with external media or storage devices in BalenaOS I can point you to the documentation: [https://www.balena.io/docs/learn/develop/runtime/#mounting-external-storage-media](https://www.balena.io/docs/learn/develop/runtime/#mounting-external-storage-media)

---

<div class="post-metadata">

**Author:** ![rasof](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rasof](https://forums.balena.io/u/rasof)\
**Post date:** [March 3, 2020, 4:35pm UTC](https://forums.balena.io/t/a-balena-container-that-format-and-create-partition-if-not-exist/69667/4 "2020-03-03T16:35:38Z")

</div>

My rp will connect to many new unpartitioned usb storages. Thats why I need to a docker to format usb storages before using it.

---

<div class="post-metadata">

**Author:** ![dtischler](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dtischler/32/2483_2.png) [@dtischler](https://forums.balena.io/u/dtischler)\
**Post date:** [March 3, 2020, 6:11pm UTC](https://forums.balena.io/t/a-balena-container-that-format-and-create-partition-if-not-exist/69667/5 "2020-03-03T18:11:58Z")

</div>

Hi there, based on your description, it seems like you will need to create a Docker container, you can certainly use one of base images available in Docker Hub for that. However, the Docker images are mostly just the base operating system to build upon, and your Application needs to be written to handle whatever functionality it is that you are seeking. So, within your application you will need to handle the mounting and unmounting of the USB drives. From an OS perspective though, you can have a look at “Automounting/unmounting with UDev rules” in the documentation that we provide, located here: [https://www.balena.io/docs/learn/develop/runtime/#mounting-external-storage-media](https://www.balena.io/docs/learn/develop/runtime/#mounting-external-storage-media)
