does this work with a remote cifs mount? Or just a local attached disk?
i am running Homeassistant OS as VM on my ESXi. Tried all ways (except the one described by urko and reedy to “unsquash” the root file system)
Thats of course a solution i would like to avoid. My overall target would be to use mount a folder which i can use in the HomeAssistant media browser.
Do anyone else see another chance to do that?
p.s. already upvoted the feature request
Thank you for the upvote! <3
But now with the script it is much easier.
And as from what i can see,that on one partition the fstab stayes and is not overwriten.
So i can maybe change the script to check if exists already and just inject to another partition.Will see next update.
Please vote for my feature request:
Why to seperate feature request? it would not make any sence, just vote on my FR will post link
I have 42
Well I didn’t find a FR when I searched
pls if you can delete D: it would be awesome D:
Anyone have issue/feature request where the devs have said if/when this will be worked on ?
I’ve found this interesting part in the blog post of the release of hasOS6
Operating System release 6 comes with a new, Go written daemon called OS Agent. This allows the Supervisor to access more aspects of the OS. One such aspect is to move the data to an external data disk or wipe data to start over without reinstalling. Note however that at this point, the required logic in the Supervisor and Frontend is still being developed.
So I guess they are aware of the issue and might already be working on it ? I’ve read a bit about buildroot which they seems to use. There’s plenty of way they could allow us to do the configuration at the OS level, it’s not “that” complicated, they are probably looking to deliver a full feature with WebUI support and everything… The Buildroot user manual
I don’t have any experience with Buildroot… I’m trying to find if there’s trace of something we could use to run a mount that doesn’t require to rebuild the squasfs… operating-system/buildroot-external/scripts at master · home-assistant/operating-system · GitHub
The thing is when you have HA OS and you change the script after update the script is gone.
I have been that road with buildroot-external . The only thing that its possble there is a ticket on github reguarding fuseos but there are no developers on it. We need to wait for looooong time :>
The one thing that they could have done is to remove cleaning script to not delete the fstab. But they cant, i have a discussion on github with them
Thx for the info, could you share the issue with us ? I’ll follow it at least to see if something move one day
Thank you very much. The ’ ’ around the shell_command did the trick for me :-). This is missing in a lot of other threads!
I would not call it “missing” that quickly. For sure on for example my install it works fine without the ’ '.
So I’m sure, that the threads where it is written that way it is, because it just works that way for many people too…
Seems I found a workaround: you can make a symbol link from
/media and use
This way configuration won’t be broken even if
/mnt/media folder doesn’t exists at the moment of HA start:
shell_command: mount_nas_music_folder: mkdir -p /mnt/music; ln -s /mnt/music /media/;mount ...
I’ve tried dozens of different variations in Terminal but I consistently get a “Permission Denied” error. I’m running HA in a VM on my QNAP NAS. Does anyone have instructions for the code that will mount a NAS directory just manually using Terminal? I should be able to figure to figure out the Automation from there but I would like to successfully mount a directory manually to validate that I have it right
Seems it is not possible in the terminal because it runs in a separate container with restricted permissions.
Moreover, you won’t see the directory mounted in the terminal even when it work: the /mnt folder in terminal and HA are different folders.
Just put the configuration into you configuration.yaml:
homeassistant: media_dirs: media: /media shell_command: mount_media: 'mkdir -p /mnt/media;ln -s /mnt/media /media/;mount -t cifs -o username=.....'
And then run it from
It should be visible under
It’s a little bit strange, I still got an error:
Logger: homeassistant.components.shell_command Source: /usr/src/homeassistant/homeassistant/components/shell_command/__init__.py:115 Integration: Shell Command ([documentation](https://www.home-assistant.io/integrations/shell_command), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+shell_command%22)) First occurred: 1:44:05 PM (2 occurrences) Last logged: 1:44:06 PM Error running command: `mkdir -p /mnt/nas-media;ln -s /mnt/nas-media /media/;mount -t nfs4 nas.lan:/Multimedia/Music /media/nas-media`, return code: 255 NoneType: None
And this is my command:
shell_command: mount_nas_music_folder: mkdir -p /mnt/nas-media;ln -s /mnt/nas-media /media/;mount -t nfs4 nas.lan:/Multimedia/Music /media/nas-media
shell_command didn’t give a clear log of stdout or stderr, which make it pretty hard to debug the command, sad story…
This is what worked for me. I am running an Ubuntu host server with HA as a KVM VM. I already had a Samba share setup for media. I also had nfs-kernel-server already installed on the host server. When trying to mount the cifs share in HA I was getting an error because the password contained a ) symbol in it. I’m now wondering if the posts recommending using ’ ’ around the mount commands would have resolved that issue. But I have not tested that. I switched to trying to mount it as an NFS share.
NOTE IP Addresses and folder paths have been changed where necessary for security reasons.
To get past the permission denied error for NFS mount command in HA, 1st in HA terminal run the mount command using the -vvvv option to see verbose messages. The network IP address of my HA server is 192.168.1.12. However, the verbose message showed that HA VM was communicating with host server using a client IP address of 172.30.32.2. Next on the server that I’m exporting (sharing) the media folder from, run command:
ls -l /path/to/shared/folder
(using your path) to see user and group of folder owner. Then run the command:
where username was determined from previous ls command. The output of the id command will give you the user id and group id corresponding to the output of the ls command. Then edit the /etc/exports file (as root or sudo) on the server containing the shared media folder adding a line like the one below, adjusted for your environment:
/local/folder/media 192.168.1.12(rw,no_subtree_check,all_squash,anonuid=1001,anonguid=141) 172.30.32.2(rw,no_subtree_check,all_squash,anonuid=1001,anonguid=141)
/local/folder/media is the folder you are sharing
I added both HA network IP Address and the client IP Address used to communicate with host to be safe.
anonuid = the user ID for the folder owner, and anonguid = the group id for folder.
make sure there is not a space between the IP Address and the (.
Save the file then restart nfs service with command:
sudo systemctl restart nfs-kernel-server
Occasionally the service failed to restart for me. I double check the exports file but didn’t see anything wrong. The NFS service restarted on the 2nd try.
In configuration.yaml I have:
homeassistant: media_dirs: media: "/media"
shell_command: make_music_folder: mkdir -p /media/music mount_music_nfs_folder: mount -t nfs4 -o rw 192.168.1.10:/local/folder/media /media/music
I used the media folder since it already existed in HA and I wouldn’t have to worry about recreating it after upgrading HA.
After rebooting HA host I was able to go to Developer Tools → Services and run both shell commands. I can now go to the Media tab and browse through all of the folders and files in the mounted share. My next step is to create an automation based on previous posts to run the shell commands upon HA startup.