[SOLVED] HASSOS mount NAS network share

Excellent! I have been trying for days to mount a samba share on homeassistant OS, this did the trick. Now I can make available some decently sized disk for the recordings.

I used a slightly different method since I am running homeassistant OS on a proxmox VM.
I created another VM and mounted the homeassistant disk as secondary. This way all partitions show up as /dev/sdb1-/dev/sdb8. The rest is the same.

1 Like

Noice!!! I am very happy that i helped :slight_smile:
I was trying for over a week, with differents methods that didn’t work and then i just gave up.
After some time i was following the trail of the media folder where it ends and i was like ,wait i need the host machine and that’s it :smiley:

Will this be persistant? In other words will it survive any upgrades?

1 Like

I think yes, but there is a possibility that will not, as there are 2 same partitions. One of it might be as a backup or as a temperary system before new upgrade.
Lets wait and see. If it will be a problem i will just make a script and automate it :laughing:
Let me know if you upgrade sooner and will be having problem neverthe-less if you make the switch with notification,you will be notified :slight_smile:

Okay so i have another HASS instance, core was not updated i will now test it if its persistant :slight_smile:
-------- UPDATE 1
Interesting i have another HASS and so when its showing that core update is available sda5 does not have a partition type :open_mouth: my mind just blew :))) So i changed on sda3 and it mounted fine. Now i will perform core update and see :slight_smile:
-------- UPDATE 2
So as it was only on sda3 i updated the operating system and then the mount stopped working.
When i check the sda3 the file is still there, so i think sda3 is for backup and sda5 is the operating system that have priority.After operating system update it was possible to edit on sda5.And it starting to mount again. Now i will try update core and see.
-------- UPDATE 3
After CORE update, it mounted successfully :slight_smile: So i’m prety sure it will survive any next update. So i think when you have update waiting it just block the sda5 and prepare for update. Will try again when new operating system update will be available (soon) :slight_smile:

Thank you so much for this - I’ve been trying to do this for months! All working for me following your instructions.

As per @robha I am using a Proxmox VM. I have a few other VMs running Ubuntu, so I mounted the HA disk inside one of them rather than using a live CD. For anyone else trying this, you will need to manually edit the configuration for the linux VM that you are going to use, and insert the HA disk (e.g. local-lvm:vm-100-disk-1) as a secondary drive. Make sure that you stop the HA VM first, and remove this disk from the second VM before restarting HA!

I have a preference for using a command line binary sensor rather than a switch for monitoring (a bit cleaner):

- platform: command_line
  name: NAS Mount
  command: "[ -f /media/nasup ] && echo 'Up' || echo 'Down'"
  payload_on: "Up"
  payload_off: "Down"

This simply checks whether a file on the NAS is accessible and sets the sensor to on and off. Can be used in the automation in the same way as the switch.

1 Like

Thank you for comment :))) happy to help.
Thank you for the binary sensor, your solution is better, i put it in my post with a reference :slight_smile:

I’m guessing this change won’t survive a Home Assistant OS update, right?

It definetly survived the core update. It should survive OS also,but i can only confirm when i try.

Yes - seems to be fine after updates.

2 Likes

noice! thx for info

Unfortunately after the update to ver 6 i needed to edit fstab on sda3 again. sda5 was fine. It took me like 5 minutes. So i think its fine to do it once a month. Next time i will make script for that to make it one time thing.Or maybe even better make my own bootable image to modify the partitions

Urgh. Just realised that mine hasn’t been mounted since I updated. Took me considerably longer than 5 minutes to get it back up and running again!

i see, next update i will be doing my own iso image, that you can mount and boot,then it will just run the script and update the sda3 sda5 automaticaly. There will be a promnt.Or maybe i can read from config folder and you could save the variables there ? :slight_smile:
The solution is only matter of time :stuck_out_tongue:

So i found gparted iso image which is like 400MB, what do you think put the script hardcoded to image and read variables like ips password from file in config folder in hass?
or run the script that will be saved in config hass folder? Then anybody can change the script on whatever he wants?
I will be making tutorial on how anybody can create his own iso image if will not be comfortable to use mine

UPDATE:
Nevermind, easier would be to make the whole script inside the HASS config.

You didn’t make notification with the binary sensor? :smiley: i did :stuck_out_tongue: so it notify me when nas is offline

Oops tuns out I have been recording for a while to my root filesystem instead of the network share. Better keep track of this in the future.

1 Like

make the binary sensor man as per instruction, its the easiest way. Don’t start frigate automaticaly, i always start manualy in supervisor. This need to be tested more :>

I do, but it didn’t fire. I think it might be a poorly coded automation - it fires when the sensor changes from on to off, but as the connection is lost on restart after an upgrade, there is no state change…

A lightweight vm/iso with a shell script that unpacks and mounts the filesystem, uploads the alternative fstab and repacks it would do the trick I think… Unless there is a way to edit the fstab directly from HA without needing to mount the image? But presumably not as the filesystem is read only… Might be more tricky to get it working with my setup in Proxmox than yours I think…

Yeah as it is read only its not possible because i don’t know how their update system work to do the same. Commands for squashfs are not working in hassos login terminal neather through ssh.
So the only way is to make ISO. I have everything to do it. It will just take some time. Home stuff need to sort out :smiley: