stwf

stwf

Mount USB hard drive on boot

I’m trying to mount a USB hard drive on my nerves device at boot, I am using a custom system, so I have some flexibility.

But I’ve tried adding a -m directive to my erlinit.config as well as just mounting it in my application and it isn’t working.

If I am mounting to /root/uns/ does the filesystem on the USB drive have to match the file system on the card?

I added the ExFat and ExFat utilities to my system, and I tried using exfat as a disk format, and others. What disk format should I be using?

Any other ideas are welcome. My goal is to get postgres and influx installed and saving their data to the USB drive as well as a Phoenix app that can store uploads there.

Thanks in advance!

Most Liked

fhunleth

fhunleth

Co-author of Nerves

It doesn’t need to be F2FS. When you don’t specify a filesystem format, mount tries the filesystems that are available and F2FS is particularly verbose.

Try passing the filesystem type that you want to mount by using -t option.

You can get the list of available filesystem drivers by reading /proc/filesystems. If you don’t see the one that you want, you’ll need to update the Linux kernel configuration to included it. I’m pretty sure that vfat is what you want and that should already be enabled.

Also, as you noticed erlinit runs way too early in the boot process and Linux hasn’t enumerated the USB drive yet. Mounting filesystems in erlinit is really only intended for pseudo filesystems (like those under /sys) and things needed before any Elixir code is run (like the application partition so that the the command line history file can be initialized or read).

krgnn

krgnn

For posterity: after lots of playing around, I realized that I had created the USB sticks with a gpt partition table. After switching the disk to trusty MBR + exFAT code (07 in fdisk), and creating the disk using mkfs.vfat mounting worked. IMO the base images should include support for GPT partition tables though!

gBillal

gBillal

Finally, I was able to mount the hard drive. There’s an issue related to version or architecture differences between x86_64 and arm64. I cross-compiled the e2fsprogs, copied the mkfs.ext4 to the nerves image, formatted the hard drive and I was about to mount it without any issue.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New

We're in Beta

About us Mission Statement