[SOLVED] Mount USB drive in Hassio to be used on the Media Folder with udev customization

@paoloantinori @petikeje @goldbowler @Morphy @mutlu @FreakZAR @sparkydave

right, all work at the first attempt, just nothing in the media/newfoldercreate, after the first reboot, it works!!!

BUT after a 2nd reboot nothing works, rules have gone…

any idea please?

So bad, its a nice solution if it will be persistent…lol

and manually it works :

docker container exec -it homeassistant /bin/bash
mount /dev/sdb1 /media/usbstoragelocal

but how make it permanent? i try hours and hours with ssh&terminal addon from @frenck with no luck, i mean manually in the Terminal, it works, but has gone after a reboot, so i try in init_command, errors…try an automation with hassio.stdin threw the ssh addon…errors…

If any good people can help, it would be appreciate…thanks

This was a bit of a struggle, but I managed to figure this out and piece the puzzle together. The gist linked in the original post by OP does what it needs to, using udev, but there’s a couple of gotchas.

I summed it up in a reply - https://gist.github.com/eklex/c5fac345de5be9d9bc420510617c86b5#gistcomment-3883119

1 Like

Just been looking for exactly this, awesome. Will be upgrading my NUC to one with an M2 + a SATA drive and want to mount the SATA to media for Frigate clips.

1 Like

Did you succed in doing so?
Tried it but is seems the SATA drive is not mounted (at least, doesn’t look like it when checking with “df -h”)
BTW - is there a way to mount the SATA drive to a specific folder inside Media?
I’d like only the recordings of Frigate to be saved to the SATA HDD, all the rest of the media to be saved to the NVMe…

2 Likes

I’m still looking at it. Just got my new (2nd hand) i3-6100 Brix so will be moving my HA install at the weekend. Will let you know how I get on.

So I’ve just moved my HA installation over. I’ve managed to mount the the SATA drive under /media/storage following this process: https://gist.github.com/eklex/c5fac345de5be9d9bc420510617c86b5#gistcomment-3883119

I connected monitor/keyboard to my nuc and followed the instructions, finding my uuid and then using vi to create the 80-rule. Just testing it now, but appears to work. Next step is to see if I can actually mount it to Frigate.

:EDIT: OK, changed the 80-mount rules file to mount directly into
/mnt/data/supervisor/media/ and…
IT WORKS! Frigate is now recording directly to my SATA drive as evidenced by the increasing df -ah output from the terminal.

3 Likes

You can also get host / access with docker run -it --rm -v /:/mnt alpine sh via the terminal ssh add-on.

1 Like

Works perfectly, thanks

This works in Home Assistant OS 7.2, Home Assistant 2021.12.10

Thank you. I’ve been like 6 hours now figuring out how to mount an external drive. It seems crazy to me that this isn’t plug and play…

Those who say this isn’t needed because HA is not supposed to be a media server… okay (ugh). Still, plugging a USB drive and see the files is pretty basic, even if “you” don’t want to use it as a media server.

Thanks again for the steps!!!

3 Likes

Hi all I posted in the github but thought more people may be active here (apologies for double post)

I realise i might be making a mistake, my harddrive is added to VM via USB passthrough. I am detecting the UUID

lrwxrwxrwx 1 root root 10 Feb 3 23:05 36071622-61b5-4f69-bab3-27e03c46357d → …/…/sdb1
lrwxrwxrwx 1 root root 10 Feb 3 23:05 5d7db345-f084-4204-a905-999f5e35fdd6 → …/…/sda8
lrwxrwxrwx 1 root root 10 Feb 3 23:05 7cefb21e-124e-4280-ba29-34fc7a04d19b → …/…/sda7
lrwxrwxrwx 1 root root 10 Feb 3 23:05 FFF7-ADD4 → …/…/sda1

lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part1 → …/…/sda1
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part2 → …/…/sda2
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part3 → …/…/sda3
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part4 → …/…/sda4
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part5 → …/…/sda5
lrwxrwxrwx 1 root root 10 Feb 3 23:06 pci-0000:00:07.0-ata-1.0-part6 → …/…/sda6
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part7 → …/…/sda7
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:07.0-ata-1.0-part8 → …/…/sda8
lrwxrwxrwx 1 root root 9 Feb 3 23:05 pci-0000:00:1d.7-usb-0:1:1.0-scsi-0:0:0:0 → …/…/sdb
lrwxrwxrwx 1 root root 10 Feb 3 23:05 pci-0000:00:1d.7-usb-0:1:1.0-scsi-0:0:0:0-part1 → …/…/sdb1

But i don’t know enough about the script to know if it discriminates to only use sata as per the original intent

KERNEL!=“sdb[0-9]”, GOTO=“abort_rule”

ACTION==“add”, RUN{program}+="/usr/bin/systemd-mount --no-block --automount=no --collect /dev/disk/by-uuid/36071622-61b5-4f69-bab3-27e03c46357d /mnt/data/supervisor/media" ACTION==“remove”, RUN{program}+="/usr/bin/systemd-umount /mnt/data/supervisor/media"

LABEL=“abort_rule”

also after saving this script, do i just need to restart the system or do i need to update some reference?

any help would be great thanks

Is there any easy way to get that working on my Home Assistant Blue Odroid?

1 Like

Hi @paoloantinori ,

Thank you very much!

I followed your toturial and my usb drive now mounted to HASSOS successfully and it works perfectly.

I have a question about this solution, is it possible to automount usb drive when HASSOS boot up?

I have followed your instructions and have successfully mounted my exfat formatted hard drive. But I am unable to see any content in the media folder where the drive name is showing up. None of the folders inside are showing up. I have restarted my HA, even rebooted my host. I am at a loss to what I should do next? Anyone have any ideas? I know it has to be something small.

Again thanks for writing such detailed instructions

1 Like

Did you tried it on the Blue Odroid?
Also running my HASS.IO on the Blue and want to connect an external SSD for storing the recorder DB.
Sadly HA 05/2022 has removed the abillity to use SQLITE in memory for recorder.

thx

Looks like HA OS can’t read exFAT and NTFS partitions. Still happening in HA OS v8.1.


Anybody found a way to add the exFAT or NTFS drivers?

2 Likes

Yeah I am noticing this as well with the formats. Probably just going to give up on this and rebuild my Home Assistant into one of the other many methods of running it. I thought the point of the OS was to sorta, just work without hacking things together.

It makes no sense why there is no native removable storage support in something that definitely should.

2 Likes

I’m with you on that. I still can’t get my drive mounted. It finds it in the OS but then HA container won’t mount it.

I’ve managed to get my drive mounted now, and it works, which is cool - is there any way to determine how much free space there is left on it from HA?

Thanks for posting this.
I tried it out and it indeed works and i can see my hard drive now in media folder but my conbee II stick stops working both with deconz and zigbee2mqtt integration

Any solutions for it ?

how the hell isn’t this supported?!

3 Likes