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

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

I have no idea… would be nice.

A little dumb story I want to share in case it could save someone else some time.

I 've been using this solution with a FAT drive successfully for a while. I’m using it mostly to store media files, have Jellyfin as mediacenter, and having it connect with a Torrent downloader and all the related services.
It was working fine.

Until a certain day I’ve noticed that my Media center library was empty.
I then connected via ssh to see if the drive was still there or if it was an hw failure, but actually the filesystem was there. Although something odd happened: only the metadata files were there, and not the multimedia files.
I considered multiple options: some security breach that had deleted my media files, me configuring something wrong on the 2 or 3 sw that access the same files or anything. I was annoyed, but it could have been my fault.

Then I tried the drive on my main laptop and all the multimedia files were there, next to the metadata. Interesting.
I’ve then started speculating. Was the underlying linux or even Hassio doing some trick to prevent specific file extensions? Was I facing some oddity at container overalyfs level?

After a while I’ve realized what happened:
I must have restarted my rpi4 with the drive unplugged. That prevented the drive to be mounted. But all the addons that are configured to use those folders, have recreated the directory structure (mounted probably on the main SD). This has triggered the generation of the metadata and descriptors, with the result of letting me believe the media files had been deleted, while I was instead looking at a totally independent filesystem.

For some reason, the udev rules, were not doing their job if the mount point already contained a folder structure!

The solution was to stop all the addon that were using that folder, manually delete the mount point, trigger udev to do his job (either with the command commented in the example or physically unplugging and replugging). This fixed the problem, and the files were now visible again.

I suspect that in the official examples we have all been using, there could be room for a flag that could force to mount even if the destination mount point is already attached to something. I will try to investigate this, but be aware of this risk.

1 Like

This would explain exactly the weird behavior i had! Nice job