Now I haven’t tried this or anything but I found this little tutorial that moves the home assistant log and db to a usb. They use symbolic links to link from the HA config directory to the usb drive and move the files to the drive. That makes sense to me, might have to give it a try when I have some free time. Eventually I’d like to move the log and db off the pi entirely and onto my server but that’s another can of worms.
https://www.cribbstechnologies.com/index.php/home-assistant/moving-home-assistant-logs/
So, did it work?
I’ve gone the symlink route for my logs and also run my DB from a USB drive as well, but I’m not Hassio.
Thanks for the reply.
I worked out how to symlink DB and log to USB for hassio.
Care to share?
I reconstructed the following from memory. Proceed carefully.
I’ve installed hass.io on raspbian buster. If you have a different installation please adapt accordingly.
Backup everything first (not outlined below)
ssh into raspbian (ssh [email protected] for me)
then su or use sudo in each command
follow these directions to setup the USB stick:
https://thepihut.com/blogs/raspberry-pi-tutorials/17699796-formatting-and-mounting-a-usb-drive-from-a-terminal-window
I created my mountpoint as /usr/share/hassio/share/usbstick via mkdir (so that hassio will see it as /share/usbstick). I wanted it outside /config, but available via the hassio samba addon in /share.
then add this line to /etc/fstab:
UUID=69788be1-6a02-4e8d-ad6c-5c7bd9a3c0f1 /usr/share/hassio/share/usbstick ext4 defaults,nofail 0 0
of course, put in your UUID or use a device designation you’re sure won’t change.
That’ll make sure your stick gets mounted on reboot if it is plugged-in.
Symlinks must be made within the docker container, so now ssh into hassio: (ssh [email protected] -p 222 for me per setup of hassio ssh addon).
hassio ha stop
chmod 775 /share/usbstick
cd /config
mv home-assistant_v2.db /share/usbstick
mv home-assistant.log /share/usbstick
ln -s /share/usbstick/home-assistant.log home-assistant.log
ln -s /share/usbstick/home-assistant_v2.db home-assistant_v2.db
hassio ha start
Thanks. So this can only be done through raspbian?
hi,
You can run on SSD on RPI 3B+ - I think for 3 you have to set that one time USB boot bit IF you don’t mind being on a release candidate - issue #440 is USB boot:
I installed release candidate 3.5 on an RPI 3B+ and it’s working for a few weeks now. Don’t upgrade to stable or you will lose ability to SSD boot though I hope it will soon be incorporated in a stable release.
Installation procedure is identical to SD - flash image to SSD and plug in your RPI (and be very patient). I have the feeling booting is slower than on SD card but once it is up you’ll be happy with the performance gain.
Jhh
I’ve moved on from usb 2 and sticks on 3B+ to usb 3 and nvme on 4B. Much faster.
See Rpi 4 installation