I was ready to give up on Home Assistant... until I moved the database!

Haven’t tried to make the mods yet but; I’m running HassOS 2.11 on a Pi3b+ and when I ssh as root into it I can edit via nano my /etc/fstab file.

Why would you even say that?? :stuck_out_tongue:

Thanks for taking the time to write it up! and at least clearing up that it cant be done on hassio.
I guess ill give the Ubuntu solution a try one morning next week with clear head.

Trhee quick questions that come in mind:

  1. Would the hassio over ubuntu solution be a lot heavier on the RPi than just hassio?
  2. Couldnt i just run the ubuntu from a usb hdd/ssd hooked on the rpi in the first place to avoid the sd issues?
  3. Since i would have a full operating system, couldnt i also host an sql (LAMP or something) on it and use that alongside with hassio?
  1. The server version is stripped down to just the bare minimum, so it’s very light.

  2. Yes you could connect a HDD/SSD via USB to mitigate the SDCard issue

  3. Yes you could install your own DB along side HassIO, you could also run them all from docker this way as well.

Yes. It is.

It doesn’t

HassOS is an appliance. It is not intended as a general purpose distro.

I actually did not even look into whether there’s an option to change the db path, assuming that multiple people claiming there isn’t looked for it already. Well, seems it was a mistake on my end :slight_smile: Great thing, so there IS db path after all :smiley:
But then there’s another issue - how to mount a USB drive in HassOS?

I need to correct myself on that, it seems you can change db_path in it, so there’s just one thing to find out - how to mount a usb drive :smiley:

That said - you may not see much of a difference between sqlite and mysql\mariadb in terms of performance in this usecase. sqlite is very light and fast, and it’s only issue is that it does not support multiple clients writing to db very well. So if it’s only used by hass then it should be fine. As long as it’s not on sd card :smiley: So i’d say until it gets to 500MB+ you should not worry about it. In the end even mysql database is also just a single file, there’s not magic there.

Yeah I know. I’m sorry for sounding so harsh, I was feeling sarcastic at that point. It’s just that it lacks some very useful features, and I feel like it’s better (at this point) to run hass on a more general purpose\server distro. That said even some router firmwares have text editors and sometimes even package manager. So I see why it may not need package manager, but IMO it should have at least a text editor.

Not so sure about that. There’s evidence that mysql\mariadb has better performance. As my setup grows with more sensors/stuff I saw a increase in response time of the history graphs. Mysql solved that for the same hardware (not pi and not SD). Later I moved to postresql as mysql has it’s own quirks.

For small setups sqlite is ok, but you know how addictive HA can be :-).

Completely agree. I don’t use hassio at all. Home assistant in docker for me.

Pretty sure it comes with vi and nano, but it doesn’t matter if it doesn’t have support for ntfs-3g or exfat.

1 Like

Hence my remark about roughly 500MB size :slight_smile: Yes, for a bigger db it’s better to use something else.

Yeah

EDIT
I mean no. Why do you need ntfs or exfat? You can use ext4. It may be tricky formatting it from windows, but I think there are tools that can do that.

Cheaper than a NUC and only uses <5 watts at idle and has multiple
Sata and m2 slot

https://www.hardkernel.com/shop/odroid-h2/

1 Like

Since quite a long time I only boot from the SD-card. The rest is on an external HD. I think I would recommend that to anyone running something that writes much to disk on a RPi.

1 Like

I must say I love RPIs. RPI with an external (SSD) drive is a way to go for any RPI server deployment. I used to have an z-way stack running on rpi that produced many SD log writes rendering the RPI unstable, corrupting the SD etc. Once I moved the whole filesystem to a cheap sata SSD in an USB enclosure, alll problems were gone. On the top of that the general performance increase of RPI was immense alhough still on USB. It’s not that involving to move the filesystem to an external drive at all notably on RPI3. There are loads of tutorials out there. It’s definitely worh to try.

1 Like

I too purchased one of these however, it is not for HA. That is running as a docker image on a thinkserver. I have multiple PI’s running various functions in my home automation domain but HA will not be one of them. For “production” type applications and in particular database applications an SD card just doesn’t cut it.
My m.2 adapter is for a totally different project.

+1 agreed.

Processor cache for this device is smaller than a RPi so it will be slower when performing SQL lookups. FYI. I.E. RPi is better for HAs database. Just did some research on this no too long ago.

Great write up. Thanks for taking the time to do this.

Got a bunch of random issues with SD cards also with rpi3+, finally bought usb3 to m.2 enclosure and cheap 32gb m.2 ssd. It was about 25 euros total from eBay.

It was major improvement in the beginning, but gradually declined because of the database. Now I changed database location into ram with instructions in this thread and everything seems to be really smooth.

Trying to run HASSOS is not that easy with usb drive but for some reason I prefer the standard raspian image and python virtual environment more because the environment feels more natural.

HA is great. HA on an RPi is not. Anyone still recommending hass.io probably just got lucky and never tried anything else.

I bought a Synology 2-bay NAS with a SSD drive - JUST for this, and it’s stable as a rock!

I too are tired of the endless stream of lame excused from people that just know better how to run it on an RPi. And it’s ALWAYS the SD card that’s the problem - “Buy a better one”. BUT NO ONE NEVER SAID WHICH ONE IS ACTUALLY GOOD ENOUGH! I know for sure my genuine SanDisk Ultra was not up to the task…

And seriously, why do people bother? Do you just hate, and need to torture yourself by running it on a device thats clearly not suitible for it?

The fundamental problem with anything RPi is its reliance on an SD card for anything at all.

If there is no straightforward way to implement running on OS on disk (spinning hard drive or SSD) then stay away from this thing for anything beyond experimenting.
I haven’t tried this yet, as I ran out of spare cash for yet-anther-sd card but will soon to recover my $ investment: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/

This is use specific.

I’ve run RasPi 2yrs last count without fail or reboot. These were headless video players and some HA remote devices.

If you have heavy r/w on SD it likely will fail. You must use correct equipment for your use. Anything used in wrong manner/environment will fail but blanket “don’t use” does not apply here.

I had the same issues with HA/SD Card. Moved my installation on an SSD and upgraded from ResinOS to Raspian Lite and Hass.io, no problems ever since… and much faster in general.