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

Thanks for your answer!
I was referring to the symlink to usb, though. Don’t have a NAS and want to stay Pi only for now, as I don’t need anything more then HA at the moment.

1 Like

So I was right to go for Intel NUK from the beginning :grinning:

1 Like

You’d use something like ln -s <database filename> /mnt/usb_drive/<database filename> in the config directory.

Definetely! Congrats on a smart and sustainable choice.

Yes, I totally agree. Now here are some lower budget Pi alternatives that I think could be worthwhile:

Atomic Pi - a much hyped (for it’s cost effectiveness) development board with a Z8350 CPU, 2GB RAM, 16GB eMMC, Wifi+Bluetooth (35 USD + shipping + power supply) These boards are on limited supply though. Coincidentally available right now at ameridroid.

Z8350 based Mini PCs - different Producers from China (e.g. Beelink) sell this system. Pretty much the same as an Atomic Pi, but smaller, more readily accesible interfaces, and available with 4GB RAM/32GB SSD, has a “neat” case and includes the power supply (~100 USD shipped from china)

Pre-owned Intel NUC - here in Germany you can find worthwhile configured ones on ebay starting at 150 USD

It is worth noting though, that setting up any of these options is far more involved than setting up Hass.io on a RaPi. The atomic Pi comes with Linux preinstalled, whereas the Mini PCs come with Windows - Linux can be installed, but it might be a little fiddly.

3 Likes

XCY mini pcs are competitively priced compared to NUCs too.

Yes, it is. Hass.io uses docker and maps it’s internal container folders to folders on the host system, this is how you keep all your data between hass updates. So your database is also on the filesystem, everything is located, by default, here: /usr/share/hassio

Method I described to you is actually very straightforward and well-known for anyone familiar with Linux. Symlinks are used all over the place with Linux. And as you can see it’s quite easy, just copy database and run 1 command. But I agree that most likely majority of users come with only Windows experience - it should be documented for them and ideally moved into config options. But I can see why developers may not bother with it, because it’s so easy to achieve with native OS tools, so they probably just don’t consider it a priority.

There’s some confusion there, I did not say anything about NAS. This command:

ln -s /path/to/sqlite.db.file /path/to/original/folder

Creates a symlink on local filesystem, anything that’s mounted. So you can do this on hassio host system:

ln -s /mnt/usbdrive/hassio/homeassistant/home-assistant_v2.db /usr/share/hassio/homeassistant/home-assistant_v2.db

or maybe

ln -s /mnt/usbdrive/hassio/homeassistant/home-assistant_v2.db /usr/share/hassio/homeassistant/

Not sure if filename is required in the destination path. (It’s source - destination order). So this way you’re creating a symlink from your existing file on the usb drive to the ‘virtual file’ placed in the config folder.

Just dont forget that you also need to mount a usb drive with /etc/fstab file.

Damn right you were :smiley: Though frankly if I only needed to run hass it would be a huge cringe for me to use a NUC because of all the power wasted. I hope you dont just run hass on it, there’s lots more you can use it for at the same time :smiley: Good option would be to install Proxmox on it, run hass.io inside a VM, and then use other VMs and LXC containers for other services.

That’s what I told him :smiley: Twice now. You messed the order though, we need to create a link from the file on the drive to the virtual file\symlink in config directory, not the other way around :slight_smile:

It is, but not THAT much more involved. Hass.io is installed on any host by running a single script. So just… install linux (Ubuntu), then follow these instructions: Installation - Home Assistant (just run those commands and that’s all).

Done.

Script can be used on debian as well, I do think there’s just a but more to installing docker on debian, I don’t quite remember. Not sure if it will work on other distros.

I’m actually surprised how a lot of people just jump onto NUCs genuinely believing they are the only option. Just google for a “net-top” or “mini PC” that’s what NUC is, they’ve existed long before NUCs appeared. There are lots of cheaper options, from Gigabyte, Zotac and other brands. And NUC is huge overkill for hass, it’ll run like on 2% of it’s performance capacity. Even Pi in truth only uses like 10% of it’s CPU for most hass installations, it’s just the SD card that’s the problem.

3 Likes

So much information :slight_smile:

That’s me, unfortunately, but im trying t change it.
Ill look into the symlink solution.

