stwf

stwf

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!

Showing Posts 1 to 9

stwf

stwf OP

The device is found at startup:
00:00:10.079 [info] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
00:00:10.079 [info] usb 2-1: New USB device found, idVendor=0bc2, idProduct=ab30, bcdDevice= 1.08
00:00:10.079 [info] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
00:00:10.079 [info] usb 2-1: Product: BUP RD
00:00:10.079 [info] usb 2-1: Manufacturer: Seagate
00:00:10.081 [info] usb 2-1: SerialNumber: NA9F8S18

I’m trying to mount it as /dev/sda1 . Trying /dev/sdb1 (since the usb designation is 2-1) doesn’t yield anything.

stwf

stwf OP

-m /dev/sda1:/root/unsilo:exfat:defaults

in the erlinit.config seems to have no effect.

As part of my application startup I have gotten to the point where:
System.cmd(“mount”, [“/dev/sda1”, “/root/unsilo/”])

will get me

14:44:42.088 [info] trying to mount device
14:44:42.144 [info] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
14:44:42.144 [error] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 1th superblock
14:44:42.166 [info] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
14:44:42.167 [error] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 2th superblock
14:44:42.167 [info] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
14:44:42.174 [error] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 1th superblock
14:44:42.181 [info] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
14:44:42.189 [error] F2FS-fs (sda1): Can’t find valid F2FS filesystem in 2th superblock

Does it need to be f2fs ? Thats seems like it’s for flash devices. Is it OK to format a USB HD like that? I would prefer expat so I can mount it on a mac if needed.

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).

gBillal

gBillal

I updated the linux kernel to include ext4 file system, however I still cannot mount an external hard drive.

iex(48)> cmd("mount /dev/sda1 /data/media")

16:52:20.775 [info] F2FS-fs (sda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)

16:52:20.775 [error] F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
iex(50)> cmd("mount -t ext4 /dev/sda1 /data/media")
mount: mounting /dev/sda1 on /data/media failed: Invalid argument
255

Any idea why this error ?

fhunleth

fhunleth

Co-author of Nerves

Could you double check that ext4 is available by running cat "/proc/filesystems"?

I’m wondering if the kernel option to enable EXT4 didn’t take effect. Like maybe the kernel wasn’t rebuilt after the config changed.

gBillal

gBillal

I looked at that before and ext4 is available

iex(test@nerves-a391)1> cmd("cat /proc/filesystems")

nodev   sysfs
nodev   tmpfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cgroup2
nodev   cpuset
nodev   devtmpfs
nodev   configfs
nodev   sockfs
nodev   pipefs
nodev   ramfs
nodev   devpts
        ext3
        ext2
        ext4
        squashfs
        vfat
        f2fs
nodev   mqueue
nodev   pstore
0
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.

krgnn

krgnn

I’m experiencing a very similar problem with a fat32 formatted drive and the rpi3 system base. mount -t vfat /dev/sda1 /target will fail with “invalid argument” and I can’t figure out why. I would prefer not to build a custom base image, but running out of things to try.

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!

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews