Mounting a external USB Key on home assistant Green?

I wondering if someone can assist and provide a step by step process to mounting a USB drive specifically on a Home Assistant Green.
Everything online i’ve found online is fragmented, based on a much older versions of home assistant that use a “Import from USB” which doesn’t exist on the more recent versions of it.

I specifically bought a
Transcend ESD310 256GB usb key to use with home assistant.
This is a very fast USB key and will maximise the use of the USB2 port provided

Ultimately my use case (a lot of solar data) is to have it automount and then move the recorder to it and run it off Maria-DB instead of sqlite3 (as the Home Assistant Green has a small 32GB of emmc storage)

I am currently running latest version at time of writing on Home Assistant Green

  • Core 2023.12.4
  • Supervisor 2023.12.0
  • Operating System 11.2
  • Frontend 20231208.

I have formatted the USB Key to ext4 format and labelled it

When i
login to Advanced SSL & Terminal
install lsblk
apk add lsblk

and run it I see the drive is visible as part sda1 inside a disk sda but is NOT mounted

I created a folder inside media called usb
Then chmod 777 /media/usb

Then I try to mount it
sudo mount -t ext4 /dev/sda1 /media/usb
I get a message
mount: permission denied (are you root?)

I’ve also tried the above starting with sudo -i first and got the same result

What am I doing wrong here?
If you have a working solution how do I then have it automount on boot on the Home Assistant Green

Thanks In advance :slight_smile:

Update: worked out how to do it so this is what I did
To Mount a USB External Drive/Stick (Tested on and For Home Assistant Green Hardware)

NOTE : Attempt this at own risk

1 Home Assistant Green (already configured, running and logged with username)

1 Spare Micro SD Card (any size)

Just used to setup import process
Format it to NTFS in windows
Label it CONFIG
Create a folder called udev

Using notepad in windows , create a text file containing the following script, call it
and copy it into the udev folder. Make sure filename is not ending with a .txt. Rename if necessary

KERNEL!=“sd[a-z][0-9]”, GOTO=“abort_rule”
ENV{ID_PATH}!=“-usb-”, GOTO=“abort_rule”
IMPORT{program}=“/usr/sbin/blkid -o udev -p %N”
ENV{ID_FS_USAGE}!=“filesystem”, GOTO=“abort_rule”
ENV{ID_FS_LABEL}==“CONFIG”, GOTO=“abort_rule”
ENV{ID_FS_LABEL}!=“”, ENV{dir_name}=“%E{ID_FS_LABEL}”
ENV{ID_FS_LABEL}==“”, ENV{dir_name}=“usb-%k”
ENV{ID_FS_TYPE}==“ntfs”, ENV{fstype}=“-t ntfs3”
ENV{ID_FS_TYPE}!=“ntfs”, ENV{fstype}=“-t auto”
ACTION==“add”, RUN{program}+=“/usr/bin/mkdir -p %E{mount_point}”, RUN{program}+=“/usr/bin/systemd-mount %E{fstype} --no-block --automount=no --collect $devnode %E{mount_point}”
ACTION==“remove”, ENV{dir_name}!=“”, RUN{program}+=“/usr/bin/systemd-umount %E{mount_point}”, RUN{program}+=“/usr/bin/rmdir %E{mount_point}”

  1. Prepare a Seperate USB Stick In Windows for later use in Home Assistant Green
    USB Stick must be formatted to ext4 format. It might work with NTFS but havent tested it
    Use a free tool like AOMEI Partition Assistant Standard in windows to do it
    Label the drive HA-USB (Do not label this drive CONFIG!)

  2. Insert the microsd in a running Home Assistant Green
    Please ensure no USB Sticks are plugged into USB Green

    From a website enter

    Select the 3dots icon in the “Host” Section

    Select “Import from USB”

    In the bottom section Supervisor scroll down to the bottom and press “Refresh”
    If it worked you should see 2 lines with the most recent date
    YY-MM-DD 10:52:38 INFO (MainThread) [supervisor.os.manager] Synchronizing configuration from USB with Home Assistant Operating System.
    YY-MM-DD 10:52:41 INFO (MainThread) [] Restarting local service hassos-config.service

  3. Remove the Micro SD Card

  4. Plug in the USB Stick
    Wait a minute for it to be detected

  5. Log back onto your Home Assistant Green

    From a website enter
    If you click on
    Media → My Media
    You should see your drive HA-USB Mounted
    At this point drive is mounted but not usable

  6. Final step, a reboot is needed
    Settings → System → Top Right Gadget Symbol → Advanced Options Dropdown → Reboot System

  7. Drive should now be read write and persistent and survive a cold boot

NOTE: the mount point is /media/HA-USB

If you have SSH Terminal Installed you can see it by typing df

1 Like

Hi, I followed your instructions and the drive is not showing up in media. Are there any suggestions to look at?

1 Like

This worked perfectly for me, thank you so much for the detailed description. I hope this gets more user friendly in the future.