1 Like

I tend to get carried away when explaining something :smiley:
But in short, all you need to do is mount usb drive in fstab file, move (not copy) database file to new\any location on usb drive, and create a symlink with 1 command.

Thats good to hear :slight_smile: A lot of people just prefer to not bother with anything that’s not familiar or not a one-click solution. Can’t blame all of them, though, not everyone has time for it.

1 Like

Having the same issues like alex, until i bought a Dell Wise pc for aprox 40$ from an outlet store ( https://www.discountelectronics.com/dell-wyse-dx0d-909634-01l-2gb-ram-thin-client/ ) with regular 4gb of ddr3 mem , dual core AMD, an adapter cable for an SSDor HDD, moded a smal fan inside. Made myself a great HA Linux Box, never had an issue with him for months, with dozens of sensors, mariadb, influx, portainer etc!

1 Like

Whoops, sorry it was early :stuck_out_tongue:

Can you link to the steps you used to move your database to AWS?

In the event AWS is inaccessible, as in the case if Internet access is interrupted, how well does Home Assistant handle the error? Without the ability to log anything, does it stoically continue working or does it simply stop?

So,
The first steps as i imagine they should be:

  1. Format a usb drive as NTFS (im on a windows machine, hope that’s no issue)
  2. Remove the aws address and reboot hassio to make it create a new DB file.
  3. Move the db file to a flash drive (and delete the original)
  4. Go to Hassio-> System -> Hardware and see where my Flash drive is:
    image
  5. Guessing that in order to access the fstab simple ssh access would not suffice so ill need to use this guide right?

The recorder component gives errors but it does not affect any other operation of HA, iirc

I’m running on a Pi3b+ for a year now with no issues other than self inflicted gun shots to the foot. I keep a VERY small log used only when debugging 'cause I really don’t care when the guest bedroom light was last turned on. I am, however, about ready to grab an additional spare Pi I’ve got laying around to turn into a database dedicated to my Pi/HA… I’ll try hardwiring the network ports and maybe using some ductape to make me a little silver brick. :slight_smile:

This might be worth a try to reduce your database, it worked for me.

Good to know - I’ve wondered the same thing myself as I’ve thought about migrating my DB to another computer at home that’s on most of the time. If HA fails gracefully in the event that the machine is off for a bit, that might be a good way to go…

Same here. I moved my DB to the one running on my NAS and since then everything running smoothly.

1 Like

Then it might be worthwhile to create an automation that detects this situation (recorder is unable to log data to inaccessible database) and notify someone of it.

Otherwise, it’s conceivable that Home Assistant will merrily continue to function without a database thereby creating gaps in every sensors’ history.

  • Offloading the database from the SD card to another medium, a more robust medium, is a worthwhile exercise.
  • Offloading it to the cloud seems like an exercise in finding new ways to create failure scenarios (re: SmartThings).
1 Like

Well, I’m not sure what you mean by ‘simple ssh access’. I’m not sure how exactly ssh is setup on hassos, but you need to connect to your host (rpi) over ssh, and then switch to root user if it’s not already. From that guide it looks like they did not set up a password and only allow access with authorized keys… well, it’s good for security but I don’t think it’s worth it unless you expose ssh port to wan.

You don’t need to connect to container’s ssh, just the host, and edit fstab on the host. Whatever you do, you don’t need to do anything inside any of hassio containers, unless its something very temporary. Changes made inside containers are not persistent.

  1. If you’re gonna just use it on linux only then it’s better to format it with ext4, ntfs has some quirks and permission issues on linux, will just save you from some pain down the road. Or at least fat32, but not sure about it
    2-3-4 yes
    You can use blkid command to display your disks and their UUIDs and /dev/sdX paths, and it’s probably better to use UUID to mount it instead of /dev/sdX path.

Now that I see how hard they made it all on HassOS I think that they should really just put in a config value to change log path, lol. I’m so glad I run it on generic Debian VM.

Hell I think you’d be better off just installing Debian on your RPI and running hass.io install script I linked earlier. Then you’ll have easy ssh access, you’ll be able to install Webmin to have a GUI for server administartion, and you’d be able to format and mount flash driver through Webmin. Even better you can install ubuntu or debian with Desktop and do it all from there.

1 Like