Xia
May 15, 2020, 3:44am
1
Hi,
I am trying to use mount
to access the external storage with Balena Fin. I followed the steps of https://www.balena.io/docs/learn/develop/runtime/#mounting-external-storage-media
And this is the output of listed USB ports:
If I want to use command:
,
what is the device-name and mount-point from the above pictures? I know the ID of the device is Bus001 Device006
Xia
May 15, 2020, 5:25am
2
Here I found the device name, but the mount command seems not works for my device
Hi, I think you are missing mount point in the command:
mount -t ntfs -o rw /dev/sda1
You can take a look at this repo which demonstrates how to automatically mount external drives when plugged.
Xia
May 15, 2020, 8:30am
11
@karaxuna Do I need to create a new mount point in filesystem? I am trying to store the audio signal detected by a microphone into an external storage. Do I need to create a WORKDIR /dev/sda1
in the current Dockerfile?
You should create a folder to mount to:
mkdir -p /mnt/sda1
Then mount:
mount -t ntfs -o rw /dev/sda1 /mnt/sda1
Then you can put audio data in /mnt/sda1
.
Xia
May 15, 2020, 8:55am
16
@karaxuna It shows an error
Xia
May 15, 2020, 9:07am
17
@karaxuna Do I need to change the type of the device? I changed the type from ntfs to ext4 and it shows the error
Sorry for the above. In order to persist data, you have to store it in named volume. If your app has single container, default docker-compose.yml creates named volume for you that links to a /data
folder (see https://github.com/balena-io/docs/blob/master/shared/general/persistent-storage.md#-namesoslower--v2120-and-above ). Can you try /data/mnt/sda1
folder as a mount point instead?
Xia
May 15, 2020, 9:26am
19
@karaxuna It shows no such mount point
There is no such mount point in filesystem
Did you run mkdir -p /data/mnt/sda1
first?
Xia
May 15, 2020, 10:24am
21
@karaxuna . It shows the error with mkdir
Is your application multicontainer? If so, can I see it’s docker-compose.yml file?
Xia
May 15, 2020, 10:31am
23
@karaxuna I run with single container
Can you enable support access to take a look?
Xia
May 15, 2020, 10:38am
25
Yes, i enabled the grant support access
I see that main container status is “Exited”. Were you running these commands in host OS?
The /data
directory only exists in the container. In host os it’s /var/lib/docker/volumes/1622595_resin-data/_data
. So here are the commands that I run to mount:
cd /var/lib/docker/volumes/1622595_resin-data/_data
mkdir -p ./mnt/sda1
mount -t ext4 -o rw /dev/sda1 ./mnt/sda1
container should write data to /data
folder.